Example #1
0
 private void OnMouseEnter()
 {
     if (UIPopAction.Showing)
     {
         return;
     }
     UITileSelector.ShowFor(transform);
     UITileStatus.ShowFor(tile);
     UIPopViewer.ShowPop(tile.GetPlayerPopulation(Match.ActivePlayer));
     HoverBrick = this;
 }
Example #2
0
    public static void ShowFor(Tile tile)
    {
        var i = instance;

        UITileStatus.ShowFor(tile);
        i._view.SetActive(true);
        i._editingTile = tile;
        i._editingPop  = tile.GetPlayerPopulation(Match.ActivePlayer);
        UIPopViewer.ShowPop(i._editingPop);

        i.MaxOut();
        _showing = true;
    }
Example #3
0
 private void OnDestroy()
 {
     Match.OnPlayerTurn -= HandlePlayerTurn;
     if (LeftSelectBrick == this)
     {
         LeftSelectBrick = null;
     }
     if (RightSelectBrick == this)
     {
         RightSelectBrick = null;
     }
     if (HoverBrick == this)
     {
         HoverBrick = null;
     }
     UITileStatus.Clear(tile);
 }
Example #4
0
 private void OnDisable()
 {
     _instance = null;
     _tile     = null;
 }
Example #5
0
 private void OnDestroy()
 {
     _instance = null;
     _tile     = null;
 }
Example #6
0
 void Start()
 {
     _instance = this;
     Clear();
 }
Example #7
0
    private void Update()
    {
        if (UIPopAction.Showing || UIWinner.hasWinner)
        {
            return;
        }

        if (HoverBrick == this)
        {
            bool hasPop = tile.HasPopulation(Match.ActivePlayer);

            if (Input.GetMouseButtonDown(0))
            {
                if (hasPop)
                {
                    LeftSelectBrick = this;
                    buttonDownTime  = Time.timeSinceLevelLoad;
                }
                else
                {
                    LeftSelectBrick = null;
                }
            }

            if (LeftSelectBrick)
            {
                if (Input.GetMouseButtonUp(0))
                {
                    if (HoverBrick == LeftSelectBrick)
                    {
                        UIPopAction.ShowFor(tile);
                    }
                    else
                    {
                        LeftSelectBrick.IllustrateSelection(this, true);
                        LeftSelectBrick.SetTileAction(this);
                    }
                    LeftSelectBrick = null;
                }
                else if (Input.GetMouseButton(0))
                {
                    LeftSelectBrick.IllustrateSelection(this, false);
                }
            }

            if (Input.GetMouseButtonDown(1))
            {
                RightSelectBrick = this;
                Debug.Log("Right Select " + RightSelectBrick);
            }
            else if (RightSelectBrick)
            {
                if (Input.GetMouseButtonUp(1))
                {
                    Debug.Log("Right Select Complete " + RightSelectBrick);
                    if (RightSelectBrick == this)
                    {
                        Debug.Log("Clear");
                        tile.ClearPlan();
                        ClearPlanIllustration();
                    }
                    RightSelectBrick = null;
                }
            }
        }

        if (clearBrickWithDelay)
        {
            if (HoverBrick == null)
            {
                if (Time.timeSinceLevelLoad > clearTime)
                {
                    UITileStatus.Clear(tile);
                    clearBrickWithDelay = false;
                }
            }
            else
            {
                clearBrickWithDelay = false;
            }
        }
    }