Exemple #1
0
    void UpdateDice(SaveableDice newDice)
    {
//        Debug.Log("updated:  " + newDice.diceID + "   " + newDice.currentCharge);
        //  userDices = LoadItems().userDices;

        foreach (var dice in userDices)

        {
            //     Debug.Log("in id:  " +dice.diceID+"   "+dice.currentCharge);
            if (dice.diceID == newDice.diceID)
            {
                dice.currentCharge = newDice.currentCharge;
                dice.amountAwarded = newDice.amountAwarded;
                dice.level         = newDice.level;
                Debug.Log("dice ch: " + dice.diceID + "   " + newDice.isCharging);
                dice.isCharging        = newDice.isCharging;
                dice.startToChargeTime = newDice.startToChargeTime;
                // Debug.Log("in change: " + dice.currentCharge);
                break;
            }
        }
        SaveItems(this);

        //Debug.Log("after update");
        //userDices = LoadItems().userDices;
        //for (int i = 0; i < userDices.Count; i++)
        //{
        //    Debug.Log("in id:  " + userDices[i].diceID+"    "+userDices[i].currentCharge);

        //}
    }
 void OnDiceSelected(SaveableDice dice)
 {
     Debug.Log("activate:  ");
     currentDiceInMenuSelected = dice;
     borderImage.enabled       = true;
     canTakeDice = true;
 }
 void CheckDiceDiscard(SaveableDice selDice)
 {
     if (thisDiceID == selDice.diceID)
     {
         diceInUse = false;
     }
 }
 void DiceSelected(SaveableDice dice)
 {
     if (dice.diceID == thisDiceID)
     {
         diceInUse = true;
     }
 }
Exemple #5
0
    void AwardDice(int diceID, int amount)
    {
        Debug.Log("dice award");
        bool existingDice = false;

        foreach (var dice in dices)
        {
            if (dice.diceID == diceID)
            {
                existingDice        = true;
                dice.amountAwarded += amount;
                OnDiceUpdate(dice);
                break;
            }
        }

        if (existingDice == false)
        {
            SaveableDice newDice = new SaveableDice();
            newDice.diceID        = diceID;
            newDice.currentCharge = defaultHolder.maxChargePerLevel[0];
            newDice.amountAwarded = amount;
            OnDiceAdd(newDice);
        }
    }
Exemple #6
0
 private void Update()
 {
     if (currentDice == null)
     {
         currentDice = DiceSaver.instance.GetDices(0);
     }
 }
 void EmptySlot(SaveableDice dice)
 {
     if (currentDice != null && dice.diceID == currentDice.diceID)
     {
         currentDice            = null;
         backgroundImage.sprite = emptySlot;
         OnDiscardDice(dice);
         OnDiceAssigned(currentDice);
     }
 }
Exemple #8
0
 void AddDice(SaveableDice newDice)
 {
     if (userDices == null)
     {
         userDices = new List <SaveableDice>();
     }
     userDices.Add(newDice);
     Debug.Log("in save: " + userDices.Count);
     SaveItems(this);
 }
 void AssignDice(SaveableDice dice)
 {
     Debug.Log("assiiigggnnn");
     currentDice            = dice;
     borderImage.enabled    = false;
     backgroundImage.sprite = withDiceSlot;
     PlayerPrefs.SetInt("diceSelect_" + slotID, dice.diceID);
     OnDiceAssigned(dice);
     OnStaticDiceAssigned(dice);
     OnTurnBorderOff(dice);
 }
    void AddDefaultDice(int diceID)
    {
        SaveableDice dice = new SaveableDice();

        dice.diceID        = diceID;
        dice.level         = 0;
        dice.currentCharge = defaultHolder.maxChargePerLevel[0];
        dice.amountAwarded = 0;
        dice.isCharging    = false;
        OnDiceAdded(dice);
    }
 void ChangeCharging(SaveableDice dice)
 {
     if (dice.isCharging)
     {
         anotherCharging = true;
     }
     else
     {
         anotherCharging = false;
     }
 }
    void DiceUpdate(SaveableDice newDice)
    {
        if (thisDiceID == newDice.diceID)
        {
            Debug.Log("in edit");
            thisDice = newDice;
            DisplayDiceInfo();

            OnThisDiceAssigned(thisDice);
        }
    }
    void CheckDiceDeselect(SaveableDice newDice)
    {
        if (thisDice == null)
        {
            return;
        }
//        Debug.Log("new: " + newDice + "   " + thisDice);
        if (newDice.diceID != thisDice.diceID)
        {
            diceUse.SetActive(false);
            diceInfo.SetActive(false);
            isDiceSelected = false;
        }
    }
    void SetDice(SaveableDice newDice)
    {
        dice = newDice;
        if (dice.amountAwarded >= DiceDefaultHolder.awardForNextLevel[dice.level])
        {
            levelUpImage.color = UpgradeColor;
            barImage.color     = UpgradeColor;
        }

        else
        {
            levelUpImage.color = nonUpgradeColor;
            barImage.color     = nonUpgradeColor;
        }
    }
    public void OnPointerDown(PointerEventData eventData)
    {
        Debug.Log("pointer down  " + canTakeDice);
        if (canTakeDice == false)
        {
            OnDisplayInfoButton(0);
            return;
        }

        //OnSlotSelected(slotID);
        if (currentDiceInMenuSelected != null)
        {
            if (currentDice != null)
            {
                OnDiscardDice(currentDice);
            }
            AssignDice(currentDiceInMenuSelected);
            currentDiceInMenuSelected = null;
        }
    }
    void AssignDice(SaveableDice dice)
    {
//        Debug.Log("new dice:  " + dice.diceID + "    " + thisDiceID);
        if (dice.diceID == thisDiceID)
        {
            //  Debug.Log("assiii:  " + dice.diceID + "   " + thisDiceID);
            thisDice = dice;
            GetComponent <DiceLevelup>().EnrollInEvent();
            OnThisDiceAssigned(thisDice);
            for (int i = 0; i < childNum; i++)
            {
                transform.GetChild(i).gameObject.SetActive(true);
            }
            DisplayDiceInfo();
            if (thisDice.isCharging)
            {
                OnDiceChargeStateChanged(thisDice);
            }
        }
    }
    void AssignDice(SaveableDice newDice)
    {
        if (newDice == null)
        {
            Debug.Log("newww nulll");
            enableInfo = false;
            thisDice   = null;
            for (int i = 0; i < childnum; i++)
            {
                transform.GetChild(i).gameObject.SetActive(false);
            }
            designApplyObject.SetActive(false);
            return;
        }
        enableInfo = true;
        thisDice   = newDice;
        for (int i = 0; i < childnum; i++)
        {
            transform.GetChild(i).gameObject.SetActive(true);
        }

        //  GetComponent<Image>().enabled = true;
        DisplayDiceInfo();
    }
 void TurnSlotOff(SaveableDice dummy)
 {
     Debug.Log("turn off");
     borderImage.enabled = false;
     canTakeDice         = false;
 }
 void GetDice(SaveableDice dice)
 {
     thisDice = dice;
 }
Exemple #20
0
 void GetDice(SaveableDice dice)
 {
     thisDice = dice;
     CheckForUIElements();
 }
 void DeselectDice(SaveableDice dice)
 {
     diceUse.SetActive(false);
     diceInfo.SetActive(false);
 }
 void DiceInMenuclicked(SaveableDice dummy)
 {
     infoButton.SetActive(false);
 }
Exemple #23
0
 void UpdateDice(int ID)
 {
     currentDice   = DiceSaver.instance.GetDices(ID);
     currentDiceID = ID;
 }