コード例 #1
0
    //#--------------------------------------------------------------------------
    // private member function
    //#--------------------------------------------------------------------------

    void AddPlayerCmd(string cmd, int idx)
    {
        // 맨처음 노드는 cmd용 original 탬플릿이다.
        jxE  eCmdGroup;
        bool isReloadGui = false;

        if (idx >= m_scroll_CmdList.m_jxE.size())
        {
            eCmdGroup = m_scroll_CmdList.m_jxE.begin().MakeClone();
            m_scroll_CmdList.m_jxE.InsertChild(eCmdGroup);
            isReloadGui = true;
        }
        else
        {
            eCmdGroup = m_scroll_CmdList.m_jxE.GetChild(idx);
        }

        eCmdGroup.AttrVar("Enable").Set_bool(true);
        jxA a;
        jxE eCmdText = eCmdGroup.FindByAttr("Name", "CmdRun", out a);

        a = eCmdText.AttrVar("Text");
        a.Set_string(cmd);

        if (isReloadGui)
        {
            // jGuiContorl 리로딩.
            jGuiControl ctrl = m_scroll_CmdList.GetStage().CreateRTTI(eCmdGroup);
            jDebug.jASSERT(ctrl != null);
            ctrl.m_isLayouted = m_scroll_CmdList.m_isLayouted;
            ctrl.Load(m_scroll_CmdList.GetStage()
                      , m_scroll_CmdList.GetWindow()
                      , m_scroll_CmdList
                      , eCmdGroup
                      , m_scroll_CmdList.Get_OverrideAttribute());
        }
        else
        {
            jGuiButton btn = (jGuiButton)eCmdText.m_UserData;
            btn.SetText(cmd);
        }
    }
コード例 #2
0
    void OnShowModal_ServerList(jGuiWindow win)     // "ServerList"라는 모달
    {
        jxE eServerList = m_CMD.GetCurrServerList();

        if (eServerList == null)
        {
            m_CMD.LogWarning(m_CMD.m_DefaultServerListName + " is not found in ServerList xml");
            return;
        }

        int iSize = eServerList.size() - m_guiServerList.m_jxE.size();

        if (iSize > 0)        // 다운로드 받은 서버리스트 보다 gui xml의 서버리스트 컨트롤이 적다면 컨트롤 추가.
        {
            for (int i = 0; i < iSize; ++i)
            {
                jxE eServer = m_guiServerList.m_jxE.begin().MakeClone();
                m_guiServerList.m_jxE.InsertChild(eServer);

                // jGuiContorl 리로딩.
                jGuiControl new_ctrl = m_guiServerList.GetStage().CreateRTTI(eServer);
                if (new_ctrl == null)
                {
                    eServer.DebugPrint();
                    throw new System.Exception("CreateRTTI : new_ctrl==null");
                }
                new_ctrl.m_isLayouted = m_guiServerList.m_isLayouted;
                new_ctrl.Load(m_guiServerList.GetStage()
                              , m_guiServerList.GetWindow()
                              , m_guiServerList
                              , eServer
                              , m_guiServerList.Get_OverrideAttribute());
            }
        }
        int idx = 0;

        foreach (jGuiControl gui in m_guiServerList)
        {
            if (idx >= eServerList.size())
            {
                gui.SetEnabled(false);
                continue;
            }
            var    btn    = (jGuiButton)gui.FindCtrl("ServerOk");
            jxE    server = eServerList.GetChild(idx);
            string name   = server.Attr("NAME");
            string text   = name + " " + server.Attr("IP") + ":" + server.AttrVar("PORT").Get_int().ToString();
            var    lbl    = (jGuiLabel)gui.FindCtrl("ServerStatus");
            if (name == m_CMD.m_ServerName)
            {
                lbl.SetText("Selected");
            }
            else
            {
                lbl.SetText("Unkown");
            }

            btn.SetText(text);
            ++idx;
        }
        UpdateServerStatus();
    }