Exemplo n.º 1
0
 private void ExcuteLevel(FageUIManager manager, FageUIRequest request)
 {
     if (request.uiCurtain != null)
         manager.ReserveState ("FageUIManagerCurtClose");
     else
         manager.ReserveState("FageUIManagerLoad");
 }
Exemplo n.º 2
0
    public override void AfterSwitch(FageStateMachine stateMachine, string beforeId)
    {
        base.AfterSwitch(stateMachine, beforeId);
        FageUIManager manager = stateMachine as FageUIManager;
        Queue         queue   = manager.GetRequests();

        if (queue.Count > 0)
        {
            FageUIRequest request = queue.Peek() as FageUIRequest;
            switch (request.command)
            {
            case FageUIRequest.POP:
                ExcutePop(manager, request);
                break;

            case FageUIRequest.CHANGE:
            case FageUIRequest.PUSH:
                ExcutePush(manager, request);
                break;

            case FageUIRequest.POPUP:
            case FageUIRequest.POPDOWN:
                ExcutePopdown(manager, request);
                break;

            default:
                throw new UnityException("unkown command");
            }
        }
        else
        {
            throw new UnityException("request lost");
        }
    }
Exemplo n.º 3
0
    private void OnTweenComplete()
    {
        FageUIManager manager = FageUIManager.Instance;

        manager.Pop();
        manager.Level("adventure_alaska_a", FageUIRoot.Instance.FindUICurtain("blackout"));
        manager.Push(FageUIRoot.Instance.FindUISet("adventure"));
    }
Exemplo n.º 4
0
    private void OnOpenComplete()
    {
        GameObject.Destroy(_curtain.GetGameObject());
        FageUIManager manager = FageUIManager.Instance;

        manager.GetRequests().Dequeue();
        manager.ReserveState("FageUIManagerIdle");
    }
Exemplo n.º 5
0
    private void ExcuteFlush(FageUIManager manager, FageUIRequest request)
    {
        Stack stack = manager.GetStack ();
        FageUIMem current = stack.Peek () as FageUIMem;
        stack.Clear ();
        stack.Push (current);

        manager.GetRequests ().Dequeue ();
    }
Exemplo n.º 6
0
 private void ExcutePopdown(FageUIManager manager, FageUIRequest request)
 {
     Queue queue = manager.GetQueue ();
     if (queue.Count > 0) {
         manager.ReserveState ("FageUIManagerTransOut");
     } else {
         manager.GetRequests ().Dequeue ();
     }
 }
Exemplo n.º 7
0
    public override void AfterSwitch(FageStateMachine stateMachine, string beforeId)
    {
        base.AfterSwitch(stateMachine, beforeId);
        FageUIManager manager   = stateMachine as FageUIManager;
        FageUIRequest request   = manager.GetRequests().Peek() as FageUIRequest;
        string        levelName = request.levelName;

        _async = FageBundleLoader.Instance.LoadLevel(levelName);
    }
Exemplo n.º 8
0
    private void OnResultComplete()
    {
        FageUIManager manager = FageUIManager.Instance;
        FageUIRoot    root    = FageUIRoot.Instance;

        manager.Popdown();
        manager.Pop();
        manager.Level("title_horse", root.FindUICurtain("blackout"));
        manager.Change(root.FindUISet("title"));
    }
Exemplo n.º 9
0
    private void ExcuteFlush(FageUIManager manager, FageUIRequest request)
    {
        Stack     stack   = manager.GetStack();
        FageUIMem current = stack.Peek() as FageUIMem;

        stack.Clear();
        stack.Push(current);

        manager.GetRequests().Dequeue();
    }
Exemplo n.º 10
0
    private void ExcutePush(FageUIManager manager, FageUIRequest request)
    {
        Stack stack = manager.GetStack();

        FageUIMem current = new FageUIMem(request.uiSet);

        stack.Push(current);
        // load bundle
        FageBundleLoader.Instance.ReserveLoad();
    }
