示例#1
0
        void HandleInput(Vector3 inputScreenPos, Input.InteractionType type)
        {
            var tile = Game.Map.Province(inputScreenPos);

            if (tile == null)
            {
                return;
            }

            bool activeUser = Game.IsCurrentUserID(myData.ID);

            if (!activeUser && (type == Input.InteractionType.Path || type == Input.InteractionType.FinalizePath))
            {
                Debug.Log("No pathing when not your turn");
                return;
            }

            if (tile == Tile.SelectLock && type == Input.InteractionType.Path)
            {
                return;
            }

            if (tile == Tile.HoverTile && (type == Input.InteractionType.Inspect || type == Input.InteractionType.Path))
            {
                return;
            }

            tile.InteractWith(type);
        }
        private void HandleNewTileInspection(Tile tile, Input.InteractionType type)
        {
            if (!(type == Input.InteractionType.Select || type == Input.InteractionType.Inspect))
            {
                return;
            }

            int actives  = 0;
            int busies   = 0;
            int building = 0;
            var units    = Military.AllUnits(tile, Game.activeUserID, unitType);

            Debug.Log(string.Format("Summing up units of type {0} for player {1} ({2})", unitType, Game.activeUserID, units.Count));

            while (units.Count > 0)
            {
                var unit = units.Dequeue();
                if (unit.underConstruction)
                {
                    building += unit.count;
                }
                else if (unit.available)
                {
                    actives += unit.count;
                }
                else
                {
                    busies += unit.count;
                }
            }

            UpdateText(actives, busies, building);
        }