Ejemplo n.º 1
0
    void LayoutHidden()
    {
        if (_layoutHidden != null)
        {
            _layoutHidden();
        }

        _layoutHidden = null;

        CachedGameObject.SetActive(false);
    }
Ejemplo n.º 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();
     }
 }
Ejemplo n.º 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);
            }
        }
    }
Ejemplo 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);
        }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 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);
            }
        }
    }
Ejemplo n.º 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();
    }
Ejemplo n.º 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;
            }
        }
Ejemplo n.º 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();
                }
            }
        }
Ejemplo n.º 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;
            }
        }
Ejemplo n.º 11
0
 public virtual void Hide()
 {
     CachedGameObject.SetActive(false);
     isActivated = false;
 }
Ejemplo n.º 12
0
        public void EnablePopup(WeatherEventType weatherEventType)
        {
            CachedGameObject.SetActive(true);

            SetUI(weatherEventType);
        }
Ejemplo n.º 13
0
 public void SetActive(bool _newState)
 {
     CachedGameObject.SetActive(_newState);
 }
Ejemplo n.º 14
0
 private void Disable()
 {
     CachedGameObject.SetActive(false);
 }
Ejemplo n.º 15
0
 private void Enable()
 {
     CachedGameObject.SetActive(true);
 }
Ejemplo n.º 16
0
 public virtual void SetVisible(bool value)
 {
     CachedGameObject.SetActive(value);
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Disables the screen
 /// </summary>
 public void Hide()
 {
     CachedGameObject.SetActive(false);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Enables the screen
 /// </summary>
 public void Show()
 {
     CachedGameObject.SetActive(true);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 21
0
 private void SetActive(bool active)
 {
     CachedGameObject.SetActive(active);
 }