GetIntExtra() public method

public GetIntExtra ( string paramName, int defaultValue ) : int
paramName string
defaultValue int
return int
Ejemplo n.º 1
0
    void UpdateText(Parameters parameters)
    {
        int current = parameters.GetIntExtra(CURRENT_HEALTH, 0);
        int max     = parameters.GetIntExtra(MAX_HEALTH, 0);

        this.healthText.text = current + "/" + max;
    }
    private void UpdateCurrencyDisplay(Parameters parameters)
    {
        int kappaTokens = parameters.GetIntExtra("KappaTokens", 0);
        int coins       = parameters.GetIntExtra("Coins", 0);

        coinValueText.text       = coins.ToString("N0");
        kappaTokenValueText.text = kappaTokens.ToString("N0");
    }
Ejemplo n.º 3
0
    private void ShowWinScreen(Parameters parameters)
    {
        isGameOver = true;
        // Show result screen
        var dlgResult = (ResultDialog)ViewHandler.Instance.Show(ViewNames.DialogNames.RESULT_DIALOG_NAME);

        var correctHits = parameters.GetIntExtra(PARAM_WIN_CORRECT_COUNT, 0);
        var wrongHits   = parameters.GetIntExtra(PARAM_WIN_WRONG_COUNT, 0);

        dlgResult.SetResult(correctHits, wrongHits);
    }
Ejemplo n.º 4
0
    public void ShowAnnouncement(Parameters param)
    {
        int curPlayerNo = param.GetIntExtra(PLAYERNO_PARAM, 1);

        anim.SetTrigger(ANIM_TRIGGER_SHOW);
        SwitchGraphic(curPlayerNo);
    }
Ejemplo n.º 5
0
    /// <summary>
    /// Sets the max point of the number line.
    /// </summary>
    /// <param name="parameters">Parameter object containing the max point.</param>
    public void SetMaxObserver(Parameters parameters)
    {
        int newMaxPoint = parameters.GetIntExtra(MAX_POINT, 1);

        this.SetMaxPoint(newMaxPoint);
        Debug.LogError("MAX OBSERVER GOT " + this.GetMaxPoint());
    }
Ejemplo n.º 6
0
    public void OnTileClicked(Parameters parameters)
    {
        if (clicked == 0)
        {
            clicked1 = parameters.GetIntExtra(KeyNames.KEY_TILE_TYPE, 1);
            clicked++;
        }
        else if (clicked == 1)
        {
            EventBroadcaster.Instance.PostEvent(EventNames.ON_TOGGLE_ACTIVE);
            clicked2 = parameters.GetIntExtra(KeyNames.KEY_TILE_TYPE, 1);
            clicked  = 0;

            Debug.Log("Clicked1: " + clicked1 + " Clicked2: " + clicked2);

            if (clicked1 != clicked2)
            {
                notMatch = true;
            }
            else
            {
                // MATCHED
                Parameters checkParams = new Parameters();
                checkParams.PutExtra(KeyNames.KEY_IS_MATCH, true);
                EventBroadcaster.Instance.PostEvent(EventNames.ON_TOGGLE_ACTIVE);
                EventBroadcaster.Instance.PostEvent(EventNames.ON_TILES_CHECKED, checkParams);
                EventBroadcaster.Instance.PostEvent(EventNames.ON_UPDATE_SCORE);


                tileNum -= 2;
                if (tileNum == 0)
                {
                    EventBroadcaster.Instance.PostEvent(EventNames.ON_FINISH_LEVEL);
                }
            }
        }
    }
Ejemplo n.º 7
0
//	void ShowHint(GameObject collided) {
//		if(collided.layer == LayerMask.NameToLayer("Door Hint")) {
//			Debug.Log ("I can go inside this thing");
//			co = StartCoroutine (StartTimer (DOOR_HINT_INDEX));
//		}
//		else if(collided.layer == LayerMask.NameToLayer("Pickup Hint")) {
//			Debug.Log ("I can pick this up");
//			co = StartCoroutine (StartTimer (PICKUP_HINT_INDEX));
//		}
//	}

    void ShowHint(Parameters parameters)
    {
        int collidedLayer = parameters.GetIntExtra("LAYER_VALUE", 0);

        if (collidedLayer == LayerMask.NameToLayer("Door Hint"))
        {
            Debug.Log("I can go inside this thing");
            co = StartCoroutine(StartTimer(DOOR_HINT_INDEX));
        }
        else if (collidedLayer == LayerMask.NameToLayer("Pickup Hint"))
        {
            Debug.Log("I can pick this up");
            co = StartCoroutine(StartTimer(PICKUP_HINT_INDEX));
        }
    }
Ejemplo n.º 8
0
    void OnBlockClicked(Parameters parameter)
    {
        if (LevelManager.Instance.IsGameOver())
        {
            return;
        }

        var key = (KeyCode)parameter.GetObjectExtra(PARAM_KEY_PRESSED);

        var targetColor = (BlockColor)parameter.GetIntExtra(PARAM_TARGETCOLOR, 0);
        var isCorrect   = false;

        if ((key == attachedPlayer.keyRed && targetColor == BlockColor.RED) ||
            (key == attachedPlayer.keyGreen && targetColor == BlockColor.GREEN) ||
            (key == attachedPlayer.keyBlue && targetColor == BlockColor.BLUE))
        {
            EventBroadcaster.Instance.PostEvent(EventNames.ON_CORRECT);
            EventBroadcaster.Instance.PostEvent(EventNames.REMOVE_BLOCK);
            return;
        }

        EventBroadcaster.Instance.PostEvent(EventNames.ON_WRONG);
    }
