Beispiel #1
0
    public Panel PopPanel()
    {
        if (_panelStack.Count < 2)
        {
            throw new UnassignedReferenceException("_panelStack don't can Pop Panel");
        }

        panelPrev = null;

        var panel = _panelStack.Pop();

        if (panel.IsTempCopy)
        {
            LShapUtil.CallScriptFunction(panel.LogicObject, panel.LogicName, freeName);
            panelCur = _panelStack.Peek();
            LShapUtil.CallScriptFunction(panelCur.LogicObject, panelCur.LogicName, enableName);
            LShapUtil.CallScriptFunction(panelCur.LogicObject, panelCur.LogicName, placeLastSiblingName);
        }
        else
        {
            LShapUtil.CallScriptFunction(panel.LogicObject, panel.LogicName, disableName);
            panelCur = _panelStack.Pop();
            LShapUtil.CallScriptFunction(panelCur.LogicObject, panelCur.LogicName, enableName);
            LShapUtil.CallScriptFunction(panelCur.LogicObject, panelCur.LogicName, placeLastSiblingName);

            _panelStack.Push(panel);
            _panelStack.Push(panelCur);

            StickDownElement(panel);

            LShapUtil.CallScriptFunction(panel.LogicObject, panel.LogicName, placeFirstSiblingName);
        }

        return(panel);
    }
Beispiel #2
0
    public void ClearStackUnlessFocus()
    {
        List <Panel> temp = new List <Panel>(_panelStack);

        _panelStack.Clear();
        _panelStack.TrimExcess();

        var num = temp.Count;

        for (int i = num - 1; i >= 0; i--)
        {
            if (temp[i].LogicName == panelCur.LogicName)
            {
                continue;
            }
            else
            {
                LShapUtil.CallScriptFunction(temp[i].LogicObject, temp[i].LogicName, freeName);

                temp.RemoveAt(i);
            }
        }

        _panelStack = new Stack <Panel>(temp);
    }
 void LateUpdate()
 {
     if (scriptGameInstance != null)
     {
         LShapUtil.CallScriptFunction(scriptGameInstance, "GameInstance", "LateUpdate");
     }
 }
Beispiel #4
0
 public void HidePanelPrevious()
 {
     if (panelPrev != null && panelPrev.LogicObject != null)
     {
         LShapUtil.CallScriptFunction(panelPrev.LogicObject, panelPrev.LogicName, disableName);
     }
 }
Beispiel #5
0
    protected object CallMethod(string rFuncName, params object[] args)
    {
        if (lShapObject == null)
        {
            Debug.LogError("not have object invoke member function");
        }

        return(LShapUtil.CallScriptFunction(lShapObject, name, rFuncName, args));
    }
 /// <summary>
 /// 退出游戏
 /// </summary>
 void GameEnd()
 {
     LShapUtil.CallScriptFunction(scriptGameInstance, "GameInstance", "End");
     scriptGameInstance = null;
     Global.AssetLoadManager.UnloadAssetBundles();
     UIUtil.ClearUICache();
     Util.ClearMemory();
     //Caching.CleanCache();
 }
Beispiel #7
0
 public void ClearStack()
 {
     _panelStack.ForEach((item) =>
     {
         LShapUtil.CallScriptFunction(item.LogicObject, item.LogicName, freeName);
         item = null;
     });
     _panelStack.Clear();
     _panelStack.TrimExcess();
 }
 /// <summary>
 /// 隐藏弹窗
 /// </summary>
 public void HidePopups <T>(T popups, string popupsName)
 {
     if (popups == null)
     {
         DebugConsole.LogError("popups not find :" + popupsName);
         throw new NullReferenceException("Not find popups");
     }
     else
     {
         LShapUtil.CallScriptFunction(popups, popupsName, "Hide");
     }
 }
