using ShadowStudio.Tool; using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using XRTool.Util; namespace ShadowStudio.Model { /// /// /// public class GoodsContainer : ArtContainerHandler { private TransferCell transfer; public virtual void Start() { if (Transfer) { //if (!CommonMethod.isLookRoom()) //{ // Transfer.EditTransfer += OnEditTransfer; // //Transfer.TransferSelect += OnTransferSelect; // Transfer.ZoomTransfer += OnZoomTransfer; //} //else //{ // Transfer.IsCanEditor = false; //} //Transfer.TransferStateChange += OnTransferStateChange; //Transfer.Box.ScaleStopped.AddListener(OnStopScale); //Transfer.Box.ScaleStarted.AddListener(ScaleStarted); } } /// /// 缩放事件 /// /// public virtual void OnZoomTransfer(TransferState state) { if (state == TransferState.Stop) { if (transform.localScale.x < 0) { transform.localScale = -transform.localScale; } OnEditTransfer(state); } } /// /// 当编辑了物体时 /// /// public virtual void OnEditTransfer(TransferState state) { if (state == TransferState.Stop) { OnTransferSelect(true); } else if (state == TransferState.Over) { OnTransferSelect(false); } SendTransfer(2, (int)state); } /// /// 当某物体被选中或被释放 /// /// /// public virtual void OnTransferSelect(bool select) { ArtInfoMgr.Instance.SetContainerSelect(this, select); } //public virtual void OnStopScale() //{ // if (transform.localScale.x < 0) // { // transform.localScale = -transform.localScale; // } //} public override TransferCell Transfer { get { if (!transfer) { transfer = GetComponent(); } return transfer; } } public override void ResetEditorPosition() { if (EditorRoot) { //Vector3 point = Transfer.GetCastPoint(GameSession.Instance.gameHead.position); //point.y -= 0.05f; //EditorRoot.position = point; //Vector3 forwad = point - transform.position; //forwad.y = 0; //EditorRoot.forward = -forwad; } } public override void LockContainer() { base.LockContainer(); if (Transfer) { Transfer.IsLock = true; } } public override void UnLockContainer() { base.UnLockContainer(); if (Transfer) { Transfer.IsLock = false; } } public override void SetSelect() { base.SetSelect(); if (Transfer && !Transfer.IsLock) { Transfer.IsDragEnable = true; } } public override void UnSetSelect() { base.UnSetSelect(); if (Transfer && !Transfer.IsLock) { Transfer.IsDragEnable = false; //Transfer.DisActiveCell(); } } public override int AheadCount() { if (Transfer) { return Transfer.PostureAhead.Count; } return base.AheadCount(); } public override int BackCount() { if (Transfer) { return Transfer.PostureBack.Count; } return base.BackCount(); } public override bool GoAhead() { if (Transfer) { return Transfer.PeekAheadNode(); } return base.GoAhead(); } public override bool GoBack() { if (Transfer) { return Transfer.PeekBackNode(); } return base.GoBack(); } } }