Example #1
0
File: Actor.cs Project: weijunhu/vs
 public void TransState(ActorStateType tStateType, params object[] param)
 {
     if (CurState == null)
     {
         return;
     }
     if (tStateType == CurState.StateType)
     {
         return;
     }
     else
     {
         ActorGameState mState = null;
         if (mStateMachineDic.TryGetValue(tStateType, out mState))
         {
             List <ActorStateType> shieldList = null;
             if (mTransShieldDic.TryGetValue(CurState.StateType, out shieldList))
             {
                 if (shieldList.Contains(tStateType))
                 {
                     return;
                 }
             }
             CurState.Exit();
             CurState = mState;
             CurState.Enter(this, param);
         }
     }
 }
 public void ChangeHighlightState(ActorStateType stateType)
 {
     if (this.m_playButtonHighlightState != null)
     {
         this.m_playButtonHighlightState.ChangeState(stateType);
     }
 }
Example #3
0
        public bool CheckActorState(ActorStateType type)
        {
            bool flag;

            m_ActorStates.TryGetValue(type, out flag);
            return(flag);
        }
    private void BuildStateMap()
    {
        IEnumerator enumerator = base.transform.GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                Transform  current   = (Transform)enumerator.Current;
                ActorState component = current.gameObject.GetComponent <ActorState>();
                if (component != null)
                {
                    ActorStateType stateType = component.m_StateType;
                    if (stateType != ActorStateType.NONE)
                    {
                        List <ActorState> list;
                        if (!this.m_actorStateMap.TryGetValue(stateType, out list))
                        {
                            list = new List <ActorState>();
                            this.m_actorStateMap.Add(stateType, list);
                        }
                        list.Add(component);
                    }
                }
            }
        }
        finally
        {
            IDisposable disposable = enumerator as IDisposable;
            if (disposable == null)
            {
            }
            disposable.Dispose();
        }
    }
Example #5
0
    /// <summary>

    /// 改变状态机

    /// </summary>

    /// <param name="stateType"></param>

    /// <param name="param"></param>

    public void TransState(ActorStateType stateType)

    {
        if (_curState == null)

        {
            return;
        }

        if (_curState.StateType == stateType)

        {
            return;
        }

        else

        {
            ActorState _state;

            if (_actorStateDic.TryGetValue(stateType, out _state))

            {
                _curState.Exit();

                _curState = _state;

                _curState.Enter(this);

                _stateType = _curState.StateType;
            }
        }
    }
 protected override void OnOut(PegUIElement.InteractionState oldState)
 {
     if (this.m_highlight != null)
     {
         ActorStateType stateType = !this.m_isHighlighted ? ActorStateType.HIGHLIGHT_OFF : ActorStateType.HIGHLIGHT_PRIMARY_ACTIVE;
         this.m_highlight.ChangeState(stateType);
     }
 }
 public void ActivateHighlight(bool highlightOn)
 {
     if (this.m_highlight != null)
     {
         this.m_isHighlighted = highlightOn;
         ActorStateType stateType = !this.m_isHighlighted ? ActorStateType.HIGHLIGHT_OFF : ActorStateType.HIGHLIGHT_PRIMARY_ACTIVE;
         this.m_highlight.ChangeState(stateType);
     }
 }
 protected override void OnOver(PegUIElement.InteractionState oldState)
 {
     SoundManager.Get().LoadAndPlay("Small_Mouseover");
     if (this.m_highlight != null)
     {
         ActorStateType stateType = !this.m_isHighlighted ? ActorStateType.HIGHLIGHT_MOUSE_OVER : ActorStateType.HIGHLIGHT_PRIMARY_MOUSE_OVER;
         this.m_highlight.ChangeState(stateType);
     }
 }
 public void SetHighlightState(ActorStateType stateType)
 {
     if (this.m_highlightState == null)
     {
         this.m_highlightState = base.gameObject.transform.parent.GetComponentInChildren <HighlightState>();
     }
     if (this.m_highlightState != null)
     {
         this.m_highlightState.ChangeState(stateType);
     }
 }
    public bool ChangeState_NewState(ActorStateType stateType)
    {
        if (this.m_HighlightState == null)
        {
            return(false);
        }
        ActorStateType activeStateType = this.m_activeStateType;

        this.m_activeStateType = stateType;
        if ((activeStateType != ActorStateType.NONE) && (activeStateType != stateType))
        {
            return(this.m_HighlightState.ChangeState(stateType));
        }
        return(true);
    }