Ejemplo n.º 9
0
    public static void CreateEmptyEntry(Parameters parameters)
    {
        print("TYPE " + parameters.GetStringExtra("TYPE", "NONE") + " NUMBER" + parameters.GetIntExtra("NUMBER", 0) + " DESCRIPTIVE NAME"
              + parameters.GetStringExtra("DESCRIPTIVE_NAME", "NONE") + " TIME INTERACTED" + parameters.GetStringExtra("TIME_NEEDLE_INTERACTED", "NONE"));

        if (parameters.GetStringExtra("TYPE", "").Equals("PartitionableObject"))
        {
            Tuple <Entry.Type, int> key = new Tuple <Entry.Type, int>(Entry.Type.PartitionableObject, parameters.GetIntExtra("NUMBER", 0));

            PlayerData.POTally.Add(key, null);
        }
        else if (parameters.GetStringExtra("TYPE", "").Equals("Enemy"))
        {
            Tuple <Entry.Type, int> key = new Tuple <Entry.Type, int>(Entry.Type.Enemy, parameters.GetIntExtra("NUMBER", 0));

            PlayerData.enemyTally.Add(key, null);
        }
        else if (parameters.GetStringExtra("TYPE", "").Equals("LCD"))
        {
            Tuple <Entry.Type, int> key = new Tuple <Entry.Type, int>(Entry.Type.LCD, parameters.GetIntExtra("NUMBER", 0));

            PlayerData.LCDTally.Add(key, null);
        }
    }
Ejemplo n.º 10
0
 /// <summary>
 /// Updates the label for the max point marker.
 /// </summary>
 /// <param name="parameters">Parameter object containing data passed to this function.</param>
 public void MaxChange(Parameters parameters)
 {
     this.maxValue       = parameters.GetIntExtra(NEW_MAX, 1);
     this.GetText().text = "" + this.maxValue;
 }
Ejemplo n.º 11
0
    private void OnSpawnEvent(Parameters parameters)
    {
        int numBalls = parameters.GetIntExtra(NUM_BALLS_KEY, 0);

        this.SpawnBall(numBalls);
    }
Ejemplo n.º 12
0
    private void OnStartEvent(Parameters parameter)
    {
        int numBox = parameter.GetIntExtra("NUM_BOX_KEY", 3);

        this.OnStart(numBox);
    }
Ejemplo n.º 13
0
    /// <summary>
    /// Also toggles soldier material
    /// </summary>
    /// <param name="p"></param>
    public void ShowSoldierHistory(Parameters p)
    {
        int  playerNo    = p.GetIntExtra("playerNo", -1);
        bool shouldClear = p.GetBoolExtra("shouldClear", false);

        if (playerNo == -1)
        {
            Debug.LogError("Invalid parameter value in Show Soldier History");
            return;
        }

        if (player1.GetPlayerNo() == playerNo)
        {
            // Show player 1
            player1.ShowSoldierHistories(true);
            player2.ShowSoldierHistories(false);
            if (shouldClear)
            {
                player2.ClearSoldierHistories();
            }

            // Set players' soldiers' material (translucent or normal)
            player1.SetTranslucentSoldiers(true);
            player2.SetTranslucentSoldiers(false);

            // Set backup cards float under here
            player1.SetBackupCardsTranslucent(true);
            player2.SetBackupCardsTranslucent(false);
        }
        else if (playerNo == -2)
        {
            // Show nothing; Hide all
            player1.ShowSoldierHistories(false);
            player2.ShowSoldierHistories(false);
            if (shouldClear)
            {
                player1.ClearSoldierHistories();
                player2.ClearSoldierHistories();
            }

            // Set players' soldiers' material (translucent or normal)
            player1.SetTranslucentSoldiers(false);
            player2.SetTranslucentSoldiers(false);

            // Set backup cards float under here
            player1.SetBackupCardsTranslucent(false);
            player2.SetBackupCardsTranslucent(false);
        }
        else
        {
            // Show player 2
            player1.ShowSoldierHistories(false);
            player2.ShowSoldierHistories(true);
            if (shouldClear)
            {
                player1.ClearSoldierHistories();
            }

            // Set players' soldiers' material (translucent or normal)
            player1.SetTranslucentSoldiers(false);
            player2.SetTranslucentSoldiers(true);

            // Set backup cards float under here
            player1.SetBackupCardsTranslucent(false);
            player2.SetBackupCardsTranslucent(true);
        }
    }
Ejemplo n.º 14
0
 public void UpdateCurrentGold(Parameters parameters)
 {
     CurrentGold.text = parameters.GetIntExtra(PARAM_CURRENT_SCORE, Int32.Parse(CurrentGold.text)) + "";
 }