コード例 #1
0
    void LayoutHidden()
    {
        if (_layoutHidden != null)
        {
            _layoutHidden();
        }

        _layoutHidden = null;

        CachedGameObject.SetActive(false);
    }
コード例 #2
0
 /// <summary>
 /// Called when this effect is deactivated. Perform resets here.
 /// </summary>
 internal void Deactivate()
 {
     if (CachedShuriken != null)
     {
         CachedShuriken.Stop();
     }
     CachedTransform.SetParent(null);
     CachedGameObject.SetActive(false);
     if (OnDeactivate.IsNotNull())
     {
         OnDeactivate();
     }
 }
コード例 #3
0
    public override void HandleShow(bool instant)
    {
        if (instant)
        {
            if (_lerpFunction != null)
            {
                StopCoroutine(_lerpFunction);
            }

            CachedGameObject.SetActive(true);

            SetAnimationTime(1f);

            ShowComplete(null);
        }
        else
        {
            if (lerpInProgress && isShowing)
            {
                return;
            }

            if (_lerpFunction != null)
            {
                StopCoroutine(_lerpFunction);
            }

            float n = GetShowAmount();

            if (n == 1f)
            {
                ShowComplete(null);
            }
            else
            {
                if (GetShowAmount() == 0f)
                {
                    exitThrough = false;
                }
                else
                {
                    exitThrough = true;
                }

                CachedGameObject.SetActive(true);

                BeginShow(n);
            }
        }
    }
コード例 #4
0
        /// <summary>
        /// Get the First Available Object from the Pool.
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public GameObject GetObject(int key)
        {
            if (!Pool.ContainsKey(key))
            {
                return(null);
            }

            for (int i = Pool[key].Count - 1; i >= 0; i--)
            {
                CachedGameObject = Pool[key][i];

                if (!CachedGameObject.activeInHierarchy)
                {
                    CachedGameObject.SetActive(true);

                    if (GetIReference(CachedGameObject) != null)
                    {
                        Pool[key].RemoveAt(i);
                        ActivePool.Add(CachedGameObject);
                        Reference.Index = Mathf.Clamp(Reference.Index, 0, ActivePool.Count - 1);
                    }

                    return(CachedGameObject);
                }
            }

            if (ExpandPool)
            {
                for (int i = 0; i < ExpandSize; i++)
                {
                    CachedGameObject = InstantiatePrefab(Pool[key][0], Pool[key][0].transform.parent);
                    SetReferences(CachedGameObject, key, Pool[key], ActivePool);
                    Pool[key].Add(CachedGameObject);
                }

                if (Reference != null)
                {
                    Pool[key].RemoveAt(Pool[key].Count - 1);
                    ActivePool.Add(CachedGameObject);
                    Reference.Index = Mathf.Clamp(Reference.Index, 0, ActivePool.Count - 1);
                }

                CachedGameObject.SetActive(true);

                return(CachedGameObject);
            }

            return(null);
        }
コード例 #5
0
        /// <summary>
        /// Call this when all parameters are supplied as desired.
        /// </summary>
        internal void Initialize()
        {
            CachedGameObject.SetActive(true);
            StartCoroutine(LifeTimer());
            if (OnInitialize.IsNotNull())
            {
                OnInitialize();
            }

            if (CachedShuriken != null)
            {
                CachedShuriken.startSpeed = StartSpeed;
                CachedShuriken.startSize  = StartSize;
                CachedShuriken.Play();
            }
        }
コード例 #6
0
    public override void HandleHide(bool instant)
    {
        if (instant)
        {
            if (_lerpFunction != null)
            {
                StopCoroutine(_lerpFunction);
            }

            CachedGameObject.SetActive(false);
            SetAnimationTime(0f);

            HideComplete(null);
        }
        else
        {
            if (lerpInProgress && !isShowing)
            {
                return;
            }

            if (_lerpFunction != null)
            {
                StopCoroutine(_lerpFunction);
            }

            float time = 1f - GetShowAmount();

            if (time == 1f)
            {
                HideComplete(null);
            }
            else
            {
                if (GetShowAmount() == 1f)
                {
                    exitThrough = true;
                }
                else
                {
                    exitThrough = false;
                }

                BeginHide(time);
            }
        }
    }
コード例 #7
0
    public void ShowLayout(bool instantly, LayoutActionCompleted onCompleted)
    {
        Initialize();

        if (alwaysShowInstantly)
        {
            instantly = true;
        }

        CachedGameObject.SetActive(true);

        _layoutShowCompleted = onCompleted;
        _layoutHideCompleted = null;

        OnShowLayout(instantly, onCompleted);

        RefreshLayout();
    }
