Exemplo n.º 1
0
    private void BgmSceneClose(SSController ctrl)
    {
        if (!string.IsNullOrEmpty(m_GlobalBgm))
        {
            // Do nothing
        }
        else
        {
            switch (ctrl.BgmType)
            {
            case Bgm.NONE:
                StopBGM();
                break;

            case Bgm.PLAY:
            case Bgm.SAME:
            case Bgm.CUSTOM:
                if (!string.IsNullOrEmpty(ctrl.CurrentBgm))
                {
                    PlayBGM(ctrl.CurrentBgm);
                }
                break;
            }
        }
    }
Exemplo n.º 2
0
    private void DeactiveOrDestroy(string sn, ForceType force = ForceType.NO_FORCE)
    {
        bool isCache = true;

        GameObject   sc = m_Dict[sn];
        SSController ct = sc.GetComponentInChildren <SSController>();

        // Set Event
        if (ct != null)
        {
            if (ct.OnDeactive != null)
            {
                ct.OnDeactive(ct);
            }
        }

        sc.SetActive(false);

        if (ct != null)
        {
            isCache = ct.IsCache;
        }

        if (force != ForceType.FORCE_NO_DESTROY)
        {
            if (!isCache || force == ForceType.FORCE_DESTROY)
            {
                m_Dict.Remove(sn);
                OnSceneUnload(sc);
                Destroy(sc);
            }
        }
    }
Exemplo n.º 3
0
    private void CloseScene(string sn, bool immediate, ForceType force = ForceType.NO_FORCE, AnimType animType = AnimType.HIDE, NoParamCallback callback = null)
    {
        // Event
        SSController ct = m_Dict[sn].GetComponentInChildren <SSController>();

        if (ct != null)
        {
            ct.OnHide();
        }

        // Play Animation
        if (!immediate)
        {
            StartCoroutine(IEPlayAnimation(sn, animType, () =>
            {
                // Deactive or Destroy
                DeactiveOrDestroy(sn, force);

                if (callback != null)
                {
                    callback();
                }
            }));
        }
        else
        {
            // Deactive or Destroy
            DeactiveOrDestroy(sn, force);

            if (callback != null)
            {
                callback();
            }
        }
    }
Exemplo n.º 4
0
    private void BgmSceneOpen(string curBgm, SSController ctrl)
    {
        if (!string.IsNullOrEmpty(m_GlobalBgm))
        {
            PlayBGM(m_GlobalBgm);
        }
        else
        {
            switch (ctrl.BgmType)
            {
            case Bgm.NONE:
                StopBGM();
                break;

            case Bgm.PLAY:
                ctrl.CurrentBgm = ctrl.BgmName;
                if (!string.IsNullOrEmpty(ctrl.BgmName))
                {
                    PlayBGM(ctrl.BgmName);
                }
                break;

            case Bgm.SAME:
                ctrl.CurrentBgm = curBgm;
                break;

            case Bgm.CUSTOM:
                StopBGM();
                ctrl.CurrentBgm = ctrl.BgmName;
                break;
            }
        }
    }
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            SSController       controller = new SSController();
            MenuViewController menu       = new MenuViewController(controller);

            Application.Run();
        }
Exemplo n.º 6
0
        private void CreateTitleBar()
        {
            KlyteUtils.createUIElement(out UILabel titlebar, MainPanel.transform, "SSPanel", new Vector4(75, 10, MainPanel.width - 150, 20));
            titlebar.autoSize      = false;
            titlebar.text          = $"{SuburbStyler.instance.SimpleName} v{SuburbStyler.version}";
            titlebar.textAlignment = UIHorizontalAlignment.Center;
            KlyteUtils.createDragHandle(titlebar, SSController.GetMainReference());

            KlyteUtils.createUIElement(out UISprite logo, MainPanel.transform, "SSLogo", new Vector4(22, 5f, 32, 32));
            logo.atlas      = SSCommonTextureAtlas.instance.atlas;
            logo.spriteName = "SSIcon";
            KlyteUtils.createDragHandle(logo, SSController.GetMainReference());
        }
 public QuickOpsForm(SSController controller)
 {
     this._controller = controller;
     router           = controller.router;
     statistics       = controller.statistics;
     FormClosing     += QuickOpsForm_FormClosing;
     InitializeComponent();
     statistics.StatusChanged      += Statistics_StatusChanged;
     dataGridView1.DataSource       = statistics.Statuses;
     dataGridView1.CellDoubleClick += DataGridView1_CellDoubleClick;
     foreach (SingleRoute s in router.GetRouteTable().Routes)
     {
         richTextBox1.Text += s.ToString() + "\n";
     }
 }
