예제 #1
0
    /// <summary>
    /// Reset the current main-scene. All sub-scenes or popups which are showing will be deactive.
    /// </summary>
    /// <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 Reset(object data = null, SSCallBackDelegate onActive = null, SSCallBackDelegate onDeactive = null)
    {
        string sn = StackBottom();

        if (!string.IsNullOrEmpty(sn))
        {
            if (m_IsBusy)
            {
                Enqueue(sn, data, onActive, onDeactive, SceneType.RESET);
                return;
            }

            m_IsBusy = true;

            // Remove from stack and deactive
            while (m_Stack.Count > 0)
            {
                string p = m_Stack.Pop();

                bool      isScreen = (m_Stack.Count == 0);
                ForceType force    = (isScreen) ? ForceType.FORCE_DESTROY : ForceType.NO_FORCE;

                CloseScene(p, true, force);
                ShieldOff();
            }

            // Remove all sub
            CloseAllSubScene();

            IEScreen(sn, data, onActive, onDeactive);
        }
    }
예제 #2
0
    /// <summary>
    /// Load or active a sub-scene. The current sub-scenes which are showing will be deactive.
    /// </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 SubScreen(string sceneName, object data = null, SSCallBackDelegate onActive = null, SSCallBackDelegate onDeactive = null)
    {
        string sn = sceneName;

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

        if (IsExistSub(sn))
        {
            Dequeue();
            return;
        }

        m_IsBusy = true;

        // Raise event
        if (onSubScreenStartChange != null)
        {
            onSubScreenStartChange(sceneName);
        }

        IESubScreen(sn, data, onActive, onDeactive);
    }
예제 #3
0
    private void IEScreen(string sn, object data, SSCallBackDelegate onActive, SSCallBackDelegate onDeactive)
    {
        // Show system loading
        ShowLoadingBack();

        // Common
        IECommon(sn, 0, data, onActive, onDeactive, SceneType.SCREEN);
    }
예제 #4
0
 public SceneData(string sn, object dt, SSCallBackDelegate onActive, SSCallBackDelegate onDeactive, SceneType type)
 {
     SceneName = sn;
     Data = dt;
     Type = type;
     OnActive = onActive;
     OnDeactive = onDeactive;
 }
예제 #5
0
 public SceneData(string sn, object dt, SSCallBackDelegate onActive, SSCallBackDelegate onDeactive, SceneType type)
 {
     SceneName  = sn;
     Data       = dt;
     Type       = type;
     OnActive   = onActive;
     OnDeactive = onDeactive;
 }
예제 #6
0
    private void IEPopUp(string sn, object data, SSCallBackDelegate onActive, SSCallBackDelegate onDeactive)
    {
        // Count
        int c = m_Stack.Count;

        // Next index
        int ni = c;

        // Common
        IECommon(sn, ni, data, onActive, onDeactive, SceneType.POPUP);
    }
예제 #7
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);
    }
예제 #8
0
    /// <summary>
    /// Load a menu (only once).
    /// </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 LoadMenu(string sceneName, object data = null, SSCallBackDelegate onActive = null, SSCallBackDelegate onDeactive = null)
    {
        string sn = sceneName;

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

        if (m_Menu != null)
        {
            ShowMenu();
            Dequeue();
            return;
        }

        m_IsBusy = true;

        IEMenu(sn, data, onActive, onDeactive);
    }
예제 #9
0
    protected string m_GlobalBgm;                                                             // Global BGM
    #endregion

    #region Public Function
    /// <summary>
    /// Load or active a main-scene. All sub-scenes or popups which are showing will be deactive.
    /// </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 Screen(string sceneName, object data = null, SSCallBackDelegate onActive = null, SSCallBackDelegate onDeactive = null)
    {
        string sn = sceneName;

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

        if (IsSameScreen(sn))
        {
            Dequeue();
            return;
        }

        m_IsBusy = true;

        // Remove from stack and deactive
        while (m_Stack.Count > 0)
        {
            string p = m_Stack.Pop();

            CloseScene(p, true);

            ShieldOff();
        }

        // Remove all sub
        CloseAllSubScene();

        // Raise event
        if (onScreenStartChange != null)
        {
            onScreenStartChange(sceneName);
        }

        IEScreen(sn, data, onActive, onDeactive);
    }
