void LateUpdate()
 {
     if (CanExeLuaLateUpdate)
     {
         LuaHelper.CallFunctionWithSelf(m_LuaTable, m_LuaName + ":LateUpdate");
     }
 }
 void OnDestroy()
 {
     if (CanExeLuaMono && m_LuaTable.Exist("OnDestroy") && m_LuaTable["OnDestroy"].GetType() == typeof(LuaFunction))
     {
         LuaHelper.CallFunctionWithSelf(m_LuaTable, m_LuaName + ":OnDestroy");
     }
 }
 void OnDisable()
 {
     if (CanExeLuaDisable)
     {
         LuaHelper.CallFunctionWithSelf(m_LuaTable, m_LuaName + ":OnDisable");
     }
 }
 void Start()
 {
     if (CanExeLuaMono && m_LuaTable.Exist("Start") && m_LuaTable["Start"].GetType() == typeof(LuaFunction))
     {
         LuaHelper.CallFunctionWithSelf(m_LuaTable, m_LuaName + ":Start");
     }
 }
 void OnClick()
 {
     if (CanExeLuaClick)
     {
         LuaHelper.CallFunctionWithSelf(m_LuaTable, m_LuaName + ":OnClick");
     }
 }
Esempio n. 6
0
    void OnGUI()
    {
        if (GUILayout.Button("Show pop 1"))
        {
            UIManager.GetInstance().OpenUI("LuaTest1", (table) => { LuaHelper.CallFunctionWithSelf(table, "LuaTestView:Init"); },
                                           (table) => { LuaHelper.CallFunctionWithSelf(table, "LuaTestView:Refresh"); });
        }

        if (GUILayout.Button("Show pop 2"))
        {
            UIManager.GetInstance().OpenUI("LuaTest2", (table) => { LuaHelper.CallFunctionWithSelf(table, "LuaTestView:Init"); },
                                           (table) => { LuaHelper.CallFunctionWithSelf(table, "LuaTestView:Refresh"); });
        }

        if (GUILayout.Button("Show pop 3"))
        {
            UIManager.GetInstance().OpenUI("LuaTest3", (table) => { LuaHelper.CallFunctionWithSelf(table, "LuaTestView:Init"); },
                                           (table) => { LuaHelper.CallFunctionWithSelf(table, "LuaTestView:Refresh"); });
        }

        if (GUILayout.Button("Show pop 4"))
        {
            UIManager.GetInstance().OpenUI("LuaTest4", (table) => { LuaHelper.CallFunctionWithSelf(table, "LuaTestView:Init"); },
                                           (table) => { LuaHelper.CallFunctionWithSelf(table, "LuaTestView:Refresh"); });
        }

        if (GUILayout.Button("Show message"))
        {
            UIManager.GetInstance().ShowMessageBox("This is a message: " + Time.realtimeSinceStartup, () => { LogModule.DebugLog("Who clicked OK?"); },
                                                   () => { LogModule.DebugLog("I clicked cancel."); });
        }
    }
    public override void OnEntered(object param)
    {
        UIManager.GetInstance().CloseUI("MainUI");
        Main.Instance.RmvMainComponent <TempEntrance>();

        ProxyManager.GetInstance().Add(new MapProxy());
        GameFacade.AddMediator(new MapMediator(), MapView.Current.gameObject);
        Game.StartCoroutine(MapView.Current.Init());

        ProxyManager.GetInstance().Add(new WorldProxy());

        var worldView = UnityEngine.Object.FindObjectOfType <WorldView>();

        worldView.OnInit();

        UIManager.GetInstance().OpenUI("World", (view) =>
        {
            WorldController.GetInstance().m_WorldUIView = view;
            LuaHelper.CallFunctionWithSelf(view, "WorldView.Init");

            WorldController.GetInstance().m_WorldModel = ProxyManager.GetInstance().Get <WorldProxy>();
            WorldController.GetInstance().m_MapModel   = ProxyManager.GetInstance().Get <MapProxy>();
            WorldController.GetInstance().m_WorldView  = worldView;
            WorldController.GetInstance().OnInit();

            ProxyManager.GetInstance().Get <WorldProxy>().InitMarchData();
            //ProxyManager.GetInstance().Get<WorldProxy>().InitCityData();
        },
                                       (view =>
        {
            WorldController.GetInstance().RefreshUI();
        }));
    }
 void OnGUI()
 {
     if (CanExeLuaGUI)
     {
         LuaHelper.CallFunctionWithSelf(m_LuaTable, m_LuaName + ":OnGUI");
     }
 }
Esempio n. 9
0
 public void ShowMainUI()
 {
     UIManager.GetInstance().OpenUI("MainUI", view =>
     {
         LuaHelper.CallFunctionWithSelf(view, "MainUIView.Init");
     }, null, false);
     UIManager.GetInstance().OpenUI("MainResource", null, null, false);
 }
