Exemple #1
0
        public virtual void Init(string roomID, Vec2 mapSize, string mapID, string usr1, string usr2, UserInfo usrInfo1, UserInfo usrInfo2)
        {
            ID = roomID;

            var num = 3;

            UsrsID    = new string[num];
            UsrsID[0] = null; // 0 表示中立单位
            UsrsID[1] = usr1;
            UsrsID[2] = usr2;

            UsrsInfo    = new UserInfo[num];
            UsrsInfo[0] = new UserInfo();
            UsrsInfo[1] = usrInfo1;
            UsrsInfo[2] = usrInfo2;

            Players    = new PlayerInfoInRoom[num];
            Players[0] = null;
            Players[1] = new PlayerInfoInRoom();
            Players[2] = new PlayerInfoInRoom();

            Lv = LevelCreator.GetLevel(mapID);

            BuffRunner      = new BuffRunner();
            BuffRunner.Room = this;

            TBRunner      = new TreasureBoxRunner();
            TBRunner.Room = this;

            Map        = new Map(mapSize, FrameInterval / 1000.0f);
            Map.Room   = this;
            frameSeqNo = 0;

            smm.Clear();
        }
Exemple #2
0
        // 设置资源数量
        void SetResource(int p, string resourceType, Fix64 num)
        {
            PlayerInfoInRoom pi = Players[p];

            pi.Resources[resourceType] = num;
        }
Exemple #3
0
        // 获取指定资源数量
        public Fix64 GetResource(int p, string resourceType)
        {
            PlayerInfoInRoom pi = p == 1 ? Players[1] : Players[2];

            return(pi.Resources.ContainsKey(resourceType) ? pi.Resources[resourceType] : 0);
        }