예제 #1
0
    void SelectServerData(int index)
    {
        if (index == -1)
        {
            return;
        }

        string serverName = mServerCtrl.mList.mItems[index].mData[0];
        int    mode       = (int)MyServer.AdventureOrBuild(mServerCtrl.mList.mItems[index].mData[2]);

        MyServer ms = LoadServer.GetServer(serverName, mode);

        if (null != ms)
        {
            mServerCtrl.UpdateServerInfo(ms);
        }
    }
예제 #2
0
    void StartServer()
    {
        if (null == mServerCtrl || null == mServerCtrl.mList)
        {
            return;
        }

        if (mServerCtrl.mList.mSelectedIndex == -1)
        {
            return;
        }

        int    index      = mServerCtrl.mList.mSelectedIndex;
        string serverName = mServerCtrl.mList.mItems[index].mData[0];
        int    sceneMode  = (int)MyServer.AdventureOrBuild(mServerCtrl.mList.mItems[index].mData[2]);

        ConnectedServer cServer = P2PManager.GetServer(serverName, sceneMode);

        if (cServer != null)
        {
            Debug.Log("Server is running!");
            MessageBox_N.ShowOkBox(PELocalization.GetString(8000497));
            return;
        }

        MyServer ms = LoadServer.GetServer(serverName, sceneMode);

        if (null == ms)
        {
            return;
        }

        mServerCtrl.GetMyServerInfo(ms);

        if (ms.gameMode == (int)Pathea.PeGameMgr.ESceneMode.Custom)
        {
            Pathea.PeGameMgr.mapUID = ms.uid;
            string dataPath = Path.Combine(GameConfig.CustomDataDir, ms.mapName);
            Pathea.CustomGameData.Mgr.Instance.GetCustomData(Pathea.PeGameMgr.mapUID, dataPath);
        }

        MyServerManager.StartMyServer(ms);
    }
예제 #3
0
    void AddServer(string serverName, int sceneMode)
    {
        if (mServerCtrl != null)
        {
            MyServer ms = LoadServer.GetServer(serverName, sceneMode);
            if (null != ms)
            {
                string mode = ms.AdventureOrBuild();

                int index = mServerCtrl.mList.mItems.FindIndex(it => it.mData[0].Equals(serverName) && it.mData[2].Equals(mode));
                if (index == -1)
                {
                    mServerCtrl.mList.AddItem(ms.ToServerDataItem());
                    mServerCtrl.mList.UpdateList();
                }
            }
        }

        SetServerOn(serverName, sceneMode);
    }
예제 #4
0
    void SetServerOff(string serverName, int sceneMode)
    {
        if (mServerCtrl == null)
        {
            return;
        }

        MyServer ms = LoadServer.GetServer(serverName, sceneMode);

        if (null == ms)
        {
            return;
        }

        string mode = ms.AdventureOrBuild();

        int index = mServerCtrl.mList.mItems.FindIndex(it => it.mData[0].Equals(serverName) && it.mData[2].Equals(mode));

        if (index >= 0)
        {
            mServerCtrl.mList.SetColor(index, Color.white);
            mServerCtrl.mList.UpdateList();
        }
    }