예제 #10
0
    /// <summary>
    /// Load a menu (only once).
    /// </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 LoadMenu(string sceneName, object data = null, SSCallBackDelegate onActive = null, SSCallBackDelegate onDeactive = null)
    {
        string sn = sceneName;

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

        if (m_Menu != null)
        {
            ShowMenu ();
            Dequeue();
            return;
        }

        m_IsBusy = true;

        StartCoroutine(IEMenu(sn, data, onActive, onDeactive));
    }
예제 #11
0
    /// <summary>
    /// Reset the current main-scene. All sub-scenes or popups which are showing will be deactive.
    /// </summary>
    /// <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 Reset(object data = null, SSCallBackDelegate onActive = null, SSCallBackDelegate onDeactive = null)
    {
        string sn = StackBottom ();

        if (!string.IsNullOrEmpty (sn))
        {
            if (m_IsBusy)
            {
                Enqueue (sn, data, onActive, onDeactive, SceneType.RESET);
                return;
            }

            m_IsBusy = true;

            // Remove from stack and deactive
            while (m_Stack.Count > 0)
            {
                string p = m_Stack.Pop();

                bool isScreen = (m_Stack.Count == 0);
                ForceType force = (isScreen) ? ForceType.FORCE_DESTROY : ForceType.NO_FORCE;

                CloseScene (p, true, force);
                ShieldOff();
            }

            // Remove all sub
            CloseAllSubScene ();

            IEScreen(sn, data, onActive, onDeactive);
        }
    }
예제 #12
0
    /// <summary>
    /// Load or active a sub-scene. The current sub-scenes which are showing will be deactive.
    /// </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 SubScreen(string sceneName, object data = null, SSCallBackDelegate onActive = null, SSCallBackDelegate onDeactive = null)
    {
        string sn = sceneName;

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

        if (IsExistSub(sn))
        {
            Dequeue();
            return;
        }

        m_IsBusy = true;

        // Raise event
        if (onSubScreenStartChange != null)
        {
            onSubScreenStartChange (sceneName);
        }

        IESubScreen(sn, data, onActive, onDeactive);
    }
예제 #13
0
 private void IEMenu(string sn, object data, SSCallBackDelegate onActive, SSCallBackDelegate onDeactive)
 {
     // Common
     IECommon(sn, -1, 0.8f, data, onActive, onDeactive, SceneType.MENU, false);
 }
예제 #14
0
	private void OpenMenu(string sceneName, SSCallBackDelegate onActive = null, SSCallBackDelegate onDeactive = null)
	{
		string sn = sceneName;

		// Next index
		int ip = -1;
		float ic = 0.8f;

		CmOpen (sn, ip, ic, null, true, string.Empty, null, () => { m_Menu = m_DictAllScene[sn]; }, onActive, onDeactive);
	}
예제 #15
0
 private void IECommon(string sn, int i, object data, SSCallBackDelegate onActive, SSCallBackDelegate onDeactive, SceneType type, bool isInStack = true)
 {
     IECommon(sn, i, i, data, onActive, onDeactive, type, isInStack);
 }
예제 #16
0
    private IEnumerator IEScreen(string sn, object data, SSCallBackDelegate onActive, SSCallBackDelegate onDeactive)
    {
        // Show system loading
        ShowLoadingBack ();

        // Common
        yield return StartCoroutine(IECommon(sn, 0, data, onActive, onDeactive, SceneType.SCREEN));
    }
