private void AddAllWindows(WindowContainer windowContainer, IUIViewLocator locator)
        {
            windowManager = FindObjectOfType <GlobalWindowManager>();
            if (windowManager == null)
            {
                Debug.Log("没有找到GlobalWindowManager");
            }

            //添加场景中所需要的window
            windowManager.Add(locator.LoadWindow <GameMainWindow>(windowContainer, "Prefabs/UI/GameMainWindow"));
            windowManager.Add(locator.LoadWindow <NPCDialogWindow>(windowContainer, "Prefabs/UI/NPCDialogWindow"));
        }
Beispiel #2
0
        protected void OnOpenLoginWindow(object sender, InteractionEventArgs args)
        {
            try
            {
                LoginWindow loginWindow    = viewLocator.LoadWindow <LoginWindow>(this.WindowManager, "UI/Logins/Login");
                var         callback       = args.Callback;
                var         loginViewModel = args.Context;

                if (callback != null)
                {
                    EventHandler handler = null;
                    handler = (window, e) =>
                    {
                        loginWindow.OnDismissed -= handler;
                        if (callback != null)
                        {
                            callback();
                        }
                    };
                    loginWindow.OnDismissed += handler;
                }

                loginWindow.SetDataContext(loginViewModel);
                loginWindow.Create();
                loginWindow.Show();
            }
            catch (Exception e)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn(e);
                }
            }
        }
Beispiel #3
0
    protected void OnOpenWheelWindow(object sender, InteractionEventArgs args)
    {
        try
        {
            IUIViewLocator viewLocator = Context.GetApplicationContext().GetService <IUIViewLocator>();
            WheelWindow    window      = viewLocator.LoadWindow <WheelWindow>(this.WindowManager, "UI/Wheel");
            //var callback = args.Callback;
            var model = args.Context;

            //if (callback != null)
            //{
            //    EventHandler handler = null;
            //    handler = (window, e) =>
            //    {
            //        cardBagWindow.OnDismissed -= handler;
            //        if (callback != null)
            //            callback();
            //    };
            //    cardBagWindow.OnDismissed += handler;
            //}

            window.SetDataContext(model);
            window.Create();
            window.Show();
        }
        catch (Exception e)
        {
            if (log.IsWarnEnabled)
            {
                log.Warn(e);
            }
        }
    }
Beispiel #4
0
        IEnumerator Start()
        {
            /* Create a window container */
            WindowContainer winContainer = WindowContainer.Create("MAIN");

            yield return(null);

            IUIViewLocator locator = Context.GetApplicationContext().GetService <IUIViewLocator>();
            StartupWindow  window  = locator.LoadWindow <StartupWindow>(winContainer, "UI/Startup.prefab");

            window.Create();
            ITransition transition = window.Show().OnStateChanged((w, state) =>
            {
                //log.DebugFormat("Window:{0} State{1}",w.Name,state);
            });

            yield return(transition.WaitForDone());


            //ApplicationContext context = ApplicationContext.GetApplicationContext();
            //ISession session = context.GetService<ISession>();
            //session.Send(10001, -1, new Login() { DriveId = "default" });

            //ApplicationContext context = Context.GetApplicationContext();
            //ISession session = context.GetService<ISession>();
            //session.Connect("127.0.0.1", 10001);
        }
Beispiel #5
0
        protected void StartGame(object sender, InteractionEventArgs args)
        {
            //打开GameWindow
            GameWindow gameWindow = viewLocator.LoadWindow <GameWindow>(this.WindowManager, "UI/GameWindow");

            gameWindow.Create();
            gameWindow.Show();
        }
Beispiel #6
0
    protected void OnOpenCardBagWindow(object sender, InteractionEventArgs args)
    {
        IUIViewLocator viewLocator    = Context.GetApplicationContext().GetService <IUIViewLocator>();
        CardTurnWindow cardDrawWindow = viewLocator.LoadWindow <CardTurnWindow>(this.WindowManager, "UI/CardTurn");
        var            cardDrawModel  = args.Context;

        cardDrawWindow.SetDataContext(cardDrawModel);
        cardDrawWindow.Create();
        cardDrawWindow.Show();
    }
Beispiel #7
0
    protected void OnOpenRewardWindow(object sender, InteractionEventArgs args)
    {
        var            cardBagViewModel = args.Context;
        IUIViewLocator viewLocator      = Context.GetApplicationContext().GetService <IUIViewLocator>();
        RewardWindow   rewardWindow     = viewLocator.LoadWindow <RewardWindow>(this.WindowManager, "UI/Reward");

        rewardWindow.SetDataContext(cardBagViewModel);
        rewardWindow.Create();
        rewardWindow.Show();
    }
Beispiel #8
0
 protected Loading(bool ignoreAnimation)
 {
     this.ignoreAnimation = ignoreAnimation;
     lock (_lock)
     {
         if (refCount <= 0)
         {
             IUIViewLocator locator = GetUIViewLocator();
             window = locator.LoadWindow <LoadingWindow>(ViewName);
             window.Create();
             window.Show(this.ignoreAnimation);
         }
         refCount++;
     }
 }