Example #11
0
 public void SetActor(Actor actor, CollectionManagerDisplay.ViewMode type = 0)
 {
     if ((this.m_actor != null) && (this.m_actor.transform.parent == base.transform))
     {
         this.m_actor.Hide();
     }
     this.m_visualType = type;
     this.m_actor      = actor;
     this.UpdateCardCount();
     if (this.m_actor != null)
     {
         GameUtils.SetParent((Component)actor, (Component)this, false);
         ActorStateType activeStateType = this.m_actor.GetActorStateMgr().GetActiveStateType();
         this.ShowNewItemCallout(activeStateType == ActorStateType.CARD_RECENTLY_ACQUIRED);
     }
 }
Example #12
0
        private static bool TryGetActorStateData(
            ActorStateTable stateTable,
            ActorStateType type,
            string key,
            bool expectedResult,
            out ActorStateData data)
        {
            data = null;
            bool actualResult = stateTable.TryGetValue(type, key, out data);

            FailTestIf(expectedResult != actualResult,
                       "TryGetValue({0}, {1}): expected={2} actual={3}",
                       type,
                       key,
                       expectedResult,
                       actualResult);

            return(actualResult);
        }
 public static void Stop(ObjectData objData, ActorStateType stateType)
 {
     if (stateType == ActorStateType.Hurt)
     {
     }
     else if (stateType == ActorStateType.SkillCustom)
     {
     }
     else if (stateType == ActorStateType.SkillDefault)
     {
         var attackData = objData.GetData <ActorAttackData>();
         attackData.defaultAttack.SetActive(false);
     }
     else if (stateType == ActorStateType.Jump)
     {
     }
     else if (stateType == ActorStateType.Move)
     {
     }
 }
    public bool ChangeState_LegacyState(ActorStateType stateType)
    {
        List <ActorState> list = null;

        this.m_actorStateMap.TryGetValue(stateType, out list);
        ActorStateType activeStateType = this.m_activeStateType;

        this.m_activeStateType = stateType;
        if (activeStateType != ActorStateType.NONE)
        {
            List <ActorState> list2;
            if (this.m_actorStateMap.TryGetValue(activeStateType, out list2))
            {
                foreach (ActorState state in list2)
                {
                    state.Stop(list);
                }
            }
        }
        else if ((stateType != ActorStateType.NONE) && (this.m_ObjectContainer != null))
        {
            this.m_ObjectContainer.SetActive(true);
        }
        if (stateType == ActorStateType.NONE)
        {
            if ((activeStateType != ActorStateType.NONE) && (this.m_ObjectContainer != null))
            {
                this.m_ObjectContainer.SetActive(false);
            }
            return(true);
        }
        if (list == null)
        {
            return(false);
        }
        foreach (ActorState state2 in list)
        {
            state2.Play();
        }
        return(true);
    }
Example #15
0
 protected override void OnOver(PegUIElement.InteractionState oldState)
 {
     if (!this.ShouldIgnoreAllInput())
     {
         EntityDef entityDef = this.m_actor.GetEntityDef();
         if (entityDef != null)
         {
             KeywordHelpPanelManager.Get().UpdateKeywordHelpForCollectionManager(entityDef, this.m_actor, this.m_cmRow > 0);
         }
         SoundManager.Get().LoadAndPlay("collection_manager_card_mouse_over", base.gameObject);
         if (this.IsInCollection())
         {
             ActorStateType stateType = ActorStateType.CARD_MOUSE_OVER;
             if (this.CheckCardSeen())
             {
                 stateType = ActorStateType.CARD_RECENTLY_ACQUIRED_MOUSE_OVER;
             }
             this.m_actor.SetActorState(stateType);
         }
     }
 }
 public bool ChangeState(ActorStateType stateType)
 {
     object[] objArray1 = new object[] { stateType };
     return(base.method_11 <bool>("ChangeState", objArray1));
 }
 public bool ChangeState(ActorStateType stateType)
 {
     return(this.ChangeState_NewState(stateType) || this.ChangeState_LegacyState(stateType));
 }