예제 #17
0
	private void OpenScreenAdd(string sceneName, object data = null, bool imme = false, SSCallBackDelegate onActive = null, SSCallBackDelegate onDeactive = null)
	{
		string sn = sceneName;

		// Check valid
		if (!CanOpenScreenAdd (sn)) 
		{
            m_IsBusy = false;
			return;
		}

		// Bot Scene
		string bot = StackScreenBottom();
		if (string.IsNullOrEmpty (bot)) 
		{
			Debug.LogWarning ("Main screen is not exist, can't add this screen above!");
			return;
		}

		// Next index
		int ip = -2 - m_CurrentStackScreen.Count;
		float ic = 0.3f + (float)m_CurrentStackScreen.Count / DEPTH_DISTANCE;

		// Prev Scene
		string preSn = m_CurrentStackScreen.Peek ();
		SSController ct = GetController (preSn);

		// Cur Bgm
		string curBgm = ct.CurrentBgm;

		// Thread 1
		CmOpen (sn, ip, ic, data, imme, curBgm, () => 
		{
			// Set IsCache of this scene same the IsCache of bottom scene of stack screen
			SSController newCt = GetController(sn);
			newCt.IsCache = true;

			// Push stack
			m_CurrentStackScreen.Push(sn);
		}, () => 
		{
			// Thread 2
			if (ct != null)
			{
                ct.OnFocus (false);
			}
			// Animation
			AnimType animType = (imme) ? AnimType.NO_ANIM : AnimType.HIDE_BACK;
			StartCoroutine (IEPlayAnimation (preSn, animType, () => 
				{
					DeactiveAScene(preSn);
				}));
		}, onActive, onDeactive);
	}
예제 #18
0
 private IEnumerator IEMenu(string sn, object data, SSCallBackDelegate onActive, SSCallBackDelegate onDeactive)
 {
     // Common
     yield return StartCoroutine(IECommon(sn, -1, 0.7f, data, onActive, onDeactive, SceneType.MENU, false));
 }
예제 #19
0
    private IEnumerator IEPopUp(string sn, object data, SSCallBackDelegate onActive, SSCallBackDelegate onDeactive)
    {
        // Count
        int c = m_Stack.Count;

        // Next index
        int ni = c;

        // Common
        yield return StartCoroutine(IECommon(sn, ni, data, onActive, onDeactive, SceneType.POPUP));
    }
예제 #20
0
    private IEnumerator IECommon(string sn, int ip, float ic, object data, SSCallBackDelegate onActive, SSCallBackDelegate onDeactive, SceneType type, bool isInStack = true)
    {
        // Wait to avoid flicker
        //yield return new WaitForEndOfFrame();

        // Defaut BGM
        string curBgm = string.Empty;

        // Active Shield
        ShieldOn(ip-1);

        // Focus lost
        if (isInStack && m_Stack.Count > 0)
        {
            string s = m_Stack.Peek();
            SSController c = m_Dict[s].GetComponentInChildren<SSController>();
            if (c != null)
            {
                curBgm = c.CurrentBgm;
                c.OnFocusLost();
            }
        }

        // Animation
        SSAnimation an = null;

        // Load or active
        if (m_Dict.ContainsKey(sn))
        {
            ActiveScene(sn);

            // Animation
            an = m_Dict[sn].GetComponentInChildren<SSAnimation>();
            if (an != null)
            {
                an.transform.localPosition = new Vector3(99999, 0, 0);
                an.transform.localScale = Vector3.one;
            }
        }
        else
        {
            yield return StartCoroutine(LoadScene(sn));
        }

        // Set Position
        SetPosition(sn, ip);

        // Set Cameras
        SetCameras(sn, ic);

        if (isInStack)
        {
            // Add to Stack
            m_Stack.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);
        }

        // Play Animation
        if (an == null) an = m_Dict[sn].GetComponentInChildren<SSAnimation>();
        if (an != null)
        {
            yield return null;
            an.transform.localPosition = Vector3.zero;
            an.PlayShow();
            yield return new WaitForSeconds(an.TimeShow() + 0.1f);
        }

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

        // Busy off
        m_IsBusy = false;

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

        // Check queue
        Dequeue();
    }
예제 #21
0
 private IEnumerator IECommon(string sn, int i, object data, SSCallBackDelegate onActive, SSCallBackDelegate onDeactive, SceneType type, bool isInStack = true)
 {
     yield return StartCoroutine(IECommon(sn, i, i, data, onActive, onDeactive, type, isInStack));
 }