Exemplo n.º 11
0
 void Awake()
 {
     _instance = this;
     _stackUI = new Stack ();
     _queueUIPopup = new Queue ();
     _queueRequest = new Queue ();
     for (int i = 0 ; i < globalObjects.Length ; i++) {
         DontDestroyOnLoad(globalObjects[i]);
     }
 }
Exemplo n.º 12
0
 private void ExcutePopdown(FageUIManager manager, FageUIRequest request)
 {
     Queue queue = manager.GetQueue ();
     if (queue.Count > 0) {
         FageUIPopupMem current = queue.Peek () as FageUIPopupMem;
         current.Destroy ();
         this.current = current;
     } else {
         manager.ReserveState("FageUIManagerSwitch");
     }
 }
Exemplo n.º 13
0
 private void ExcutePush(FageUIManager manager, FageUIRequest request)
 {
     Stack stack = manager.GetStack ();
     if (stack.Count > 0) {
         FageUIMem current = stack.Peek () as FageUIMem;
         current.Destroy ();
         this.current = current;
     } else {
         manager.ReserveState("FageUIManagerSwitch");
     }
 }
Exemplo n.º 14
0
 void Awake()
 {
     _instance     = this;
     _stackUI      = new Stack();
     _queueUIPopup = new Queue();
     _queueRequest = new Queue();
     for (int i = 0; i < globalObjects.Length; i++)
     {
         DontDestroyOnLoad(globalObjects[i]);
     }
 }
Exemplo n.º 15
0
 private void ExcuteLevel(FageUIManager manager, FageUIRequest request)
 {
     if (request.uiCurtain != null)
     {
         manager.ReserveState("FageUIManagerCurtClose");
     }
     else
     {
         manager.ReserveState("FageUIManagerLoad");
     }
 }
Exemplo n.º 16
0
    public override void Excute(FageStateMachine stateMachine)
    {
        base.Excute(stateMachine);
        FageUIManager manager = stateMachine as FageUIManager;

        if (current.state == FageUICommonMem.INTANTIATED)
        {
            manager.GetRequests().Dequeue();
            manager.ReserveState("FageUIManagerIdle");
        }
    }
Exemplo n.º 17
0
 private void ExcutePopup(FageUIManager manager, FageUIRequest request)
 {
     Queue queue = manager.GetQueue ();
     FageUIPopupMem mem = new FageUIPopupMem (request.uiSet);
     queue.Enqueue(mem);
     if (queue.Count == 1) {
         manager.ReserveState("FageUIManagerSwitch");
     } else {
         manager.GetRequests().Dequeue();
     }
 }
Exemplo n.º 18
0
    private void ExcuteChange(FageUIManager manager, FageUIRequest request)
    {
        Stack stack = manager.GetStack ();
        if (stack.Count > 0) {
            stack.Pop();
        }

        FageUIMem current = new FageUIMem (request.uiSet);
        stack.Push (current);
        // load bundle
        FageBundleLoader.Instance.ReserveLoad();
    }
Exemplo n.º 19
0
    private void ExcutePopdown(FageUIManager manager, FageUIRequest request)
    {
        Queue queue = manager.GetQueue();

        if (queue.Count > 0)
        {
            manager.ReserveState("FageUIManagerTransOut");
        }
        else
        {
            manager.GetRequests().Dequeue();
        }
    }
Exemplo n.º 20
0
 private void ExcutePush(FageUIManager manager, FageUIRequest request)
 {
     Stack stack = manager.GetStack ();
     if (stack.Count > 0) {
         FageUIMem current = stack.Peek () as FageUIMem;
         this.current = current;
         current.Instantiate (manager.canvas, request.param);
     } else {
         manager.GetRequests ().Dequeue ();
         manager.ReserveState ("FageUIManagerIdle");
         return;
     }
 }
Exemplo n.º 21
0
 private void ExcutePopdown(FageUIManager manager, FageUIRequest request)
 {
     Queue queue = manager.GetQueue ();
     if (queue.Count > 0) {
         FageUIPopupMem current = queue.Peek () as FageUIPopupMem;
         this.current = current;
         current.Instantiate (manager.canvas, request.param);
     } else {
         manager.GetRequests ().Dequeue ();
         manager.ReserveState ("FageUIManagerIdle");
         return;
     }
 }