Example #18
0
 public void Show()
 {
     this.m_shown = true;
     base.SetEnabled(true);
     base.GetComponent <Collider>().enabled = true;
     if (this.m_actor != null)
     {
         bool show = false;
         if (this.m_visualType == CollectionManagerDisplay.ViewMode.CARDS)
         {
             string    cardId    = this.m_actor.GetEntityDef().GetCardId();
             CardFlair cardFlair = this.m_actor.GetCardFlair();
             show = CollectionManagerDisplay.Get().ShouldShowNewCardGlow(cardId, cardFlair);
             if (!show)
             {
                 CollectionManager.Get().MarkAllInstancesAsSeen(cardId, cardFlair);
             }
         }
         else if ((this.m_visualType != CollectionManagerDisplay.ViewMode.HERO_SKINS) && (this.m_visualType == CollectionManagerDisplay.ViewMode.CARD_BACKS))
         {
         }
         this.ShowNewItemCallout(show);
         this.m_actor.Show();
         ActorStateType stateType = !show ? ActorStateType.CARD_IDLE : ActorStateType.CARD_RECENTLY_ACQUIRED;
         this.m_actor.SetActorState(stateType);
         Renderer[] componentsInChildren = this.m_actor.gameObject.GetComponentsInChildren <Renderer>();
         if (componentsInChildren != null)
         {
             foreach (Renderer renderer in componentsInChildren)
             {
                 renderer.shadowCastingMode = ShadowCastingMode.Off;
             }
         }
         EntityDef entityDef = this.m_actor.GetEntityDef();
         if (entityDef != null)
         {
             string     tag  = "FakeShadow";
             string     str3 = "FakeShadowUnique";
             GameObject obj2 = SceneUtils.FindChildByTag(this.m_actor.gameObject, tag);
             GameObject obj3 = SceneUtils.FindChildByTag(this.m_actor.gameObject, str3);
             if (CollectionManager.Get().IsCardInCollection(entityDef.GetCardId(), this.m_actor.GetCardFlair()))
             {
                 if (entityDef.IsElite())
                 {
                     if (obj2 != null)
                     {
                         obj2.GetComponent <Renderer>().enabled = false;
                     }
                     if (obj3 != null)
                     {
                         obj3.GetComponent <Renderer>().enabled = true;
                     }
                 }
                 else
                 {
                     if (obj2 != null)
                     {
                         obj2.GetComponent <Renderer>().enabled = true;
                     }
                     if (obj3 != null)
                     {
                         obj3.GetComponent <Renderer>().enabled = false;
                     }
                 }
             }
             else
             {
                 if (obj2 != null)
                 {
                     obj2.GetComponent <Renderer>().enabled = false;
                 }
                 if (obj3 != null)
                 {
                     obj3.GetComponent <Renderer>().enabled = false;
                 }
             }
         }
     }
 }
Example #19
0
 internal static ActorStateDataWrapper CreateActorStateDataWrapperForDelete(ActorStateType type, string key)
 {
     return(ActorStateDataWrapper.CreateForDelete(type, key));
 }