Esempio n. 10
0
    public void OnLoadingDone()
    {
        Destroy(gameObject);

        ProxyManager.GetInstance().Add(new LoginProxy());
        UIManager.GetInstance().OpenUI("Login", (view) =>
        {
            LuaHelper.CallFunctionWithSelf(view, "LoginView.Init");
        });
    }
 public override void OnEntered(object param)
 {
     UIManager.GetInstance().OpenUI("MainUI", view =>
     {
         LuaHelper.CallFunctionWithSelf(view, "MainUIView.Init");
     }, view =>
     {
         LuaHelper.CallFunctionWithSelf(view, "MainUIView.ShowCastleButton");
     }, false);
     UIManager.GetInstance().OpenUI("MainResource", null, null, false);
 }
    public void SetMarchUI()
    {
        RefreshUI();

        for (int i = 0; i < m_WorldModel.MyOutMarchList.Count; i++)
        {
            if (i < m_WorldModel.MyOutMarchList.Count)
            {
                LuaHelper.CallFunctionWithSelf(m_WorldUIView, "WorldView.SetMarchObject", i, m_WorldModel.MyOutMarchList[i].State,
                                               m_WorldModel.MyOutMarchList[i].Time);
            }
        }
    }
    /// <summary>
    /// Will not change data stored in view frame.
    /// </summary>
    public void RefreshUI()
    {
        for (int i = 0; i < WorldProxy.MarchListNum; i++)
        {
            if (i < m_WorldModel.MyOutMarchList.Count)
            {
                LuaHelper.CallFunctionWithSelf(m_WorldUIView, "WorldView.ShowMarchObject", i);
            }
            else
            {
                LuaHelper.CallFunctionWithSelf(m_WorldUIView, "WorldView.HideMarchObject", i);
            }
        }

        LuaHelper.CallFunctionWithSelf(m_WorldUIView, "WorldView.HideAllButtons");
        switch (m_WorldModel.m_SelectedMyItem.m_SelectedState)
        {
        case WorldProxy.SelectedMyItem.SelectedState.MyMarch:
        {
            switch (m_WorldModel.m_SelectedOtherItem.m_SelectedState)
            {
            case WorldProxy.SelectedOtherItem.SelectedState.Block:
            {
                LuaHelper.CallFunctionWithSelf(m_WorldUIView, "WorldView.ShowMoveButton");
                break;
            }

            case WorldProxy.SelectedOtherItem.SelectedState.OtherMarch:
            {
                LuaHelper.CallFunctionWithSelf(m_WorldUIView, "WorldView.ShowAttackButton");
                break;
            }
            }

            break;
        }

        case WorldProxy.SelectedMyItem.SelectedState.MyCity:
        {
            LuaHelper.CallFunctionWithSelf(m_WorldUIView, "WorldView.ShowGoOutButton");
            break;
        }
        }

        if (m_WorldModel.m_SelectedOtherItem.m_SelectedState != WorldProxy.SelectedOtherItem.SelectedState.Null)
        {
            LuaHelper.CallFunctionWithSelf(m_WorldUIView, "WorldView.ShowInfoButton");
            LuaHelper.CallFunctionWithSelf(m_WorldUIView, "WorldView.ShowFocusButton");
        }
    }
    public void ShowMessageBox(string msgText, EventDelegate.Callback okCallBack = null, EventDelegate.Callback cancelCallBack = null)
    {
        var config = m_uiItemConfigMap["MessageBox"].Clone() as UIItemConfig;

        config.Name += "_" + Time.realtimeSinceStartup;

        OpenUIInternal(config,
                       (view) =>
        {
            view["InfoStr"]        = msgText;
            view["OKCallBack"]     = okCallBack;
            view["CancelCallBack"] = cancelCallBack;
            LuaHelper.CallFunctionWithSelf(view, "MessageBoxView:Init");
        });
    }
 static int CallFunctionWithSelf(IntPtr L)
 {
     try
     {
         int      count = LuaDLL.lua_gettop(L);
         LuaTable arg0  = ToLua.CheckLuaTable(L, 1);
         string   arg1  = ToLua.CheckString(L, 2);
         object[] arg2  = ToLua.ToParamsObject(L, 3, count - 2);
         object[] o     = LuaHelper.CallFunctionWithSelf(arg0, arg1, arg2);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    void Awake()
    {
        if (!string.IsNullOrEmpty(m_LuaName))
        {
            BindLuaInternal();
        }

        CanExeLuaMono       = !string.IsNullOrEmpty(m_LuaName) && m_LuaTable != null;
        CanExeLuaUpdate     = CanExeLuaMono && m_LuaTable.Exist("Update") && m_LuaTable["Update"].GetType() == typeof(LuaFunction);
        CanExeLuaLateUpdate = CanExeLuaMono && m_LuaTable.Exist("LateUpdate") && m_LuaTable["LateUpdate"].GetType() == typeof(LuaFunction);
        CanExeLuaGUI        = CanExeLuaMono && m_LuaTable.Exist("OnGUI") && m_LuaTable["OnGUI"].GetType() == typeof(LuaFunction);
        CanExeLuaEnable     = CanExeLuaMono && m_LuaTable.Exist("OnEnable") && m_LuaTable["OnEnable"].GetType() == typeof(LuaFunction);
        CanExeLuaDisable    = CanExeLuaMono && m_LuaTable.Exist("OnDisable") && m_LuaTable["OnDisable"].GetType() == typeof(LuaFunction);
        CanExeLuaClick      = CanExeLuaMono && m_LuaTable.Exist("OnClick") && m_LuaTable["OnClick"].GetType() == typeof(LuaFunction);

        if (CanExeLuaMono && m_LuaTable.Exist("Awake") && m_LuaTable["Awake"].GetType() == typeof(LuaFunction))
        {
            LuaHelper.CallFunctionWithSelf(m_LuaTable, m_LuaName + ":Awake");
        }
    }
 public void UpdateItems(object paras)
 {
     LuaHelper.CallFunctionWithSelf(((IUIMediator)this).m_View, "LuaTestView:UpdateItems");
 }