Exemplo n.º 8
0
    /// <summary>
    /// Load or active a popup.
    /// </summary>
    /// <param name="sceneName">Scene name.</param>
    /// <param name="data">Data type is object type, allows any object.</param>
    /// <param name="onActive">OnActive callback.</param>
    /// <param name="onDeactive">OnDeactive callback.</param>
    public void PopUp(string sceneName, object data = null, SSCallBackDelegate onActive = null, SSCallBackDelegate onDeactive = null)
    {
        string sn = sceneName;

        if (m_IsBusy)
        {
            Enqueue(sn, data, onActive, onDeactive, SceneType.POPUP);
            return;
        }

        // If same popup
        if (IsPopUpShowed(sn))
        {
            bool isAddingData = IsAddingData(data);

            if (isAddingData)
            {
                GameObject   sc = m_Dict [sn];
                SSController ct = sc.GetComponentInChildren <SSController>();

                if (ct != null)
                {
                    ct.OnSetAdding(data);
                }

                Dequeue();
            }
            else
            {
                Enqueue(sn, data, onActive, onDeactive, SceneType.POPUP);
            }

            return;
        }

        // Check is wait no popup
        bool isWaitNoPopUp = IsWaitNoPopUp(data);

        if (isWaitNoPopUp && m_Stack.Count >= 2)
        {
            Enqueue(sn, data, onActive, onDeactive, SceneType.POPUP);
            return;
        }

        m_IsBusy = true;

        IEPopUp(sn, data, onActive, onDeactive);
    }
Exemplo n.º 9
0
    protected virtual void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape) && !m_IsBusy)
        {
            string       sn = StackTop();
            GameObject   sc = m_Dict [sn];
            SSController ct = sc.GetComponentInChildren <SSController>();

            if (ct != null)
            {
                ct.OnKeyBack();
            }
            else
            {
                Close();
            }
        }
    }
Exemplo n.º 10
0
 public MenuViewController(SSController controller)
 {
     this.controller      = controller;
     this.monitor         = controller.monitor;
     quickOpsForm         = new QuickOpsForm(controller);
     quickOpsForm.Name    = "QuickOpsForm";
     quickOpsForm.Text    = "Quick Ops Form";
     quickOpsForm.Visible = false;
     exitItem             = new MenuItem("Exit", Exit);
     runAutoRouteItem     = new MenuItem("Run AutoRoute", RunAutoConfig);
     contextMenu          = new ContextMenu(new MenuItem[] { runAutoRouteItem, exitItem });
     notifyIcon           = new NotifyIcon
     {
         Visible     = true,
         Icon        = Resources.plane,
         ContextMenu = contextMenu
     };
     notifyIcon.MouseClick += new MouseEventHandler(ShowOrHideQuickOpsForm);
 }
