示例#1
0
 public static ForceDesc AddForce(int id, Pathea.PeGameMgr.EGameType type)
 {
     return(AddForce(id, m_NumPerTeam, type));
 }
示例#2
0
    public static ForceDesc AddForce(int id, int maxNum, Pathea.PeGameMgr.EGameType type)
    {
        if (Pathea.PeGameMgr.IsMultiCoop)
        {
            id = 1;
        }

        if (!Instance.HasForce(id))
        {
            ForceDesc desc = new ForceDesc();
            desc.ID     = id;
            desc.Allies = new List <int>();
            desc.Allies.Add(id);
            desc.EnemyConflict       = true;
            desc.InternalConflict    = false;
            desc.JoinablePlayerCount = maxNum;
            desc.Name = id.ToString();

            switch (type)
            {
            case Pathea.PeGameMgr.EGameType.Cooperation:

                desc.AllyConflict    = true;
                desc.ItemShare       = true;
                desc.ItemUseShare    = true;
                desc.PublicInventory = true;
                desc.Color           = Color.green;
                break;

            case Pathea.PeGameMgr.EGameType.Survive:

                desc.AllyConflict    = false;
                desc.ItemShare       = false;
                desc.ItemUseShare    = false;
                desc.PublicInventory = false;
                desc.Color           = Color.red;
                break;

            case Pathea.PeGameMgr.EGameType.VS:

                desc.AllyConflict    = false;
                desc.ItemShare       = true;
                desc.ItemUseShare    = true;
                desc.PublicInventory = true;
                desc.Color           = Color.red;
                break;
            }

            Instance.AddForceDesc(desc);

            return(desc);
        }

        int index = Instance.GetForceIndex(id);

        if (-1 != index)
        {
            return(Instance.m_Forces[index]);
        }
        else
        {
            return(null);
        }
    }
    List <string> ServerDataToList(ServerRegistered mServerData)
    {
        List <string> mLsit = new List <string>();

        if (mServerData.ServerID <= -1)
        {
            mLsit.Add("[6666FF]OFFICIAL");
            mLsit.Add("[6666FF]" + mServerData.ServerName);
        }
        else
        {
            if (mServerData.UseProxy)
            {
                mLsit.Add("[99CC00]Proxy");
                mLsit.Add("[99CC00]" + mServerData.ServerName);
            }
            else
            {
                mLsit.Add(mServerData.ServerID.ToString());
                mLsit.Add(mServerData.ServerName);
            }
        }

        mLsit.Add(mServerData.ServerMasterName);
        mLsit.Add(mServerData.CurConn.ToString() + "/" + mServerData.LimitedConn.ToString());

        Pathea.PeGameMgr.EGameType type = (Pathea.PeGameMgr.EGameType)mServerData.GameType;
        string strTemp;

        switch (type)
        {
        case Pathea.PeGameMgr.EGameType.Cooperation:
            strTemp = "Cooperation";
            break;

        case Pathea.PeGameMgr.EGameType.VS:
            strTemp = "VS";
            break;

        case Pathea.PeGameMgr.EGameType.Survive:
            strTemp = "Survive";
            break;

        default:
            strTemp = "Cooperation";
            break;
        }
        mLsit.Add(strTemp);


        Pathea.PeGameMgr.ESceneMode mode = (Pathea.PeGameMgr.ESceneMode)mServerData.GameMode;
        switch (mode)
        {
        case Pathea.PeGameMgr.ESceneMode.Adventure:
            strTemp = "Adventure";
            break;

        case Pathea.PeGameMgr.ESceneMode.Build:
            strTemp = "Build";
            break;

        case Pathea.PeGameMgr.ESceneMode.Custom:
            strTemp = "Custom";
            break;

        case Pathea.PeGameMgr.ESceneMode.Story:
            strTemp = "Story";
            break;

        default:
            strTemp = "Adventure";
            break;
        }
        mLsit.Add(strTemp);

        mLsit.Add(mServerData.Ping.ToString());

        if (((EServerStatus)mServerData.ServerStatus & EServerStatus.Prepared) == EServerStatus.Prepared)
        {
            strTemp = "Waiting";
        }
        else
        {
            strTemp = "InProgress";
        }

        mLsit.Add(strTemp);
        mLsit.Add(mServerData.ServerVersion);

        return(mLsit);
    }