Exemplo n.º 22
0
    private void ExcutePopup(FageUIManager manager, FageUIRequest request)
    {
        Queue queue = manager.GetQueue();

        if (queue.Count == 0)
        {
            manager.GetRequests().Dequeue();
            manager.ReserveState("FageUIManagerIdle");
            return;
        }
        // load bundle
        FageBundleLoader.Instance.ReserveLoad();
    }
Exemplo n.º 23
0
    public override void AfterSwitch(FageStateMachine stateMachine, string beforeId)
    {
        base.AfterSwitch(stateMachine, beforeId);
        FageUIManager manager = stateMachine as FageUIManager;

        _curtain = manager.canvas.GetComponentInChildren <IFageUICurtainComponent>();
        if (_curtain == null)
        {
            throw new UnityException("no interface found : IFageUICurtainComponent");
        }

        _curtain.StartOpen(OnOpenComplete);
    }
Exemplo n.º 24
0
    private void ExcutePush(FageUIManager manager, FageUIRequest request)
    {
        Stack stack = manager.GetStack();

        if (stack.Count > 0)
        {
            manager.ReserveState("FageUIManagerTransOut");
        }
        else
        {
            manager.ReserveState("FageUIManagerSwitch");
        }
    }
Exemplo n.º 25
0
    private void OnAnimationComplete()
    {
        FageUIManager manager = FageUIManager.Instance;
        FageUIRoot    root    = FageUIRoot.Instance;

        if ((string.IsNullOrEmpty(firstScene) != true) && (string.IsNullOrEmpty(firstCurtain) != true))
        {
            manager.Level(firstScene, root.FindUICurtain(firstCurtain));
        }
        if (string.IsNullOrEmpty(firstUISet) != true)
        {
            manager.Change(root.FindUISet(firstUISet));
        }
        Destroy(gameObject);
    }
Exemplo n.º 26
0
    private void ExcutePopdown(FageUIManager manager, FageUIRequest request)
    {
        Queue queue = manager.GetQueue();

        if (queue.Count > 0)
        {
            FageUIPopupMem current = queue.Peek() as FageUIPopupMem;
            current.Destroy();
            this.current = current;
        }
        else
        {
            manager.ReserveState("FageUIManagerSwitch");
        }
    }
Exemplo n.º 27
0
    private void ExcutePopup(FageUIManager manager, FageUIRequest request)
    {
        Queue          queue = manager.GetQueue();
        FageUIPopupMem mem   = new FageUIPopupMem(request.uiSet);

        queue.Enqueue(mem);
        if (queue.Count == 1)
        {
            manager.ReserveState("FageUIManagerSwitch");
        }
        else
        {
            manager.GetRequests().Dequeue();
        }
    }
Exemplo n.º 28
0
    private void ExcutePush(FageUIManager manager, FageUIRequest request)
    {
        Stack stack = manager.GetStack();

        if (stack.Count > 0)
        {
            FageUIMem current = stack.Peek() as FageUIMem;
            current.Destroy();
            this.current = current;
        }
        else
        {
            manager.ReserveState("FageUIManagerSwitch");
        }
    }
Exemplo n.º 29
0
    private void ExcutePopdown(FageUIManager manager, FageUIRequest request)
    {
        Queue queue = manager.GetQueue ();
        if (queue.Count > 0) {
            queue.Dequeue ();
        }

        if (queue.Count == 0) {
            manager.GetRequests ().Dequeue ();
            manager.ReserveState ("FageUIManagerIdle");
            return;
        }
        // load bundle
        FageBundleLoader.Instance.ReserveLoad();
    }
Exemplo n.º 30
0
    private void ExcutePop(FageUIManager manager, FageUIRequest request)
    {
        Stack stack = manager.GetStack ();
        if (stack.Count > 0) {
            stack.Pop ();
        }

        if (stack.Count == 0) {
            manager.GetRequests ().Dequeue ();
            manager.ReserveState ("FageUIManagerIdle");
            return;
        }

        // load bundle
        FageBundleLoader.Instance.ReserveLoad();
    }
