Beispiel #1
0
    void StartUIServerCtrl()
    {
        mServerCtrl.mList.mItems.Clear();
        foreach (MyServer ms in LoadServer.ServerList)
        {
            ConnectedServer cServer = P2PManager.GetServer(ms.gameName, ms.gameMode);
            if (cServer != null)
            {
                mServerCtrl.mList.AddItem(ms.ToServerDataItem(), Color.green);
            }
            else
            {
                mServerCtrl.mList.AddItem(ms.ToServerDataItem());
            }
        }

        mServerCtrl.mList.UpdateList();
    }
Beispiel #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);
    }