コード例 #8
0
        public void Initialize(
            AgentController controller,
            ushort localID,
            ushort globalID,
            Vector2d position = default(Vector2d))
        {
            LocalID    = localID;
            GlobalID   = globalID;
            Controller = controller;

            IsActive     = true;
            CheckCasting = true;
            Selectable   = true;


            CachedGameObject.SetActive(true);
            if (Body.IsNotNull())
            {
                Body.Initialize(position, Vector2d.up);
            }

            if (Influencer.IsNotNull())
            {
                Influencer.Initialize();
            }

            if (Animator.IsNotNull())
            {
                Animator.Initialize();
            }

            abilityManager.Initialize();
            if (StatsBarer != null)
            {
                StatsBarer.Initialize();
            }
            if (Ringer.IsNotNull())
            {
                Ringer.Initialize();
                IsSelected    = false;
                IsHighlighted = false;
            }
        }
コード例 #9
0
        public virtual void Initialize(
            Vector2d position = default(Vector2d),
            Vector2d rotation = default(Vector2d)
            )
        {
            IsActive     = true;
            CheckCasting = true;

            // place game object under it's agent commander
            CachedGameObject.transform.parent = this.Controller.Commander.GetComponentInChildren <RTSAgents>().transform;

            CachedGameObject.SetActive(true);

            if (Body.IsNotNull())
            {
                Body.Initialize(position.ToVector3d(), rotation);
            }

            if (Influencer.IsNotNull())
            {
                Influencer.Initialize();
            }

            abilityManager.Initialize();

            if (Animator.IsNotNull())
            {
                Animator.Initialize();
            }

            SetCommander(Controller.Commander);

            if (_cachedCommander)
            {
                if (!loadedSavedValues)
                {
                    SetTeamColor();
                }
            }
        }
コード例 #10
0
        public void Show(params object[] param)
        {
            CachedGameObject.SetActive(true);
            this.State = E_ObjectState.Ready;

            //播放音乐
            this.OnPlayOpenUIAudio();

            OnShow(param);

            switch (_animationStyle)
            {
            case E_UIShowAnimStyle.Normal:
                ShowNormal();
                break;

            case E_UIShowAnimStyle.CenterScaleBigNormal:
                ShowCenterScaleBigNormal();
                break;

            case E_UIShowAnimStyle.LeftToSlide:
                ShowLeftToSlide(true);
                break;

            case E_UIShowAnimStyle.RightToSlde:
                ShowLeftToSlide(false);
                break;

            case E_UIShowAnimStyle.TopToSlide:
                ShowTopToSlide(true);
                break;

            case E_UIShowAnimStyle.DownToSlide:
                ShowTopToSlide(false);
                break;
            }
        }
コード例 #11
0
 public virtual void Hide()
 {
     CachedGameObject.SetActive(false);
     isActivated = false;
 }
コード例 #12
0
        public void EnablePopup(WeatherEventType weatherEventType)
        {
            CachedGameObject.SetActive(true);

            SetUI(weatherEventType);
        }
コード例 #13
0
ファイル: GUISubMenu.cs プロジェクト: plentypvp/Projects
 public void SetActive(bool _newState)
 {
     CachedGameObject.SetActive(_newState);
 }
コード例 #14
0
 private void Disable()
 {
     CachedGameObject.SetActive(false);
 }
コード例 #15
0
 private void Enable()
 {
     CachedGameObject.SetActive(true);
 }
コード例 #16
0
 public virtual void SetVisible(bool value)
 {
     CachedGameObject.SetActive(value);
 }
コード例 #17
0
 /// <summary>
 /// Disables the screen
 /// </summary>
 public void Hide()
 {
     CachedGameObject.SetActive(false);
 }
コード例 #18
0
 /// <summary>
 /// Called each time this object is spawned. Will be called even if the object was active already, but will be called after OnEnable if was inactive.
 /// </summary>
 protected virtual void OnObjectSpawn()
 {
     CachedGameObject.SetActive(true);
 }
コード例 #19
0
 /// <summary>
 /// Enables the screen
 /// </summary>
 public void Show()
 {
     CachedGameObject.SetActive(true);
 }
コード例 #20
0
 /// <summary>
 /// Called each time this object is despawned. Will be called even if the object was inactive already, but will be called before OnDisable if was active.
 /// </summary>
 protected virtual void OnObjectDespawn()
 {
     CachedGameObject.SetActive(false);
 }
コード例 #21
0
 private void SetActive(bool active)
 {
     CachedGameObject.SetActive(active);
 }