Beispiel #9
0
    public Panel PushPanel(string rLogicName, UnityEngine.Events.UnityAction <object> onEnable = null)
    {
        if (panelCur != null && panelCur.LogicName != "Noting" && panelCur.PanelName != "Noting")
        {
            if (panelCur.LogicName == rLogicName)
            {
                Debug.Log(rLogicName + " is repeat");
                return(panelCur);
            }

            if (panelCur.LogicObject != null)
            {
                LShapUtil.CallScriptFunction(panelCur.LogicObject, panelCur.LogicName, disableName);
            }
        }


        Panel rPanel = null;
        bool  rGot   = TryGetPanel(rLogicName, out rPanel);

        if (rGot)
        {
            panelCur = rPanel;

            LShapUtil.CallScriptFunction(panelCur.LogicObject, panelCur.LogicName, enableName);
            StickUpElement(panelCur);
        }
        else
        {
            var rPanelName = rLogicName.Replace("Logic", "Panel");

            Panel rNewPanel = new Panel();
            rNewPanel.IsCreated   = false;
            rNewPanel.LogicName   = rLogicName;
            rNewPanel.PanelName   = rPanelName;
            rNewPanel.LogicObject = LShapUtil.CreateScriptObject(rLogicName);
            _panelStack.Push(rNewPanel);

            panelCur = rNewPanel;
            if (onEnable != null)
            {
                LShapUtil.CallScriptFunction(panelCur.LogicObject, panelCur.LogicName, startupName, RootNode, onEnable);
            }
            else
            {
                LShapUtil.CallScriptFunction(panelCur.LogicObject, panelCur.LogicName, startupName, RootNode);
            }
        }
        return(panelCur);
    }
Beispiel #10
0
    /// <summary>
    /// 显示弹窗
    /// </summary>
    public T ShowPopups <T>(string popupsName, bool modal = true)
    {
        var popups = (T)(Template(popupsName).GetLShapObject());

        if (popups == null)
        {
            DebugConsole.LogError("popups not find :" + popupsName);
            throw new NullReferenceException("Not find popups");
        }
        else
        {
            LShapUtil.CallScriptFunction(popups, popupsName, "Show", modal);
        }
        return(popups);
    }
Beispiel #11
0
    public Panel PopPanel()
    {
        if (_panelStack.Count < 2)
        {
            throw new UnassignedReferenceException("_panelStack don't can Pop Panel");
        }

        var panel = _panelStack.Pop();

        LShapUtil.CallScriptFunction(panel.LogicObject, panel.LogicName, disableName);
        panelCur = _panelStack.Pop();
        LShapUtil.CallScriptFunction(panelCur.LogicObject, panelCur.LogicName, enableName);

        _panelStack.Push(panel);
        _panelStack.Push(panelCur);
        StickDownElement(panel);
        return(panel);
    }
Beispiel #12
0
    void Startup()
    {
        LShapClient.Instance.Initialize();

        DebugConsole.Log("[Framework initialize complete]");
        DebugConsole.Log("[Assetbundle prepare complete]");
        DebugConsole.Log("[LShape initialize complete]");
        DebugConsole.Log("[StreamingAssetsPath]:" + Application.streamingAssetsPath);
        DebugConsole.Log("[RuntimeAssetsPath] :" + AppPlatform.RuntimeAssetsPath);
        DebugConsole.Log("[AssetBundleDictionaryUrl]:" + Global.AssetLoadManager.DownloadingURL);

        //程序初始化完毕, 进入游戏
        var scriptGI = LShapUtil.CallScriptFunctionStatic("main", "GetGameInstance");

        Global.GameController.SetScriptGameInstance(scriptGI);
        LShapUtil.CallScriptFunction(scriptGI, "GameInstance", "Init");
        Destroy(gameObject);
    }
Beispiel #13
0
    public void ReplacePanel(string rLogicName)
    {
        //check safe
        if (_panelStack.Count < 1)
        {
            DebugConsole.Log("_panelStack is null, don't can replace Panel");
            return;
        }

        if (panelCur.LogicName == rLogicName)
        {
            DebugConsole.Log(rLogicName + " is repeat");
            return;
        }

        Panel panel = _panelStack.Pop();

        LShapUtil.CallScriptFunction(panel.LogicObject, panel.LogicName, freeName);
        panel    = null;
        panelCur = new Panel();

        PushPanel(rLogicName);
    }
Beispiel #14
0
 public void OnCreatedDuplicate(PopupsBehaviour duplicate)
 {
     duplicate.transform.SetParent(Global.PopupsWindow, false);
     duplicate.SetLShapObject(LShapUtil.CreateScriptObject(duplicate.TemplateName, duplicate));
 }