コード例 #1
0
 void CastSpell(Spell spell)
 {
     if (CurSpell.Execute())
     {
         vec2 Pos = ScreenToGridCoord(Input.CurMousePos);
         Networking.ToServer(new MessageCastSpell(Spells.SpellList.IndexOf(spell), Pos));
     }
 }
コード例 #2
0
        void DrawMouseUi(bool AfterUi)
        {
            CanPlaceItem = false;

            if (!GameClass.Game.GameInputEnabled || DesyncPause || (MapEditorActive && GameClass.Game.MouseOverHud))
            {
                if (AfterUi)
                {
                    DrawArrowCursor();
                }
                return;
            }

            if (GameClass.MouseEnabled)
            {
                switch (CurUserMode)
                {
                case UserMode.PlaceBuilding:
                    if (AfterUi)
                    {
                        break;
                    }

                    DrawAvailabilityGrid();
                    DrawPotentialBuilding();
                    DrawArrowCursor();

                    break;

                case UserMode.Painting:
                    if (UnitPlaceStyle == UnitDistribution.Single)
                    {
                        if (AfterUi)
                        {
                            break;
                        }

                        UpdateCellAvailability();

                        DrawGridCell();
                        DrawArrowCursor();
                    }
                    else
                    {
                        DrawCircleCursor(AfterUi);
                    }

                    break;

                case UserMode.Select:
                    if (LineSelect)
                    {
                        DrawCircleCursor(AfterUi);
                    }
                    else
                    {
                        DrawBoxSelect(AfterUi);
                    }
                    break;

                case UserMode.CastSpell:
                    if (AfterUi)
                    {
                        break;
                    }

                    CurSpell.DrawCursor();
                    break;
                }
            }
        }