예제 #22
0
 private void Enqueue(string sceneName, object data, SSCallBackDelegate onActive, SSCallBackDelegate onDeactive, SceneType type)
 {
     m_Queue.Enqueue(new SceneData(sceneName, data, onActive, onDeactive, type));
 }
예제 #23
0
    /// <summary>
    /// Load or active a main-scene. All sub-scenes or popups which are showing will be deactive.
    /// </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 Screen(string sceneName, object data = null, SSCallBackDelegate onActive = null, SSCallBackDelegate onDeactive = null)
    {
        string sn = sceneName;

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

        if (IsSameScreen(sn))
        {
            Dequeue();
            return;
        }

        m_IsBusy = true;

        // Remove from stack and deactive
        while (m_Stack.Count > 0)
        {
            string p = m_Stack.Pop();
            DeactiveScene(p);
            ShieldOff();
        }

        // Remove current sub
        if (m_Sub != null)
        {
            DeactiveScene(m_Sub.name);
            m_Sub = null;
        }

        StartCoroutine(IEScreen(sn, data, onActive, onDeactive));
    }
예제 #24
0
 private IEnumerator IESubScreen(string sn, object data, SSCallBackDelegate onActive, SSCallBackDelegate onDeactive)
 {
     // Common
     yield return StartCoroutine(IECommon(sn, -2, 0.4f, data, onActive, onDeactive, SceneType.SUB_SCREEN, false));
 }
예제 #25
0
	private void OpenScreen(string sceneName, object data = null, SSCallBackDelegate onActive = null, SSCallBackDelegate onDeactive = null)
	{
		string sn = sceneName;

		// Check valid
		if (!CanOpenScreen (sn)) 
		{
            m_IsBusy = false;
			return;
		}

		// Prev stack screen
		Stack<string> prevStack = m_CurrentStackScreen;

		// Set screen stack to current
		string top = StackScreen (sn);

		// onScreenStartChange
		if (onScreenStartChange != null) 
		{
			onScreenStartChange (sn);
		}

        // Hide All
        if (m_ClearOnLoad)
        {
            HideAll(prevStack);
        }

		if (sn == top) // First time load
		{
            // Clear
            Clear(() =>
            {
                CmOpen (sn, 0, 0, data, true, string.Empty, () => 
                {
                    if (!m_ClearOnLoad)
                    {
                        HideAll(prevStack);
                    }
                }, null, onActive, onDeactive);
            });
		} 
		else // Not first time
		{
            // Clear
            Clear(() => 
            {
                if (!m_ClearOnLoad)
                {
                    HideAll(prevStack);
                }

                // Just active scene
                ActiveAScene (top);

                // Show and Bgm
                SSController ct = GetController (top);
                if (ct != null) 
                {
                    //Debug.Log(ct.CurrentBgm);
                    ShowAndBgmChangeOpen (top, ct.CurrentBgm);
                }

                m_IsBusy = false;
            });
		}
	}
예제 #26
0
	private IEnumerator IEAddScreen (string sceneName, object data = null, SSCallBackDelegate onActive = null, SSCallBackDelegate onDeactive = null)
	{
		yield return StartCoroutine (IEWaitForNotBusy ());
		OpenScreenAdd (sceneName, data, false, onActive, onDeactive);
	}
예제 #27
0
 public virtual void Reset (object data = null, SSCallBackDelegate onActive = null, SSCallBackDelegate onDeactive = null)
 {
     CloseAllPopUp();
     string sn = DestroyCurrentStack();
     Screen(sn, data, onActive, onDeactive);
 }
예제 #28
0
	private IEnumerator IEPopUp (string sceneName, object data = null, SSCallBackDelegate onActive = null, SSCallBackDelegate onDeactive = null)
	{
		yield return StartCoroutine (IEWaitForNotBusy ());

        if (IsSceneActive(sceneName))
        {
            m_CanClose = true;
        }

        while (IsSceneActive (sceneName)) 
		{
			yield return new WaitForEndOfFrame ();
		}
		m_IsBusy = true;

		OpenPopUp (sceneName, data, false, onActive, onDeactive);
	}