Exemplo n.º 11
0
    private IEnumerator IEClose(bool immediate)
    {
        // Nothing to close
        if (m_Stack.Count == 0)
        {
            m_IsBusy = false;
            yield break;
        }

        // Lowest layer: Quit
        if (m_Stack.Count == 1)
        {
            m_IsBusy = false;
            Debug.Log("Application.Quit");
            Application.Quit();
            yield break;
        }

        // Active Empty shield
        ShieldOn(m_Stack.Count - 1, new Color(0, 0, 0, 0));

        // Stack peek
        string sn = m_Stack.Peek();

        // Deactive Scene
        CloseScene(sn, immediate, ForceType.NO_FORCE, AnimType.HIDE, () =>
        {
            // Deactive Empty shield
            ShieldOff();

            // Stack pop
            sn = m_Stack.Pop();

            // Focus back
            if (m_Stack.Count > 0)
            {
                string s       = m_Stack.Peek();
                SSController c = m_Dict[s].GetComponentInChildren <SSController>();
                if (c != null)
                {
                    BgmSceneClose(c);
                    c.OnFocusBack();
                }
            }

            // Deactive Shield
            ShieldOff();

            // Busy off
            m_IsBusy = false;

            // Event
            if (m_Stack.Count > 0)
            {
                string s = m_Stack.Peek();
                if (onSceneActived != null)
                {
                    onSceneActived(s);
                }
            }

            // Check queue
            Dequeue();
        });
    }
Exemplo n.º 12
0
    private void BgmSceneOpen(string curBgm, SSController ctrl)
    {
        switch (ctrl.BgmType)
        {
            case Bgm.NONE:
                StopBGM();
                break;

            case Bgm.PLAY:
                ctrl.CurrentBgm = ctrl.BgmName;
                if (!string.IsNullOrEmpty(ctrl.BgmName) )
                {
                    PlayBGM(ctrl.BgmName);
                }
                break;

            case Bgm.SAME:
                ctrl.CurrentBgm = curBgm;
                break;
        }
    }
Exemplo n.º 13
0
	private void DestroyOrCache(GameObject sc, SSController ct)
	{
        bool isAdditive = (m_IsAllAdditive || !m_NotAdditiveSceneList.Contains(sc.name));
        bool isNoCache = (ct != null && !ct.IsCache);

        if (!isAdditive || isNoCache)
		{
            DestroyScene(sc);
		}
	}
Exemplo n.º 14
0
	protected void BgmSceneOpen(string curBgm, SSController ctrl)
	{
		if (!string.IsNullOrEmpty (m_GlobalBgm))
		{
			PlayBGM (m_GlobalBgm);
		}
		else
		{
			switch (ctrl.BgmType)
			{
				case Bgm.NONE:
					StopBGM ();
					break;

				case Bgm.PLAY:
					ctrl.CurrentBgm = ctrl.BgmName;
					if (!string.IsNullOrEmpty (ctrl.BgmName))
					{
						PlayBGM (ctrl.BgmName);
					}
					break;

                case Bgm.SAME:
                    ctrl.CurrentBgm = curBgm;
                    if (!string.IsNullOrEmpty(curBgm))
                    {
                        PlayBGM(curBgm);
                    }
					break;
				case Bgm.CUSTOM:
					StopBGM ();
					ctrl.CurrentBgm = ctrl.BgmName;
					break;
			}
		}
	}
Exemplo n.º 15
0
    private IEnumerator IECloseSub(bool immediate)
    {
        // Nothing to close
        if (m_StackSub.Count == 0)
        {
            m_IsBusy = false;
            yield break;
        }

        // Lowest layer: Quit
        if (m_StackSub.Count == 1)
        {
            m_IsBusy = false;
            Debug.Log("Application.Quit");
            Application.Quit();
            yield break;
        }

        // Current state of shield 0
        bool isShieldActived = IsShieldActive(0);

        // Active Empty shield
        ShieldOn(0, new Color(0, 0, 0, 0));

        // Stack pop
        string sn = m_StackSub.Pop();

        // Deactive Scene
        CloseScene(sn, immediate, ForceType.NO_FORCE, AnimType.HIDE, () =>
        {
            // Deactive Empty shield
            if (!isShieldActived)
            {
                ShieldOff();
            }

            // Focus back
            if (m_StackSub.Count > 0)
            {
                string s       = m_StackSub.Peek();
                SSController c = m_Dict[s].GetComponentInChildren <SSController>();
                if (c != null)
                {
                    BgmSceneClose(c);
                    c.OnFocusBack();
                }
            }

            // Busy off
            m_IsBusy = false;

            // Event
            if (m_StackSub.Count > 0)
            {
                string s = m_StackSub.Peek();
                if (onSceneActived != null)
                {
                    onSceneActived(s);
                }
            }

            // Check queue
            Dequeue();
        });

        // Top of stack
        sn = m_StackSub.Peek();

        // Active scene
        ActiveScene(sn);
        StartCoroutine(IEPlayAnimation(sn, AnimType.SHOW_BACK));
    }