Beispiel #9
0
 protected Loading(bool ignoreAnimation)
 {
     this.ignoreAnimation = ignoreAnimation;
     lock (_lock)
     {
         if (refCount <= 0)
         {
             ApplicationContext context = Context.GetApplicationContext();
             IUIViewLocator     locator = context.GetService <IUIViewLocator>();
             window = locator.LoadWindow <LoadingWindow>(ViewName);
             window.Create();
             window.Show(this.ignoreAnimation);
         }
         refCount++;
     }
 }
Beispiel #10
0
    private void Start()
    {
        /* Create a window container */
        WindowContainer winContainer = WindowContainer.Create("main");

        IUIViewLocator  locator = context.GetService <IUIViewLocator>();
        LoadingGameView window  = locator.LoadWindow <LoadingGameView>(winContainer, "UI/popup_loading");

        window.Create();
        window.Show();

        for (int i = 0; i < listPopup.Length; i++)
        {
            SmartPool.Instance.Preload(listPopup[i], 1);
        }
    }
Beispiel #11
0
        IEnumerator Start()
        {
            /* Create a window container */
            WindowContainer winContainer = WindowContainer.Create("MAIN");

            yield return(null);

            IUIViewLocator locator = context.GetService <IUIViewLocator>();
            StartupWindow  window  = locator.LoadWindow <StartupWindow>(winContainer, "UI/Startup/Startup");

            window.Create();
            ITransition transition = window.Show().OnStateChanged((w, state) =>
            {
                //log.DebugFormat("Window:{0} State{1}",w.Name,state);
            });

            yield return(transition.WaitForDone());
        }
Beispiel #12
0
 protected void OpenLoginWindow()
 {
     try
     {
         this.command.Enabled = false;
         LoginWindow loginWindow = viewLocator.LoadWindow <LoginWindow>(this.WindowManager, "UI/Logins/Login");
         loginWindow.OnLoginFinished += OnLoginFinished;
         loginWindow.Create();
         loginWindow.Show();
     }
     catch (Exception e)
     {
         if (log.IsWarnEnabled)
         {
             log.Warn(e.StackTrace);
         }
     }
 }
Beispiel #13
0
        IEnumerator Start()
        {
            /* Create a window container */
            //创建一个窗口容器,默认会在全局窗口管理器中创建
            WindowContainer winContainer = WindowContainer.Create("MAIN");

            yield return(null);

            IUIViewLocator locator = context.GetService <IUIViewLocator>();
            StartupWindow  window  = locator.LoadWindow <StartupWindow>(winContainer, "UI/Startup/Startup");

            window.Create();
            //返回一个transition对象,窗口显示一般会有窗口动画,所以是一个持续过程的操作
            ITransition transition = window.Show().OnStateChanged((w, state) =>
            {
                //log.DebugFormat("Window:{0} State{1}",w.Name,state);
            });

            yield return(transition.WaitForDone());
        }
Beispiel #14
0
    protected void OnOpenCardBagWindow(object sender, InteractionEventArgs args)
    {
        try
        {
            IUIViewLocator viewLocator   = Context.GetApplicationContext().GetService <IUIViewLocator>();
            CardBagWindow  cardBagWindow = viewLocator.LoadWindow <CardBagWindow>(this.WindowManager, "UI/CardBag");
            var            cardBagModel  = args.Context;


            cardBagWindow.SetDataContext(cardBagModel);
            cardBagWindow.Create();
            cardBagWindow.Show();
        }
        catch (Exception e)
        {
            if (log.IsWarnEnabled)
            {
                log.Warn(e);
            }
        }
    }
Beispiel #15
0
    protected void OnOpenIdleWindow(object sender, InteractionEventArgs args)
    {
        IUIViewLocator viewLocator = Context.GetApplicationContext().GetService <IUIViewLocator>();

        //WheelWindow wheelWindow = viewLocator.LoadWindow<WheelWindow>(this.WindowManager, "UI/Wheel");
        //var wheelViewModel = args.Context;
        //wheelWindow.SetDataContext(wheelViewModel);
        //wheelWindow.Create();
        //wheelWindow.Show();

        //CardDrawWindow cardDrawWindow = viewLocator.LoadWindow<CardDrawWindow>(this.WindowManager, "UI/CardDraw");
        //var cardDrawModel = args.Context;
        //cardDrawWindow.SetDataContext(cardDrawModel);
        //cardDrawWindow.Create();
        //cardDrawWindow.Show();

        IdleWindow idleWindow = viewLocator.LoadWindow <IdleWindow>(this.WindowManager, "UI/Idle");

        idleWindow.Create();
        idleWindow.Show();
    }
Beispiel #16
0
    public void OnOpenPopupSelectLanguage(object sender, InteractionEventArgs args)
    {
        SelectLanguageView selectLanguageView = viewLocator.LoadWindow <SelectLanguageView>(this.WindowManager, "UI/popup_language");
        var callback = args.Callback;

        if (callback != null)
        {
            EventHandler handler = null;
            handler = (window, e) =>
            {
                selectLanguageView.OnDismissed -= handler;
                if (callback != null)
                {
                    callback();
                }
            };
            selectLanguageView.OnDismissed += handler;
        }

        selectLanguageView.Create();
        selectLanguageView.Show();
    }