Example #20
0
 private IEnumerator ChangeHighlightStateWhenReady(ActorStateType stateType)
 {
     return(new < ChangeHighlightStateWhenReady > c__Iterator2B {
         stateType = stateType, <$> stateType = stateType, <> f__this = this
     });
Example #21
0
 public void OnChangeState(ActorStateType stateType)
 {
     object[] objArray1 = new object[] { stateType };
     base.method_8("OnChangeState", objArray1);
 }
Example #22
0
 internal ReplicationUnit(long sequenceNumber, ActorStateType stateType)
 {
     this.SequenceNumber            = sequenceNumber;
     this.StateType                 = stateType;
     this.ActorStateDataWrapperList = new List <ActorStateDataWrapper>();
 }
 private void OnChangeState(ActorStateType stateType)
 {
     this.m_stateMgr.ChangeState(stateType);
 }
Example #24
0
 public void SetActorState(ActorStateType type, bool flag)
 {
     m_ActorStates[type] = flag;
 }
Example #25
0
 public void ChangeHighlightState(ActorStateType stateType)
 {
     object[] objArray1 = new object[] { stateType };
     base.method_8("ChangeHighlightState", objArray1);
 }
Example #26
0
 public bool ChangeState(ActorStateType stateType)
 {
     if (stateType == this.m_CurrentState)
     {
         return(true);
     }
     this.m_PreviousState = this.m_CurrentState;
     this.m_CurrentState  = stateType;
     if (stateType == ActorStateType.NONE)
     {
         this.m_RenderPlane.GetComponent <Renderer>().enabled = false;
         this.m_VisibilityState = false;
         return(true);
     }
     if ((stateType == ActorStateType.CARD_IDLE) || (stateType == ActorStateType.HIGHLIGHT_OFF))
     {
         if (this.m_FSM == null)
         {
             this.m_RenderPlane.GetComponent <Renderer>().enabled = false;
             this.m_VisibilityState = false;
             return(true);
         }
         this.m_DeathTransition = this.m_PreviousState.ToString();
         this.SendDataToPlaymaker();
         this.SendPlaymakerDeathEvent();
         return(true);
     }
     foreach (HighlightRenderState state in this.m_HighlightStates)
     {
         if (state.m_StateType == stateType)
         {
             if ((state.m_Material != null) && (this.m_Material != null))
             {
                 this.m_Material.CopyPropertiesFromMaterial(state.m_Material);
                 this.m_RenderPlane.GetComponent <Renderer>().sharedMaterial = this.m_Material;
                 this.m_RenderPlane.GetComponent <Renderer>().sharedMaterial.SetFloat("_Seed", this.m_seed);
                 bool flag = this.RenderSilouette();
                 if (stateType == ActorStateType.CARD_HISTORY)
                 {
                     base.transform.localPosition = this.m_HistoryTranslation;
                 }
                 else
                 {
                     base.transform.localPosition = Vector3.zero;
                 }
                 if (this.m_FSM == null)
                 {
                     if (!this.m_Hide)
                     {
                         this.m_RenderPlane.GetComponent <Renderer>().enabled = true;
                     }
                     this.m_VisibilityState = true;
                     return(flag);
                 }
                 this.m_BirthTransition       = stateType.ToString();
                 this.m_SecondBirthTransition = this.m_PreviousState.ToString();
                 this.m_IdleTransition        = this.m_BirthTransition;
                 this.SendDataToPlaymaker();
                 this.SendPlaymakerBirthEvent();
                 return(flag);
             }
             this.m_RenderPlane.GetComponent <Renderer>().enabled = false;
             this.m_VisibilityState = false;
             return(true);
         }
     }
     if (this.m_highlightType == HighlightStateType.CARD)
     {
         this.m_CurrentState = ActorStateType.CARD_IDLE;
     }
     else if (this.m_highlightType == HighlightStateType.HIGHLIGHT)
     {
         this.m_CurrentState = ActorStateType.HIGHLIGHT_OFF;
     }
     this.m_DeathTransition = this.m_PreviousState.ToString();
     this.SendDataToPlaymaker();
     this.SendPlaymakerDeathEvent();
     this.m_RenderPlane.GetComponent <Renderer>().enabled = false;
     this.m_VisibilityState = false;
     return(false);
 }
 public abstract void TryTransState(ActorStateType tStateType);
 public override void TryTransState(ActorStateType tStateType)
 {
 }
Example #29
0
 public void SetButtonState(ActorStateType stateType)
 {
     object[] objArray1 = new object[] { stateType };
     base.method_8("SetButtonState", objArray1);
 }