Exemplo n.º 16
0
    private void BgmSceneClose(SSController ctrl)
    {
        switch (ctrl.BgmType)
        {
            case Bgm.NONE:
                StopBGM();
                break;

            case Bgm.PLAY:
            case Bgm.SAME:
                if (!string.IsNullOrEmpty(ctrl.CurrentBgm) )
                {
                    PlayBGM(ctrl.CurrentBgm);
                }
                break;
        }
    }
Exemplo n.º 17
0
    private void IECommonSub(string sn, int ip, float ic, object data, SSCallBackDelegate onActive, SSCallBackDelegate onDeactive, SceneType type, bool isInStack = true)
    {
        // Defaut BGM
        string curBgm = string.Empty;

        // Active Shield
        bool isShieldActived = IsShieldActive(0);

        // Active Empty shield
        if (!isShieldActived)
        {
            ShieldOn(0, new Color(0, 0, 0, 0));
        }

        // Load or active scene
        LoadScene(sn, () =>
        {
            // Focus lost
            if (isInStack && m_StackSub.Count > 0)
            {
                string s       = m_StackSub.Peek();
                SSController c = m_Dict[s].GetComponentInChildren <SSController>();
                if (c != null)
                {
                    curBgm = c.CurrentBgm;
                    c.OnFocusLost();
                }
            }

            // Hide Stack top
            HideSubBack();

            // Set Position
            SetPosition(sn, ip);

            // Set Cameras
            SetCameras(sn, ic);

            if (isInStack)
            {
                // Add to Stack
                m_StackSub.Push(sn);
            }

            // Set event & data
            SSController ct = m_Dict[sn].GetComponentInChildren <SSController>();
            if (ct != null)
            {
                ct.OnActive   = onActive;
                ct.OnDeactive = onDeactive;

                if (ct.OnActive != null)
                {
                    ct.OnActive(ct);
                }

                ct.OnSet(data);
            }

            // No animation if is first sub-scene of stack
            AnimType animType = (m_StackSub.Count == 1) ? AnimType.NO_ANIM : AnimType.SHOW;

            // Play if has animation
            StartCoroutine(IEPlayAnimation(sn, animType, () =>
            {
                // Deactive Empty Shield
                if (!isShieldActived)
                {
                    ShieldOff();
                }

                // Event
                if (ct != null)
                {
                    if (isInStack)
                    {
                        BgmSceneOpen(curBgm, ct);
                    }
                    ct.OnShow();
                }

                // Busy off
                m_IsBusy = false;

                // Set something by type
                SetByType(sn, type);

                // Event
                if (onSceneActived != null)
                {
                    onSceneActived(sn);
                }

                // Check queue
                Dequeue();
            }));
        });
    }
Exemplo n.º 18
0
	protected void BgmSceneClose(SSController ctrl)
	{
		if (!string.IsNullOrEmpty (m_GlobalBgm))
		{
			// Do nothing
		}
		else
		{
			switch (ctrl.BgmType)
			{
				case Bgm.NONE:
					StopBGM ();
					break;

				case Bgm.PLAY:
				case Bgm.SAME:
				case Bgm.CUSTOM:
					if (!string.IsNullOrEmpty (ctrl.CurrentBgm))
					{
						PlayBGM (ctrl.CurrentBgm);
					}
					break;
			}
		}
	}