Exemplo n.º 31
0
    private void ExcutePopdown(FageUIManager manager, FageUIRequest request)
    {
        Queue queue = manager.GetQueue();

        if (queue.Count > 0)
        {
            FageUIPopupMem current = queue.Peek() as FageUIPopupMem;
            this.current = current;
            current.Instantiate(manager.canvas, request.param);
        }
        else
        {
            manager.GetRequests().Dequeue();
            manager.ReserveState("FageUIManagerIdle");
            return;
        }
    }
Exemplo n.º 32
0
    private void ExcutePop(FageUIManager manager, FageUIRequest request)
    {
        Stack stack = manager.GetStack();

        if (stack.Count > 0)
        {
            FageUIMem current = stack.Peek() as FageUIMem;
            this.current = current;
            current.Resume(manager.canvas, request.param);
        }
        else
        {
            manager.GetRequests().Dequeue();
            manager.ReserveState("FageUIManagerIdle");
            return;
        }
    }
Exemplo n.º 33
0
    public override void Excute(FageStateMachine stateMachine)
    {
        base.Excute(stateMachine);
        FageUIManager manager = stateMachine as FageUIManager;

        if (_async != null)
        {
            if (_async.isDone)
            {
                manager.ReserveState("FageUIManagerCurtOpen");
            }
        }
        else
        {
            manager.GetRequests().Dequeue();
            manager.ReserveState("FageUIManagerIdle");
        }
    }
Exemplo n.º 34
0
    private void ExcutePop(FageUIManager manager, FageUIRequest request)
    {
        Stack stack = manager.GetStack();

        if (stack.Count > 0)
        {
            stack.Pop();
        }

        if (stack.Count == 0)
        {
            manager.GetRequests().Dequeue();
            manager.ReserveState("FageUIManagerIdle");
            return;
        }

        // load bundle
        FageBundleLoader.Instance.ReserveLoad();
    }
Exemplo n.º 35
0
    public override void AfterSwitch(FageStateMachine stateMachine, string beforeId)
    {
        base.AfterSwitch(stateMachine, beforeId);
        FageBundleLoader.Instance.AddEventListener(FageEvent.COMPLETE, OnLoadBundleComplete);

        FageUIManager manager = stateMachine as FageUIManager;
        Queue         queue   = manager.GetRequests();

        if (queue.Count > 0)
        {
            FageUIRequest request = queue.Peek() as FageUIRequest;
            switch (request.command)
            {
            case FageUIRequest.CHANGE:
                ExcuteChange(manager, request);
                break;

            case FageUIRequest.PUSH:
                ExcutePush(manager, request);
                break;

            case FageUIRequest.POP:
                ExcutePop(manager, request);
                break;

            case FageUIRequest.POPUP:
                ExcutePopup(manager, request);
                break;

            case FageUIRequest.POPDOWN:
                ExcutePopdown(manager, request);
                break;

            default:
                throw new UnityException("unkown command");
            }
        }
        else
        {
            throw new UnityException("request lost");
        }
    }
Exemplo n.º 36
0
    public override void Excute(FageStateMachine stateMachine)
    {
        base.Excute(stateMachine);
        FageUIManager manager = stateMachine as FageUIManager;
        Queue         queue   = manager.GetRequests();

        if (queue.Count > 0)
        {
            FageUIRequest request = queue.Peek() as FageUIRequest;
            switch (request.command)
            {
            case FageUIRequest.CHANGE:
            case FageUIRequest.POP:
            case FageUIRequest.PUSH:
                ExcutePush(manager, request);
                break;

            case FageUIRequest.FLUSH:
                ExcuteFlush(manager, request);
                break;

            case FageUIRequest.POPUP:
                ExcutePopup(manager, request);
                break;

            case FageUIRequest.POPDOWN:
                ExcutePopdown(manager, request);
                break;

            case FageUIRequest.LEVEL:
                ExcuteLevel(manager, request);
                break;

            default:
                throw new UnityException("unknown commnad");
            }
        }
    }