예제 #29
0
	public virtual void LoadMenu (string sceneName, object data = null, SSCallBackDelegate onActive = null, SSCallBackDelegate onDeactive = null)
	{
		StartCoroutine( IELoadMenu (sceneName, data, onActive, onDeactive) );
	}
예제 #30
0
	private IEnumerator IELoadMenu (string sceneName, object data = null, SSCallBackDelegate onActive = null, SSCallBackDelegate onDeactive = null)
	{
        yield return new WaitForEndOfFrame();
		OpenMenu (sceneName, onActive, onDeactive);
	}
예제 #31
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();
            }));
        });
    }
예제 #32
0
 private void Enqueue(string sceneName, object data, SSCallBackDelegate onActive, SSCallBackDelegate onDeactive, SceneType type)
 {
     m_Queue.Enqueue(new SceneData(sceneName, data, onActive, onDeactive, type));
 }
예제 #33
0
    /// <summary>
    /// Load or active a main-scene. All sub-scenes or popups which are showing will be deactive.
    /// </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 Screen(string sceneName, object data = null, SSCallBackDelegate onActive = null, SSCallBackDelegate onDeactive = null)
    {
        string sn = sceneName;

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

        if (IsSameScreen(sn))
        {
            Dequeue();
            return;
        }

        m_IsBusy = true;

        // Remove from stack and deactive
        while (m_Stack.Count > 0)
        {
            string p = m_Stack.Pop();

            CloseScene (p, true);

            ShieldOff();
        }

        // Remove all sub
        CloseAllSubScene ();

        // Raise event
        if (onScreenStartChange != null)
        {
            onScreenStartChange (sceneName);
        }

        IEScreen(sn, data, onActive, onDeactive);
    }
예제 #34
0
 public void ResetScreen(string sceneName, object data = null, SSCallBackDelegate onActive = null, SSCallBackDelegate onDeactive = null)
 {
     Reset(data, onActive, onDeactive);
 }
예제 #35
0
 private void IESubScreen(string sn, object data, SSCallBackDelegate onActive, SSCallBackDelegate onDeactive)
 {
     // Common
     IECommonSub(sn, -2 - m_StackSub.Count, 0.3f + (float)m_StackSub.Count / DEPTH_DISTANCE, data, onActive, onDeactive, SceneType.SUB_SCREEN, true);
 }
예제 #36
0
    /// <summary>
    /// Load or active a sub-scene. The current sub-scenes which are showing will be deactive.
    /// </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 SubScreen(string sceneName, object data = null, SSCallBackDelegate onActive = null, SSCallBackDelegate onDeactive = null)
    {
        string sn = sceneName;

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

        if (m_Sub != null && string.Compare(sn, m_Sub.name) == 0)
        {
            Dequeue();
            return;
        }

        // Remove current sub
        CloseSubScene ();

        m_IsBusy = true;

        StartCoroutine(IESubScreen(sn, data, onActive, onDeactive));
    }
예제 #37
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);
    }
예제 #38
0
	private void CmOpen(string sceneName, int ip, float ic, object data, bool imme, string curBgm, NoParamCallback onAnimEnded = null, NoParamCallback onLoaded = null, SSCallBackDelegate onActive = null, SSCallBackDelegate onDeactive = null)
	{
		string sn = sceneName;

		// Show Empty shield
		ShowEmptyShield ();

		LoadOrActive (sn, () => 
			{
				if (onLoaded != null)
				{
					onLoaded();
				}

				// Set camera and position
				SetCameras(sn, ic);
                SetCanvases(sn, ic);
				SetPosition(sn, ip);

				// On Set
				SSController ct = GetController(sn);
				if (ct != null)
				{
					ct.OnSet(data);
				}

				// Animation
				AnimType animType = (imme) ? AnimType.NO_ANIM : AnimType.SHOW;
				StartCoroutine (IEPlayAnimation (sn, animType, () => 
					{
						// Show & BGM change
						ShowAndBgmChangeOpen (sn, curBgm);

						// Hide empty shield
						HideEmptyShield();

						// Call back
						if (onAnimEnded != null) onAnimEnded();

						// No busy
						m_IsBusy = false;
					}));
			}, onActive, onDeactive);
	}
