当前位置: 首页>>代码示例>>C#>>正文


C# Message.GetInt方法代码示例

本文整理汇总了C#中Message.GetInt方法的典型用法代码示例。如果您正苦于以下问题:C# Message.GetInt方法的具体用法?C# Message.GetInt怎么用?C# Message.GetInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Message的用法示例。


在下文中一共展示了Message.GetInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: handleGameMessage

 /**
  * Handles game-specific messages (messages which are sent only during the game)
  */
 public void handleGameMessage(Player player, Message msg)
 {
     switch (msg.Type)
     {
         case MessageTypes.TRY_USE:
             tryUseSpell(msg.GetInt(0), player);
             break;
         case MessageTypes.TICK:
             player.onTick(msg.GetDouble(0), msg.GetString(1), msg.GetString(2));
                 //update sever duplication model
             break;
         default:
             handleSpecialGameMessage(msg);
             break;
     }
 }
开发者ID:hxzpily,项目名称:arkanoid_battle,代码行数:19,代码来源:Game.cs

示例2: Connection_OnMessage

        /// <summary>
        /// Handles all incoming PlayerIO messages
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="m">The message.</param>
        static void Connection_OnMessage(object sender, Message m)
        {
            if (m.Type != "init")
                return;

            Console.WriteLine("Inited");
            globalConn.Disconnect();

            Minimap minimap = new Minimap();
            minimap.width = m.GetInt(15);
            minimap.height = m.GetInt(16);

            minimap.initialize();

            Console.WriteLine("Parsing init data...");

            uint p = 22;
            while (m[p] as string != "ws") p++;

            p++;
            // Parse world data
            while (p < m.Count) {
                uint blockId = m.GetUInt(p);
                int layer = m.GetInt(p + 1);
                byte[] xs = m.GetByteArray(p + 2),
                    ys = m.GetByteArray(p + 3);

                for (var b = 0; b < xs.Length; b += 2) {
                    int nx = (xs[b] << 8) | xs[b + 1],
                        ny = (ys[b] << 8) | ys[b + 1];

                    minimap.drawBlock(layer, nx, ny, blockId);
                }

                p += 4;

                if (m[p] as string == "we")
                    break;

                while (p + 3 < m.Count) {
                    if (m[p + 2] is byte[])
                        break;
                    p++;
                }
            }

            minimap.rewriteForegroundBlocks();
            minimap.Save(worldID + ".png");
            generating_minimap = false;
        }
开发者ID:SmallJoker,项目名称:Squirrel,代码行数:55,代码来源:Program.cs

示例3: GetAlertCode

 public static ErrorCode GetAlertCode(Message alertMsg)
 {
     return (ErrorCode) ALERT_CODES[alertMsg.GetInt(2)];
 }
开发者ID:marlonbomfim,项目名称:openfastdotnet,代码行数:4,代码来源:ErrorCode.cs