Exemplo n.º 37
0
    public override void AfterSwitch(FageStateMachine stateMachine, string beforeId)
    {
        base.AfterSwitch(stateMachine, beforeId);
        FageUIManager manager = stateMachine as FageUIManager;
        FageUIRequest request = manager.GetRequests().Peek() as FageUIRequest;

        if ((request.uiCurtain == null) || (request.levelName == null))
        {
            throw new UnityException("parameter (FageUICurtain, levelName) is required");
        }

        GameObject go = GameObject.Instantiate(FageBundleLoader.Instance.Load(request.uiCurtain) as GameObject);

        go.transform.SetParent(manager.canvas, false);
        IFageUICurtainComponent curtain = go.GetComponent <IFageUICurtainComponent> ();

        if (curtain == null)
        {
            throw new UnityException("no interface found : IFageUICurtainComponent");
        }

        curtain.StartClose(OnCloseComplete);
    }
Exemplo n.º 38
0
 private void ExcutePush(FageUIManager manager, FageUIRequest request)
 {
     Stack stack = manager.GetStack ();
     if (stack.Count > 0) {
         manager.ReserveState("FageUIManagerTransOut");
     } else {
         manager.ReserveState("FageUIManagerSwitch");
     }
 }
Exemplo n.º 39
0
    public override void AfterSwitch(FageStateMachine stateMachine, string beforeId)
    {
        base.AfterSwitch(stateMachine, beforeId);
        List <string> resources     = new List <string>();
        List <string> loadBundles   = new List <string>();
        List <string> unloadBundles = new List <string>();

        FageBundleLoader loader = stateMachine as FageBundleLoader;
        Dictionary <string, AssetBundle> downloadedBundles = loader.GetDownloadedBundles();
        Dictionary <string, object>      loadedAsset       = loader.GetLoadedAssets();
        List <string> loadedBundles = loader.GetLoadedBundles();

        FageUIManager manager = FageUIManager.Instance;
        Stack         stack   = manager.GetStack();
        Queue         queue   = manager.GetQueue();

        if (stack.Count > 0)
        {
            FageUIMem mem = stack.Peek() as FageUIMem;
            foreach (string s in mem.uiSet.GetBundles())
            {
                if (!resources.Contains(s))
                {
                    resources.Add(s);
                }
            }
        }
        if (queue.Count > 0)
        {
            FageUIPopupMem mem = queue.Peek() as FageUIPopupMem;
            foreach (string s in mem.uiSet.GetBundles())
            {
                if (!resources.Contains(s))
                {
                    resources.Add(s);
                }
            }
        }
        foreach (FageBundle bundle in FageBundleRoot.Instance.bundles)
        {
            if ((!bundle.isDynamic) && (!loadBundles.Contains(bundle.id)))
            {
                loadBundles.Add(bundle.id);
            }
            else if ((resources.Contains(bundle.id)) && (!loadBundles.Contains(bundle.id)))
            {
                loadBundles.Add(bundle.id);
            }
        }

        foreach (string id in loadedBundles)
        {
            if (loadBundles.Contains(id))
            {
                loadBundles.Remove(id);
            }
            else if (!unloadBundles.Contains(id))
            {
                unloadBundles.Add(id);
            }
        }

        queueBundle = new Queue();
        foreach (string s in loadBundles)
        {
            AssetBundle ab = downloadedBundles[s];
            ab.name = s;
            queueBundle.Enqueue(ab);
        }

        foreach (string s in unloadBundles)
        {
            AssetBundle ab = downloadedBundles[s];
            foreach (string abname in ab.GetAllAssetNames())
            {
                loadedAsset.Remove(abname);
            }
            loadedBundles.Remove(s);
        }
        if (queueBundle.Count > 0)
        {
            AssetBundle ab = queueBundle.Peek() as AssetBundle;
            queueAsset = new Queue(ab.GetAllAssetNames());
        }

        stateMachine.DispatchEvent(new FageBundleEvent(FageBundleEvent.LOADING));
    }