Пример #1
0
    /// <summary>
    /// 在销毁的时候的处理
    /// </summary>
    public virtual void OnDestory()
    {
        machine = null;

        context = null;

        if (container != null)
        {
            Object.Destroy(container);
        }

        container = null;
    }
Пример #2
0
    /// <summary>
    /// 初始化状态机
    /// </summary>
    public void InitStateMachine()
    {
        context = new LancherContext();

        context.gameObject = this.gameObject;

        context.gameObject.AddComponent <LancherCoroutine>();

        stateMachine = new StateMachine <LancherContext>(context);

        stateMachine.changeType = StateChangeType.Immediately;

        context.Init(stateMachine);

        context.callDispose = Dispose;

        stateMachine.AddState(new ShowLogoState(this.stateMachine, this.context));

        stateMachine.AddState(new EnterGameState(this.stateMachine, this.context));

        stateMachine.AddState(new NetErrorState(this.stateMachine, this.context));

        stateMachine.AddState(new PhoneErrorState(this.stateMachine, this.context));

        stateMachine.AddState(new LoadLocalConfigState(this.stateMachine, this.context));

        stateMachine.AddState(new LoadServerConfigState(stateMachine, context));

        stateMachine.AddState(new LoadResConfigState(stateMachine, context));

        stateMachine.AddState(new LoadLogoVideoState(stateMachine, context));

        stateMachine.AddState(new ResolveDLLState(this.stateMachine, this.context));

        stateMachine.AddState(new ShowNoticeState(this.stateMachine, this.context));

        stateMachine.AddState(new LoadErrorState(this.stateMachine, this.context));

        stateMachine.ChangeState <ShowLogoState>();
    }