示例4: conn_OnMessage

 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void conn_OnMessage(object sender, Message e)
 {
     if (!ListenForPackets) return;
     if (OnPacket != null)
     {
         Packet packet = new Packet(e.Type);
         for (uint n = 0; n < e.Count; n++)
         {
             packet.Add(e[n]);
         }
         OnPacket(this, packet);
     }
     switch (e.Type)
     {
         case "init":
             WorldKey = Rot13(e.GetString(5));
             if (OnWorldKey != null) OnWorldKey(this, WorldKey);
             MapData = Init2Array(e);
             if (OnInit != null)
             {
                 User bot = new User(e.GetString(9), e.GetInt(6));
                 bot.Move.Position.X = (double)e.GetInt(7);
                 bot.Move.Position.Y = (double)e.GetInt(8);
                 Dictionary<int, int> potData = Init2Pot(e);
                 OnInit(this,
                     e.GetString(0),
                     e.GetString(1),
                     e.GetString(2),
                     e.GetInt(3),
                     e.GetInt(4),
                     WorldKey,
                     bot,
                     e.GetBoolean(10),
                     e.GetBoolean(11),
                     e.GetInt(12),
                     e.GetInt(13),
                     e.GetBoolean(14),
                     e.GetDouble(15),
                     e.GetBoolean(16),
                     MapData,
                     potData);
             }
             break;
         case "info":
             if (OnInfo != null) OnInfo(this, e.GetString(0), e.GetString(1));
             break;
         case "p":
             if (OnPotion != null) OnPotion(this, e.GetInt(0), e.GetInt(1), e.GetBoolean(2));
             break;
         case "write":
             if (OnWrite != null) OnWrite(this, e.GetString(0), e.GetString(1));
             break;
         case "upgrade":
             if (OnUpgrade != null) OnUpgrade(this);
             break;
         case "m":
             if (OnMove != null)
             {
                 User.Motion motion = new User.Motion();
                 motion.Position.X = e.GetDouble(1);
                 motion.Position.Y = e.GetDouble(2);
                 motion.Velocity.X = e.GetDouble(3);
                 motion.Velocity.Y = e.GetDouble(4);
                 motion.Acceleration.X = e.GetDouble(5);
                 motion.Acceleration.Y = e.GetDouble(6);
                 motion.KeyDown.X = e.GetDouble(7);
                 motion.KeyDown.Y = e.GetDouble(8);
                 OnMove(this, e.GetInt(0), motion, e.GetInt(9), e.GetBoolean(10), e.GetBoolean(11));
             }
             break;
         case "add":
             if (OnAdd != null || ListUsers)
             {
                 User u = new User(e.GetString(1), e.GetInt(0));
                 u.SmileyID = e.GetInt(2);
                 u.Move.Position.X = e.GetDouble(3);
                 u.Move.Position.Y = e.GetDouble(4);
                 u.isGod = e.GetBoolean(5);
                 u.isMod = e.GetBoolean(6);
                 u.isChat = e.GetBoolean(7);
                 u.Coins = e.GetInt(8);
                 u.isFriend = e.GetBoolean(9);
                 u.isPurple = e.GetBoolean(10);
                 u.Level = e.GetInt(11);
                 u.isClubMember = e.GetBoolean(12);
                 if (OnAdd != null) OnAdd(this, u);
                 if (ListUsers) Manager.UserJoined(u);
             }
             break;
         case "c":
             if (OnCoin != null) OnCoin(this, e.GetInt(0), e.GetInt(1));
             break;
         case "k":
             if (OnCrown != null) OnCrown(this, e.GetInt(0));
             break;
//.........这里部分代码省略.........
开发者ID:notcarksss,项目名称:ee-bot-maker,代码行数:101,代码来源:EEconn.cs

示例5: GenerateLogon

        /// <summary>
        /// FIXME don't do so much operator new here
        /// </summary>
        /// <param name="heartBtInt"></param>
        /// <returns></returns>
        protected bool GenerateLogon(Message otherLogon)
        {
            Message logon = msgFactory_.Create(this.SessionID.BeginString, Fields.MsgType.LOGON);
            logon.SetField(new Fields.EncryptMethod(0));
            if (this.SessionID.IsFIXT)
                logon.SetField(new Fields.DefaultApplVerID(this.SenderDefaultApplVerID));
            if (state_.ReceivedReset)
                logon.SetField(new Fields.ResetSeqNumFlag(true));
            logon.SetField(new Fields.HeartBtInt(otherLogon.GetInt(Tags.HeartBtInt)));
            if (this.EnableLastMsgSeqNumProcessed)
                logon.Header.SetField(new Fields.LastMsgSeqNumProcessed(otherLogon.Header.GetInt(Tags.MsgSeqNum)));

            InitializeHeader(logon);
            state_.SentLogon = SendRaw(logon, 0);
            return state_.SentLogon;
        }
开发者ID:javagg,项目名称:kingstar_csharp_sdk,代码行数:21,代码来源:Session.cs

示例6: NextResendRequest

        protected void NextResendRequest(Message resendReq)
        {
            try
            {
                int msgSeqNum = 0;
                if (!(this.IgnorePossDupResendRequests && resendReq.Header.IsSetField(Tags.PossDupFlag)))
                {
                    int begSeqNo = resendReq.GetInt(Fields.Tags.BeginSeqNo);
                    int endSeqNo = resendReq.GetInt(Fields.Tags.EndSeqNo);
                    this.Log.OnEvent("Got resend request from " + begSeqNo + " to " + endSeqNo);

                    if ((endSeqNo == 999999) || (endSeqNo == 0))
                    {
                        endSeqNo = state_.GetNextSenderMsgSeqNum() - 1;
                    }

                    if (!PersistMessages)
                    {
                        endSeqNo++;
                        int next = state_.GetNextSenderMsgSeqNum();
                        if (endSeqNo > next)
                            endSeqNo = next;
                        GenerateSequenceReset(resendReq, begSeqNo, endSeqNo);
                        return;
                    }

                    List<string> messages = new List<string>();
                    state_.Get(begSeqNo, endSeqNo, messages);
                    int current = begSeqNo;
                    int begin = 0;
                    foreach (string msgStr in messages)
                    {
                        Message msg = new Message();
                        msg.FromString(msgStr, true, this.SessionDataDictionary, this.ApplicationDataDictionary, msgFactory_);
                        msgSeqNum = msg.Header.GetInt(Tags.MsgSeqNum);

                        if ((current != msgSeqNum) && begin == 0)
                        {
                            begin = current;
                        }

                        if (IsAdminMessage(msg))
                        {
                            if (begin == 0)
                            {
                                begin = msgSeqNum;
                            }
                        }
                        else
                        {

                            initializeResendFields(msg);
                            if (begin != 0)
                            {
                                GenerateSequenceReset(resendReq, begin, msgSeqNum);
                            }
                            Send(msg.ToString());
                            begin = 0;
                        }
                        current = msgSeqNum + 1;
                    }

                    if (begin != 0)
                    {
                        GenerateSequenceReset(resendReq, begin, msgSeqNum + 1);
                    }

                    if (endSeqNo > msgSeqNum)
                    {
                        endSeqNo = endSeqNo + 1;
                        int next = state_.GetNextSenderMsgSeqNum();
                        if (endSeqNo > next)
                        {
                            endSeqNo = next;
                        }
                        GenerateSequenceReset(resendReq, begSeqNo, endSeqNo);
                    }
                }
                msgSeqNum = resendReq.Header.GetInt(Tags.MsgSeqNum);
                if (!IsTargetTooHigh(msgSeqNum) && !IsTargetTooLow(msgSeqNum))
                {
                    state_.IncrNextTargetMsgSeqNum();
                }

            }
            catch (System.Exception e)
            {
                this.Log.OnEvent("ERROR during resend request " + e.Message);
            }
        }
开发者ID:javagg,项目名称:kingstar_csharp_sdk,代码行数:90,代码来源:Session.cs

示例7: setNextWave

        public void setNextWave(Player p, Message m)
        {
            if (!mIsGameSetup || p.OnDeckWaves.Count <= 0 || Finished)
                return;

            int id = m.GetInt(0);
            Console.WriteLine("Setting next wave to: " + id);

            if (id < 0 || id > 2)
                return;

            Wave result;
            lock (p.OnDeckWaves)
            {
                result = p.OnDeckWaves.Find(delegate(Wave w)
                {
                    return w.Position == id;
                });
            }

            if (result != null)
            {
                p.WavePosition = id;
                p.Send(Messages.GAME_WAVE_POSITION, p.WavePosition);
            }
        }
开发者ID:behindcurtain3,项目名称:schismTDserver,代码行数:26,代码来源:Game.cs

示例8: spellCreep

        public void spellCreep(Player p, Message m)
        {
            if (!Started || Finished)
                return;

            if (p.Mana < p.ChiBlastCost)
                return;

            if (m.Count != 2)
                return;

            PointF position = new PointF(m.GetInt(0), m.GetInt(1));

            Cell c = findCellByPoint(position);

            if (c != null)
            {
                List<Creep> targets;
                if (c.Player == p)
                    targets = p.Opponent.Creeps;
                else
                    targets = p.Creeps;

                lock (targets)
                {
                    Boolean isMagicCreepPresent = false;
                    List<Creep> magicCreeps = targets.FindAll(delegate(Creep creep) { return creep.Type == "Magic"; });

                    foreach(Creep cr in magicCreeps)
                    {
                        if (cr.getDistance(position) <= Settings.CHI_BLAST_RANGE)
                        {
                            isMagicCreepPresent = true;
                            break;
                        }
                    }

                    //float percent =  Settings.CHI_BLAST_PERCENT + p.ChiBlastUses * 2 / 100;
                    float percent;
                    foreach (Creep cr in targets)
                    {
                        float d = cr.getDistance(position);

                        //((0.33+(0.07*numChiBlastUses))(0.5/(numWavePointValue)+0.5))
                        percent = cr.StartingLife * ((Settings.CHI_BLAST_PERCENT + (0.07f * p.ChiBlastUses)) * (0.5f / cr.Points + 0.5f));
                        /*
                        if(cr is SwarmCreep)
                            percent = (cr.StartingLife * 3) * ((Settings.CHI_BLAST_PERCENT + ((p.ChiBlastUses * 10) / 100)));// - (cr.Wave * 10 / 100));
                        else
                            percent = (cr.StartingLife / cr.Points) * ((Settings.CHI_BLAST_PERCENT + ((p.ChiBlastUses * 10) / 100)));// - (cr.Wave * 5 / 100));
                        */
                        Console.WriteLine(percent);

                        if (percent <= 0)
                            percent = 0;

                        if (d <= Settings.CHI_BLAST_RANGE)
                        {
                            // heal
                            if (cr.Player == p)
                            {
                                int life = cr.Life;

                                life += (int)percent;

                                if (life > cr.StartingLife)
                                    life = cr.StartingLife;

                                cr.Life = life;
                            }

                            // damage
                            else
                            {
                                if(isMagicCreepPresent)
                                    cr.Life -= (int)(percent - (percent * 0.5f));
                                else
                                    cr.Life -= (int)percent;

                                // Chi blast takes away any armor
                                cr.Armor = 0;
                            }
                        }
                    }
                }

                p.Mana -= (int)Math.Round(p.ChiBlastCost);
                p.ChiBlastCost *= Settings.CHI_BLAST_MOD;
                p.ChiBlastUses++;
                mCtx.Broadcast(Messages.GAME_SPELL_CREEP, position.X, position.Y);
            }
        }
开发者ID:behindcurtain3,项目名称:schismTDserver,代码行数:92,代码来源:Game.cs

示例9: placeTower

        private void placeTower(Player p, Message m)
        {
            if (Finished || !mIsGameSetup)
            {
                return;
            }

            Cell c = findCellByPoint(new Point(m.GetInt(0), m.GetInt(1)));

            if (c == null)
            {
                invalidTower(p, null, m.GetInt(0), m.GetInt(1));
                return;
            }

            // Check for correct player on the cell && that it is in a buildable area
            if (c.Tower == null && p == c.Player && c.Buildable && c.Passable)
            {

                // Make sure the player has enough mana
                if (p.Mana < Costs.BASIC)
                {
                    invalidTower(p, null, m.GetInt(0), m.GetInt(1));
                    return;
                }

                Player self = p;
                Player opponent = (p == White) ? Black : White;

                Dictionary<Creep, Cell> creepsInTheseCells = new Dictionary<Creep, Cell>();
                lock (opponent.Creeps)
                {
                    // Check to see if any creeps are on the cell
                    foreach (Creep cr in opponent.Creeps)
                    {
                        if (cr.Player == p)
                            continue;

                        Cell crIn = findCellByPoint(cr.Center);
                        creepsInTheseCells.Add(cr, crIn); // Save for later

                        // If a creep is in the cell we are trying to place a tower at don't let them
                        if (crIn == c)
                        {
                            invalidTower(p, c, m.GetInt(0), m.GetInt(1));
                            return;
                        }

                    }
                }

                // Set to non-passable
                c.Passable = false;

                // Disable all links involving this square and the diagonals that go past it
                if (c.Up != null && c.Left != null)
                {
                    lock(c.Up.Neighbors)
                        if (c.Up.Neighbors.ContainsKey(c.Left))
                            c.Up.Neighbors[c.Left] = false;
                    lock(c.Left.Neighbors)
                        if (c.Left.Neighbors.ContainsKey(c.Up))
                            c.Left.Neighbors[c.Up] = false;
                }
                if (c.Up != null && c.Right != null)
                {
                    lock (c.Up.Neighbors)
                        if (c.Up.Neighbors.ContainsKey(c.Right))
                            c.Up.Neighbors[c.Right] = false;
                    lock(c.Right.Neighbors)
                        if (c.Right.Neighbors.ContainsKey(c.Up))
                            c.Right.Neighbors[c.Up] = false;
                }
                if (c.Down != null && c.Right != null)
                {
                    lock(c.Down.Neighbors)
                        if (c.Down.Neighbors.ContainsKey(c.Right))
                            c.Down.Neighbors[c.Right] = false;
                    lock (c.Right.Neighbors)
                        if (c.Right.Neighbors.ContainsKey(c.Down))
                            c.Right.Neighbors[c.Down] = false;
                }
                if (c.Down != null && c.Left != null)
                {
                    lock (c.Down.Neighbors)
                        if (c.Down.Neighbors.ContainsKey(c.Left))
                            c.Down.Neighbors[c.Left] = false;
                    lock (c.Left.Neighbors)
                        if (c.Left.Neighbors.ContainsKey(c.Down))
                            c.Left.Neighbors[c.Down] = false;
                }

                // Now try and find a path to make sure the maze is valid
                Path newPath;
                if (p == White)
                    newPath = mBoard.getWhitePath();
                else
                    newPath = mBoard.getBlackPath();

                // If there is no valid path, reject the tower placement
//.........这里部分代码省略.........
开发者ID:behindcurtain3,项目名称:schismTDserver,代码行数:101,代码来源:Game.cs

示例10: sellTower

        /*
         * You can ALWAYS sell a tower unless it is stunned. Therefore there is no need to check things like are the paths valid,
         * just recalculate them as it is impossible to stop creeps getting to the base by selling.
         */
        public void sellTower(Player p, Message m)
        {
            if (Finished || !mIsGameSetup)
                return;

            Cell c = findCellByPoint(new Point(m.GetInt(0), m.GetInt(1)));

            if (c == null)
                return;

            if (c.Tower == null)
                return;

            if (c.Tower.hasEffect("stun"))
                return;

            // Update the players mana
            p.Mana += c.Tower.SellValue;

            // Remove the tower
            removeTower(p, c, true);
            c.Tower = null;

            // Update the board
            c.Passable = true;
            c.Buildable = true;

            // Add neighbors
            Board.setupCellNeighbors(c);

            // Recalc the paths
            List<Creep> creepsToRePath = new List<Creep>();
            List<Cell> targetBase = new List<Cell>();
            Boolean recalcCreeps = false;
            Path newPath;
            if (p == White)
            {
                newPath = mBoard.getWhitePath();

                if (newPath != Board.WhitePath)
                {
                    recalcCreeps = true;
                    creepsToRePath = Black.Creeps;
                    targetBase = Board.WhiteBase;
                    Board.WhitePath = newPath;
                }
            }
            else
            {
                newPath = mBoard.getBlackPath();

                if (newPath != Board.BlackPath)
                {
                    recalcCreeps = true;
                    creepsToRePath = White.Creeps;
                    targetBase = Board.BlackBase;
                    Board.BlackPath = newPath;
                }
            }

            if (recalcCreeps)
            {
                lock (creepsToRePath)
                {
                    foreach (Creep cr in creepsToRePath)
                    {
                        Cell crIn = findCellByPoint(cr.Center);

                        // else, check to see if we should use the updated main path
                        if (newPath.Contains(crIn))
                        {
                            lock (cr.CurrentPath)
                            {
                                // Reapply the main path, removing any cells the creeper has already passed
                                cr.CurrentPath = new Path(newPath);

                                while (cr.CurrentPath.Peek() != crIn)
                                {
                                    cr.CurrentPath.Pop();
                                }
                                // Pop off the one they are in, only if they aren't going to the last square
                                if (cr.CurrentPath.Count > 1)
                                    cr.CurrentPath.Pop();
                            }

                            cr.MovingTo = cr.CurrentPath.Peek();
                        }
                        else
                        {
                            lock (creepsThatNeedPaths)
                            {
                                if (creepsThatNeedPaths.ContainsKey(crIn.Index))
                                    creepsThatNeedPaths[crIn.Index].Add(cr);
                                else
                                {
                                    creepsThatNeedPaths.Add(crIn.Index, new List<Creep>());
//.........这里部分代码省略.........
开发者ID:behindcurtain3,项目名称:schismTDserver,代码行数:101,代码来源:Game.cs

示例11: upgradeTower

        public void upgradeTower(Player p, Message m)
        {
            if (Finished || !mIsGameSetup)
                return;

            Cell c = findCellByPoint(new Point(m.GetInt(0), m.GetInt(1)));

            if (c == null)
                return;

            if (c.Tower == null)
                return;

            if (c.Tower.hasEffect("stun"))
                return;

            int choice = m.GetInt(2);

            if (choice != 1 && choice != 2)
                return;

            switch (c.Tower.Type)
            {
                // Tier 2 towers
                case Tower.BASIC: // Upgrading from tier 1
                    if (choice == 1)
                    {
                        if (p.Mana < Costs.RAPID_FIRE)
                            return;

                        // Remove the old tower
                        removeTower(p, c);

                        p.Mana -= Costs.RAPID_FIRE;
                        lock (c.Tower)
                            c.Tower = new RapidFireTower(this, p, c.Player.Opponent, c.Position);

                        addTower(p, c);
                    }
                    else if(choice == 2)
                    {
                        if (p.Mana < Costs.SPELL)
                            return;

                        // Remove the old tower
                        removeTower(p, c);

                        p.Mana -= Costs.SPELL;
                        lock (c.Tower)
                            c.Tower = new SpellTower(this, p, c.Player.Opponent, c.Position);

                        addTower(p, c);
                    }
                    break;
                case Tower.RAPID_FIRE:
                    // Sniper
                    if (choice == 1)
                    {
                        if (p.Mana < Costs.SNIPER)
                            return;

                        removeTower(p, c);
                        p.Mana -= Costs.SNIPER;

                        lock (c.Tower)
                            c.Tower = new SniperTower(this, p, c.Player.Opponent, c.Position);

                        addTower(p, c);
                    }
                    else if (choice == 2)
                    {
                        if (p.Mana < Costs.PULSE)
                            return;

                        removeTower(p, c);
                        p.Mana -= Costs.PULSE;

                        lock (c.Tower)
                            c.Tower = new PulseTower(this, p, c.Player.Opponent, c.Position);

                        addTower(p, c);
                    }
                    break;
                case Tower.SPELL:
                    // AOE Slow
                    if (choice == 1)
                    {
                        if (p.Mana < Costs.SLOW)
                            return;

                        removeTower(p, c);
                        p.Mana -= Costs.SLOW;

                        lock (c.Tower)
                            c.Tower = new AOESlowTower(this, p, c.Player.Opponent, c.Position);

                        addTower(p, c);
                    }
                    // Damage Boost
                    else if (choice == 2)
//.........这里部分代码省略.........
开发者ID:behindcurtain3,项目名称:schismTDserver,代码行数:101,代码来源:Game.cs

示例12: Init2Pot

 /// <summary>
 /// 
 /// </summary>
 /// <param name="e"></param>
 /// <returns></returns>
 private Dictionary<int, int> Init2Pot(Message e)
 {
     Dictionary<int, int> ret = new Dictionary<int, int>();
     uint n = 17;
     while (n < e.Count)
     {
         if (e.GetString(n) == "ps")
             break;
         n++;
     }
     n++;
     while (n < e.Count)
     {
         if (e.GetString(n) == "pe")
             break;
         ret.Add(e.GetInt(n), e.GetInt(n + 1));
         n += 2;
     }
     return ret;
 }
开发者ID:notcarksss,项目名称:ee-bot-maker,代码行数:25,代码来源:EEconn.cs

示例13: Load2Array

 /// <summary>
 /// 
 /// </summary>
 /// <param name="e"></param>
 /// <returns></returns>
 private Pixel[,] Load2Array(Message e)
 {
     Pixel[,] array = MapData;
     int w = array.GetLength(0);
     int h = array.GetLength(1);
     for (int yn = 0; yn < h; yn++)
     {
         for (int xn = 0; xn < w; xn++)
         {
             array[xn, yn] = new Pixel();
         }
     }
     byte[] xarray, yarray;
     int x, y;
     int id;
     uint n = 0;
     while (n < e.Count)
     {
         if (e.GetString(n) == "ws")
             break;
         n++;
     }
     n++;
     while (n < e.Count)
     {
         if (e.GetString(n) == "we")
             break;
         id = e.GetInt(n);
         xarray = e.GetByteArray(n + 2);
         yarray = e.GetByteArray(n + 3);
         for (int i = 0; i < xarray.Length; i += 2)
         {
             x = xarray[i] << 8 | xarray[i + 1];
             y = yarray[i] << 8 | yarray[i + 1];
             if (id < 500) array[x, y].Foreground = id;
             if (id >= 500) array[x, y].Background = id;
             switch (id)
             {
                 case 43:
                 case 165:
                     array[x, y].Coins = e.GetInt(n + 4);
                     n += 5;
                     break;
                 case 77:
                 case 83:
                     array[x, y].Sound = e.GetInt(n + 4);
                     n += 5;
                     break;
                 case 242:
                     array[x, y].Rotation = e.GetInt(n + 4);
                     array[x, y].ThisID = e.GetInt(n + 5);
                     array[x, y].TargetID = e.GetInt(n + 6);
                     n += 7;
                     break;
                 default:
                     n += 4;
                     break;
             }
         }
     }
     return array;
 }
开发者ID:notcarksss,项目名称:ee-bot-maker,代码行数:67,代码来源:EEconn.cs

示例14: Move

 public void Move(Message m)
 {
     if (this.C != null)
     {
         this.C.Send(
             "m",
             m.GetDouble(1),
             m.GetDouble(2),
             m.GetDouble(3),
             m.GetDouble(4),
             m.GetDouble(5),
             m.GetDouble(6),
             m.GetDouble(7),
             m.GetDouble(8),
             m.GetInt(9),
             m.GetBoolean(10),
             m.GetBoolean(11));
     }
 }
开发者ID:Jojatekok,项目名称:Skylight,代码行数:19,代码来源:Out.cs

示例15: spellTower

        public void spellTower(Player p, Message m)
        {
            if (!Started || Finished)
                return;

            if (p.Mana < p.ChiBlastCost)
                return;

            int index = m.GetInt(0);
            Cell c;
            lock(Board.Cells)
                c = Board.Cells.Find(delegate(Cell cell) { return cell.Index == index; });

            if (c != null)
            {
                if (c.Player == p)
                    return;

                if (c.Tower != null)
                {
                    int duration = Settings.CHI_BLAST_DURATION + (int)(p.ChiBlastUses * 400);
                    c.Tower.addEffect(new StunEffect(c.Tower, duration));
                    mCtx.Broadcast(Messages.GAME_SPELL_TOWER, c.Index);

                    p.Mana -= (int)Math.Round(p.ChiBlastCost);
                    p.ChiBlastCost *= Settings.CHI_BLAST_MOD;
                    p.ChiBlastUses++;

                    // Check orthogonal squares
                    if (p.ChiBlastUses >= 10)
                    {
                        // Reduce duration
                        duration /= 2;

                        if (c.Up.Tower != null)
                        {
                            c.Up.Tower.addEffect(new StunEffect(c.Up.Tower, duration));
                            mCtx.Broadcast(Messages.GAME_SPELL_TOWER, c.Up.Index);
                        }
                        if (c.Right.Tower != null)
                        {
                            c.Right.Tower.addEffect(new StunEffect(c.Right.Tower, duration));
                            mCtx.Broadcast(Messages.GAME_SPELL_TOWER, c.Right.Index);
                        }
                        if (c.Down.Tower != null)
                        {
                            c.Down.Tower.addEffect(new StunEffect(c.Down.Tower, duration));
                            mCtx.Broadcast(Messages.GAME_SPELL_TOWER, c.Down.Index);
                        }
                        if (c.Left.Tower != null)
                        {
                            c.Left.Tower.addEffect(new StunEffect(c.Left.Tower, duration));
                            mCtx.Broadcast(Messages.GAME_SPELL_TOWER, c.Left.Index);
                        }
                    }

                    if (p.ChiBlastUses >= 20)
                    {
                        duration /= 2;

                        Cell upLeft = findCellByPoint(new PointF(c.Center.X - Settings.BOARD_CELL_WIDTH, c.Center.Y - Settings.BOARD_CELL_HEIGHT));
                        if (upLeft != null)
                        {
                            if(upLeft.Tower != null)
                            {
                                upLeft.Tower.addEffect(new StunEffect(upLeft.Tower, duration));
                                mCtx.Broadcast(Messages.GAME_SPELL_TOWER, upLeft.Index);
                            }
                        }
                        Cell upRight = findCellByPoint(new PointF(c.Center.X + Settings.BOARD_CELL_WIDTH, c.Center.Y - Settings.BOARD_CELL_HEIGHT));
                        if (upRight != null)
                        {
                            if (upRight.Tower != null)
                            {
                                upRight.Tower.addEffect(new StunEffect(upRight.Tower, duration));
                                mCtx.Broadcast(Messages.GAME_SPELL_TOWER, upRight.Index);
                            }
                        }
                        Cell downRight = findCellByPoint(new PointF(c.Center.X + Settings.BOARD_CELL_WIDTH, c.Center.Y + Settings.BOARD_CELL_HEIGHT));
                        if (downRight != null)
                        {
                            if (downRight.Tower != null)
                            {
                                downRight.Tower.addEffect(new StunEffect(downRight.Tower, duration));
                                mCtx.Broadcast(Messages.GAME_SPELL_TOWER, downRight.Index);
                            }
                        }
                        Cell downLeft = findCellByPoint(new PointF(c.Center.X - Settings.BOARD_CELL_WIDTH, c.Center.Y + Settings.BOARD_CELL_HEIGHT));
                        if (downLeft != null)
                        {
                            if (downLeft.Tower != null)
                            {
                                downLeft.Tower.addEffect(new StunEffect(downLeft.Tower, duration));
                                mCtx.Broadcast(Messages.GAME_SPELL_TOWER, downLeft.Index);
                            }
                        }
                    }

                }
            }
//.........这里部分代码省略.........
开发者ID:behindcurtain3,项目名称:schismTDserver,代码行数:101,代码来源:Game.cs


注:本文中的Message.GetInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。