void Start()
    {
        main = this;

        GameManager.GameOver += CloseTownScreen;

        financeButton.onClick.AddListener(() => OpenFinancesTab());
        storageButton.onClick.AddListener(() => OpenStorageTab());
        buildingsButton.onClick.AddListener(() => { OpenBuildingsTab(); });
        workshopsButton.onClick.AddListener(() => { OpenWorkshopsTab();});
        marketButton.onClick.AddListener(() => { OpenMarketTab(); });
        mercenariesButton.onClick.AddListener(()=>{OpenMercenariesTab();});
        mapButton.onClick.AddListener(() => { ReturnToMap();});

        gameObject.SetActive(false);
    }
Exemple #2
0
 public IEnumerator<ulong> MoveCursor(TownScreen.AvatarDirection dir)
 {
     bool updated = false;
     switch (dir)
     {
         case TownScreen.AvatarDirection.UP:
             if (cursorY > 0)
             {
                 cursorY--;
                 updated = true;
             }
             break;
         case TownScreen.AvatarDirection.DOWN:
             if (cursorY < tileEngine.MapGraphics.GetLength(0) - 1)
             {
                 cursorY++;
                 updated = true;
             }
             break;
         case TownScreen.AvatarDirection.LEFT:
             if (cursorX > 0)
             {
                 cursorX--;
                 updated = true;
             }
             break;
         case TownScreen.AvatarDirection.RIGHT:
             if (cursorX < tileEngine.MapGraphics.GetLength(1) - 1)
             {
                 cursorX++;
                 updated = true;
             }
             break;
     }
     if (updated)
     {
         cursor.BoundingRectangle = tileEngine.BoundingRectangle(cursorX, cursorY);
         if (State == BattleState.CHARACTER_ATTACK)
         {
             for (int row = 0; row < tileEngine.MapGraphics.GetLength(0); row++)
             {
                 for (int col = 0; col < tileEngine.MapGraphics.GetLength(1); col++)
                 {
                     tileEngine.MapGraphics[row, col].Color = Color.White;
                 }
             }
             selectedValidMoves.Clear();
             selectedAOE.Clear();
             MapFloodFill(selectedCharacterX, selectedCharacterY, selectedAttack.Range, true, Color.Yellow, selectedValidMoves);
             if (selectedValidMoves.ContainsKey(new Point(cursorX, cursorY)))
                 MapFloodFill(cursorX, cursorY, selectedAttack.AOE, true, Color.Salmon, selectedAOE);
         }
     }
     yield break;
 }