GetBoolExtra() public method

public GetBoolExtra ( string paramName, bool defaultValue ) : bool
paramName string
defaultValue bool
return bool
Ejemplo n.º 1
0
    /// <summary>
    /// Saves all necessary data e.g. user data, scene data, and Yuni's data
    /// </summary>
    /// <param name="parameters">Parameters passed by posted event</param>
    void SaveData(Parameters parameters)
    {
        bool isHardSave = parameters.GetBoolExtra("IS_HARD_SAVE", false);

        SaveUserData();
        SaveSceneData(isHardSave);
        SavePlayerData();
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Toggles mobile UI
    /// </summary>
    /// <param name="parameters">Parameters passed by posted event</param>
    void ToggleMobileUI(Parameters parameters)
    {
//		Debug.Log ("<color=cyan>CALLED TOGGLE UI</color>");
        bool flag = parameters.GetBoolExtra("FLAG", false);

        gameObject.SetActive(flag);
//		mobile.SetActive (flag);
    }
Ejemplo n.º 3
0
    //	void ToggleLeftRight(bool flag) {
    //		btnLeft1.SetActive (flag);
    //		btnRight1.SetActive (flag);
    //		btnLeft2.SetActive (!flag);
    //		btnRight2.SetActive (!flag);
    //	}

    /// <summary>
    /// Toggles the left and right buttons
    /// </summary>
    /// <param name="parameters">Parameters passed by posted event</param>
    void ToggleLeftRight(Parameters parameters)
    {
        bool flag = parameters.GetBoolExtra("FLAG", false);

        btnLeft1.SetActive(flag);
        btnRight1.SetActive(flag);

//		btnLeft2.SetActive (!flag);
//		btnRight2.SetActive (!flag);
    }
Ejemplo n.º 4
0
    /// <summary>
    /// Toggles the interact button
    /// </summary>
    /// <param name="parameters">Parameters passed by posted event</param>
    void ToggleInteract(Parameters parameters)
    {
        bool flag = parameters.GetBoolExtra("FLAG", false);

        if (!flag)
        {
            gameObject.GetComponent <MobileUI> ().InteractButton_Up();
        }
        btnInteract.SetActive(flag);
    }
Ejemplo n.º 5
0
    /// <summary>
    /// Loads saved data, if it exists
    /// </summary>
    /// <param name="parameters">Parameters passed by posted event</param>
    void LoadData(Parameters parameters)
    {
        bool willLoadData = parameters.GetBoolExtra("WILL_LOAD_DATA", false);

        LoadUserData();
        if (willLoadData)
        {
            LoadSceneData();
        }
        LoadPlayerData();
    }
Ejemplo n.º 6
0
    /// <summary>
    /// Update the stability.
    /// </summary>
    /// <param name="parameters">Parameter containing the ghost block which will affect the stability.</param>
    public void HollowUpdate(Parameters parameters)
    {
        float       numerator   = parameters.GetFloatExtra(NUMERATOR, 0f);
        float       denominator = parameters.GetFloatExtra(DENOMINATOR, 1f);
        Color       color       = (Color)parameters.GetObjectExtra(COLOR);
        bool        isAdd       = parameters.GetBoolExtra(IS_ADD, true);
        HollowBlock block       = (HollowBlock)parameters.GetObjectExtra(HOLLOW_BLOCK);

        this.ManipulateStability(numerator, denominator, color, isAdd, block);
        //		StabilityCheck ();
    }
Ejemplo n.º 7
0
    /// <summary>
    /// Update the stability.
    /// </summary>
    /// <param name="parameters">Parameter containing the ghost block which will affect the stability.</param>
    public void HollowUpdateInstant(Parameters parameters)
    {
        Debug.LogError("Entered instant");
        float       numerator   = parameters.GetFloatExtra(NUMERATOR, 0f);
        float       denominator = parameters.GetFloatExtra(DENOMINATOR, 1f);
        Color       color       = (Color)parameters.GetObjectExtra(COLOR);
        bool        isAdd       = parameters.GetBoolExtra(IS_ADD, true);
        HollowBlock block       = (HollowBlock)parameters.GetObjectExtra(HOLLOW_BLOCK);

        StartCoroutine(this.ManipulateStability(numerator, denominator, color, isAdd, block, true));
        //		StabilityCheck ();
    }
Ejemplo n.º 8
0
    //	void DisableJump() {
    //		gameObject.GetComponent<MobileUI> ().JumpButton_Up ();
    //		btnJump.SetActive (false);
    //		btnInteract.SetActive (true);
    //	}
    //
    //	void DisableInteract() {
    //		gameObject.GetComponent<MobileUI> ().InteractButton_Up ();
    //		btnInteract.SetActive (false);
    //		btnJump.SetActive (true);
    //	}

    //	void ToggleSwitch(bool flag) {
    //		btnSwitch.SetActive (flag);
    //	}

    /// <summary>
    /// Toggles the switch weapon button
    /// </summary>
    /// <param name="parameters">Parameters passed by posted event</param>
    void ToggleSwitch(Parameters parameters)
    {
        bool flag = parameters.GetBoolExtra("FLAG", false);

        if (isForceAcquire || (flag && GetPlayer().GetPlayerAttack().HasHammer()))
        {
            btnSwitch.SetActive(flag);
        }
        else
        {
            btnSwitch.SetActive(false);
        }
    }
Ejemplo n.º 9
0
    /// <summary>
    /// Function call to toggle if the camera should zoom in or not.
    /// </summary>
    /// <param name="data">Flag</param>
    private void ShouldZoomIn(Parameters data)
    {
        bool flag = data.GetBoolExtra("shouldZoomIn", false);

        if (flag)
        {
            cameraZoom.shouldZoomIn  = true;
            cameraZoom.shouldZoomOut = false;
        }
        else
        {
            cameraZoom.shouldZoomIn  = false;
            cameraZoom.shouldZoomOut = true;
        }
    }
Ejemplo n.º 10
0
    public void onCheckedMatch(Parameters args)
    {
        bool match = args.GetBoolExtra(KeyNames.KEY_IS_MATCH, false);

        if (match)
        {
            correctMatches++;
        }
        else
        {
            incorrectMatches++;
        }

        Debug.Log("Correct: " + correctMatches + " Incorrect: " + incorrectMatches);
    }
Ejemplo n.º 11
0
	public void OnTilesChecked(Parameters args) {
		bool match = args.GetBoolExtra (KeyNames.KEY_IS_MATCH, false);

		if (!match) {
			this.active = true;
			this.tileImage.enabled = false;
			this.questionText.enabled = questionText.enabled = true;
		}
		else {
			this.active = false;
			matched = true;
			tileImage.enabled = true;
			questionText.enabled = false;
		}

		removeInstance = true;

	}
Ejemplo n.º 12
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.º 13
0
    /// <summary>
    /// Record the data of the player's attempt.
    /// Evaluates if the attempt is right or wrong by comparing the set of fllled blocks with all the instances of the subset sum set.
    /// The comparision looks if the set of attempts are closer or farther from any subset sum.
    /// </summary>
    /// <param name="data"></param>
    private void RecordData(Parameters data)
    {
        HollowBlock block  = data.GetHollowBlockExtra("hollowBlock");
        bool        solved = data.GetBoolExtra("solved", true);

        FractionSet oldFracSet = new FractionSet();

        oldFracSet.fractions.AddRange(fractionSet.fractions);
        FractionData blockFraction = block.GetFraction();

        if (solved)
        {
            fractionSet.fractions.Add(block.GetFraction());
        }
        else
        {
            fractionSet.fractions.Remove(fractionSet.fractions.Find(x => x.numerator == block.GetFraction().numerator &&
                                                                    x.denominator == block.GetFraction().denominator));
        }

        Debug.Log("Old size: " + oldFracSet.fractions.Count);

        FractionSet newFracSet = new FractionSet();

        newFracSet.fractions.AddRange(fractionSet.fractions);

        Debug.Log("New size: " + newFracSet.fractions.Count);

        bool found      = false;
        bool improve    = false;
        int  oldCounter = 0;
        int  newCounter = 0;

        foreach (FractionSet s in additionRight)
        {
            FractionSet oldTemp = oldFracSet;
            FractionSet newTemp = newFracSet;
            oldCounter = 0;
            newCounter = 0;

            for (int i = 0; i < s.fractions.Count; i++)
            {
                if (oldTemp.fractions.Remove(oldTemp.fractions.Find(x => x.numerator == s.fractions [i].numerator &&
                                                                    x.denominator == s.fractions [i].denominator)))
                {
                    oldCounter++;
                }
                else
                {
                    oldCounter--;
                }

                if (newTemp.fractions.Remove(newTemp.fractions.Find(x => x.numerator == s.fractions [i].numerator &&
                                                                    x.denominator == s.fractions [i].denominator)))
                {
                    newCounter++;
                }
                else
                {
                    newCounter--;
                }
            }

            oldCounter -= oldFracSet.fractions.Count;
            newCounter -= newFracSet.fractions.Count;

            Debug.Log("New: " + newCounter + " VS Old: " + oldCounter);

            if (newCounter > oldCounter)
            {
                improve = true;
                break;
            }
        }

        if (solved)          //This means it is Addition
        {
            if (improve)
            {
                this.currentSession.Tally(blockFraction.denominator, true, Operation.ADDITION);
            }
            else
            {
                this.currentSession.Tally(blockFraction.denominator, false, Operation.ADDITION);
            }
        }
        else            //Else, its Subtraction
        {
            if (improve)
            {
                this.currentSession.Tally(blockFraction.denominator, true, Operation.SUBTRACTION);
            }
            else
            {
                this.currentSession.Tally(blockFraction.denominator, false, Operation.SUBTRACTION);
            }
        }
    }
Ejemplo n.º 14
0
    /// <summary>
    /// Toggles the pickup button
    /// </summary>
    /// <param name="parameters">Parameters passed by posted event</param>
    void TogglePickup(Parameters parameters)
    {
        bool flag = parameters.GetBoolExtra("FLAG", false);

        btnPickup.SetActive(flag);
    }