예제 #39
0
 public void ResetScreen(string sceneName, object data = null, SSCallBackDelegate onActive = null, SSCallBackDelegate onDeactive = null)
 {
     Reset (data, onActive, onDeactive);
 }
예제 #40
0
	private void OpenPopUp(string sceneName, object data = null, bool imme = false, SSCallBackDelegate onActive = null, SSCallBackDelegate onDeactive = null)
	{
		string sn = sceneName;

		// Check valid
		if (!CanOpenPopUp (sn)) 
		{
            m_IsBusy = false;
			return;
		}

		// Count
		int c = m_StackPopUp.Count + 1;

		// Next index
		int ip = c;
		float ic = c;

		// Prev Scene
		SSController ct = null;
		string curBgm = null;

		// Highest popup
		if (m_StackPopUp.Count >= 1)
		{
			string preSn = m_StackPopUp.Peek();

			ct = GetController(preSn);
		}
		// Or highest screen
		else if (m_CurrentStackScreen != null && m_CurrentStackScreen.Count >= 1)
		{
			string preSn = m_CurrentStackScreen.Peek();

			ct = GetController(preSn);
		}

		if (ct != null)
		{
			// Cur Bgm
			curBgm = ct.CurrentBgm;

			// Shield
			ShieldOn(m_StackPopUp.Count);
		}
		else
		{
			ShieldOn(0);
		}

		// Push stack
		m_StackPopUp.Push(sn);

		CmOpen (sn, ip, ic, data, imme, curBgm, () => 
			{
				// On Hide
				if (ct != null)
				{
                    ct.OnFocus (false);
				}
			}, null, onActive, onDeactive);
	}
예제 #41
0
	private void SetActiveDeactiveCallback(string sceneName, SSCallBackDelegate onActive = null, SSCallBackDelegate onDeactive = null)
	{
		SSController ct = GetController (sceneName);

		if (ct != null) 
		{
			ct.OnActive = onActive;
			ct.OnDeactive = onDeactive;
		}
	}
예제 #42
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 (IsPopUpShowed(sn))
        {
            return;
        }

        m_IsBusy = true;

        StartCoroutine(IEPopUp(sn, data, onActive, onDeactive));
    }
예제 #43
0
	private void LoadOrActive(string sceneName, NoParamCallback onLoaded, SSCallBackDelegate onActive = null, SSCallBackDelegate onDeactive = null)
	{
		string sn = sceneName;

		if (m_DictAllScene.ContainsKey(sn))
		{
			// Callback
			SetActiveDeactiveCallback (sn, onActive, onDeactive);

			// Active
			ActiveAScene (sn);

			// Event
			onLoaded ();
		}
		else
		{
            SSApplication.LoadLevel (sn, m_IsLoadAsync, m_IsAllAdditive || !m_NotAdditiveSceneList.Contains(sn), (GameObject root) =>
				{
					GameObject scene = root;

                    // Bring to very far
                    BringAnimationToVeryFar(scene);

					// Add to dictionary
					m_DictAllScene.Add(sn, scene);

                    // Set parent
                    scene.transform.parent = m_Scenes.transform;

					// Callback
					SetActiveDeactiveCallback (sn, onActive, onDeactive);

					// Active
					ActiveAScene (sn);

					// Event
					OnSceneLoad (scene);
					onLoaded ();
				});
		}
	}
예제 #44
0
 private void IESubScreen(string sn, object data, SSCallBackDelegate onActive, SSCallBackDelegate onDeactive)
 {
     // Common
     IECommonSub(sn, -2 - m_StackSub.Count, 0.3f + (float)m_StackSub.Count / DEPTH_DISTANCE, data, onActive, onDeactive, SceneType.SUB_SCREEN, true);
 }