public void SetPageInfoEX() { SetStationPages tempSetStationPages = this.gameObject.GetComponent <SetStationPages>(); DictionariesForThings tempConverstions = this.gameObject.GetComponent <DictionariesForThings>(); tempSetStationPages.TunOffAllStampsOnAllCards(); // turn off all the stamps, setting them will turn them back on float ratio = 0; //use this for progress ratio for (int i = 0; i < tempSetStationPages.myResourceCards.Count; ++i) // for each page { List <KeyValuePair <string, int> > questData = tempSetStationPages.GetQuestData(); // get all quest data StampCard myStampcard = tempSetStationPages.myResourceCards[i].GetComponent <StampCard>(); // stampcard int s = 0; //update each stamp on each card for (int d = 0; d < questData.Count; d++) // for all card datas { //Debug.Log("stamp = "+s.ToString() +"\t d = "+d.ToString() +"\t questData[d].Key = "+questData[d].Key); if (questData[d].Value > -1) { //display correct resource if (questData[d].Value == 1) { myStampcard.SetCompletedStamp(s, questData[d].Key); } if (questData[d].Value == 0) { myStampcard.SetStampBasedOnResource(s, questData[d].Key); } //Debug.Log("Set Data on::"+myStampcard.gameObject.name +" questData["+d.ToString()+"].Key = "+questData[d].Key); s++; //next stamp } } } // DRAGON LEVELS int dragonlevel = MyCurrentToy.customData.GetInt("DragonLevel", 0); Debug.Log("setting DragonLevel = " + dragonlevel.ToString()); tempSetStationPages.SetDragonLevelColor(dragonlevel); //does this even work? ~Tom foreach (GameObject progressBar in tempSetStationPages.myProgressBars) { progressBar.GetComponent <EnergyBar>().SetValueF(ratio); } }
public IEnumerator UpdateStationResources() { yield return(new WaitForSeconds(1.0f)); //we always need to update the station resources! SetStationPages tempSetStationPages = myYellOnClaim.gameObject.GetComponent <SetStationPages>(); DictionariesForThings tempConverstions = myYellOnClaim.gameObject.GetComponent <DictionariesForThings>(); tempSetStationPages.SetAllStationResoruces(tempConverstions.Resource2Sprite[tempConverstions.Location2Resource[myYellOnClaim.currentLocation.ToString()]]); // Debug.Log("Set resource for location = " + myYellOnClaim.currentLocation.ToString() + "\t Location2Resource = " + tempConverstions.Location2Resource[myYellOnClaim.currentLocation.ToString()].ToString()); yield return(null); }
public void RefreshTheStationResource() { if (this.myYellOnClaim.currentLocation != YellOnClaim.Location.SANC) { this.gameObject.SetActive(true); //we always need to update the station resources! SetStationPages tempSetStationPages = myYellOnClaim.gameObject.GetComponent <SetStationPages>(); DictionariesForThings tempConverstions = myYellOnClaim.gameObject.GetComponent <DictionariesForThings>(); tempSetStationPages.SetAllStationResoruces(tempConverstions.Resource2Sprite[tempConverstions.Location2Resource[myYellOnClaim.currentLocation.ToString()]]); // Debug.Log("Set resource for location = " + myYellOnClaim.currentLocation.ToString() + "\t Location2Resource = " + tempConverstions.Location2Resource[myYellOnClaim.currentLocation.ToString()].ToString()); } else { this.gameObject.SetActive(false); } }
public void SetNewResourceCards2() //level up resource cards { SetStationPages tempSetStationPages = this.gameObject.GetComponent <SetStationPages>(); tempSetStationPages.TunOffAllStampsOnAllCards(); // turn off all the stamps, setting them will turn them back on float ratio = 0; //use this for progress ratio for (int i = 0; i < tempSetStationPages.myLevelUpResourceCards.Count; ++i) // for each page { List <KeyValuePair <string, int> > questData = tempSetStationPages.GetQuestData(); // get all quest data StampCard myStampcard = tempSetStationPages.myLevelUpResourceCards[i].GetComponent <StampCard>(); // stampcard int d = 0; //update each stamp on each card for (int j = 0; j < 8; j++) { if (d < questData.Count) // dont try to grab questdata that doesn't exist { Debug.Log("d = " + d.ToString() + "\t questData[d].Key = " + questData[d].Key); if (questData[d].Value > -1) { //display correct resource myStampcard.SetCompletedStamp(d, questData[d].Key); //display stamp if obtained d++; } else { //myStampcard.SetStampBasedOnResource(d, questData[d].Key); d++; } } } } }
public void SetNewResourceCards() { SetStationPages tempSetStationPages = this.gameObject.GetComponent <SetStationPages>(); DictionariesForThings tempConverstions = this.gameObject.GetComponent <DictionariesForThings>(); tempSetStationPages.TunOffAllStampsOnAllNewCards(); // turn off all the stamps, setting them will turn them back on float ratio = 0; //use this for progress ratio for (int i = 0; i < tempSetStationPages.myLevelUpResourceCards.Count; ++i) // for each page { List <KeyValuePair <string, int> > questData = tempSetStationPages.GetQuestData(); // get all quest data StampCard myStampcard = tempSetStationPages.myLevelUpResourceCards[i].GetComponent <StampCard>(); // stampcard int s = 0; //update each stamp on each card for (int d = 0; d < questData.Count; d++) // for all card datas { //Debug.Log("stamp = "+s.ToString() +"\t d = "+d.ToString() +"\t questData[d].Key = "+questData[d].Key); if (questData[d].Value > -1) { //display correct resource if (questData[d].Value == 1) { myStampcard.SetCompletedStamp(s, questData[d].Key); } if (questData[d].Value == 0) { myStampcard.SetStampBasedOnResource(s, questData[d].Key); } //Debug.Log("Set Data on::"+myStampcard.gameObject.name +" questData["+d.ToString()+"].Key = "+questData[d].Key); s++; //next stamp } } } }
public void OnClaimToy_Success(BitToys.Toy theToy, bool val) { WriteToErrorLog("ClaimToySuccess"); //debug for erasing cards SetLastToyScanned(theToy); //ready2scan = true;// override ready to scan non-sense if (!ready2scan) { //UniClipboard.SetText(UniClipboard.GetText() + "\n" + " " + System.DateTime.Now + " Tried to scan but the reader wasn't ready..."); this.WriteToErrorLog("ClaimToySuccess but was not ready"); return; } ready2scan = false;// only take one scan at a time// reset in SetIsReadyForScan.cs // StartCoroutine(EnableReady2Scan()); this.MyCurrentToy = theToy; CurrentPlayerID = theToy.bitToysId; bool validscan = true; //was false// Scans always Active (unless a player is in progress) /* * if (!playerScanInTimes.ContainsKey(CurrentPlayerID)) * { * playerScanInTimes.Add(CurrentPlayerID, Time.time); * validscan = true; * * } * else * { * validscan = CheckForValidScanTime(CurrentPlayerID); * * }*/ if (!validscan) { this.ScanScreen.SetActive(false); this.ScanCardTooRecent.SetActive(true); //weve seen this player before, and the time //hasnt expired yet, so they need to come back later //no need for return here, this goes to the end of the function just the same // UniClipboard.SetText(UniClipboard.GetText() + "\n" + " " + System.DateTime.Now + " Tried to scan but it was too soon..."); StartCoroutine(EnableReady2Scan()); } else// if valid scan { //only works if id is longer than 3 , which it should be //commented out for doug //if(MyCurrentToy.styleId != null && MyCurrentToy.styleId.Length >= 3) //{ // string last3chars = MyCurrentToy.styleId.Substring(MyCurrentToy.styleId.Length - 3); // bool isThisADebugCard; // if (last3chars == "dev") // isThisADebugCard = true; // else // isThisADebugCard = false; // if (isThisADebugCard) // { // debugmode = false; // ToggleDebugStuff(); // } //} WriteToErrorLog("GotValidScan"); //we always need to update the station resources! SetStationPages tempSetStationPages = this.gameObject.GetComponent <SetStationPages>(); DictionariesForThings tempConverstions = this.gameObject.GetComponent <DictionariesForThings>(); Debug.Log("location = " + this.currentLocation.ToString() + "\t Location2ResourceDic = " + tempSetStationPages.Location2ResourceDic[this.currentLocation].ToString()); Debug.Log("location = " + this.currentLocation.ToString() + "\t Location2Resource = " + tempConverstions.Location2Resource[this.currentLocation.ToString()].ToString()); tempSetStationPages.SetAllStationResoruces(tempConverstions.Resource2Sprite[tempConverstions.Location2Resource[this.currentLocation.ToString()]]); // QuestProgress myQuestProgress = this.gameObject.GetComponent <QuestProgress>(); bool correctstation = myQuestProgress.StationIsForQuest(); AddLocationData(correctstation, myQuestProgress.NumberOfQuestsToComplete()); if (this.ShowNUX && this.MyCurrentToy.customData.GetBool("NewUser", true)) { int test = this.MyCurrentToy.customData.GetInt("DragonsReleased", -999); if (test == -999) { this.MyCurrentToy.customData.AddInt("DragonsReleased", 0); } this.MyCurrentToy.customData.AddBool("NewUser", false); // flag as an old user // this.ScanCardNUX.SetActive(true); activateThis = NextActive.NUX; //first set of quests this.MyCurrentToy.customData.AddInt("DragonLevel", 0); this.SetNewQuestCard(this.MyCurrentToy.customData.GetInt("DragonLevel", 0));//rando some quests? WriteToErrorLog("Scan = New User Experience"); this.SetPageInfoEX(); // we need to set page infor for a correct scan } else { // which state are we in? if (myQuestProgress.StationIsForQuest() && (currentLocation != Location.SANC2)) { //increment data for going to this station// ie collecting the resource this.MyCurrentToy.customData.SetInt(this.GetComponent <DictionariesForThings>().Location2Resource[this.currentLocation.ToString()], 1); this.SetPageInfoEX();// we need to set cards after new resource if (myQuestProgress.CompletedAllQuests()) { // this.ScanCardNewQuests.SetActive(true); activateThis = NextActive.NEWQUESTS; int currentDragonLevel = this.MyCurrentToy.customData.GetInt("DragonLevel", 0); if (currentDragonLevel == 0) { changing_from_egg_2_hatchling = true; } currentDragonLevel += 1; MyCurrentToy.customData.SetInt("DragonLevel", currentDragonLevel); //HACK for getting new locations //this.GetComponent<QuestProgress>().SetQuests(this.LocationsListHack()); this.SetNewQuestCard(currentDragonLevel); SetNewResourceCards(); // should update the new cards with new quests //update new quest ui? //update new dragon? //get new quests? //get next dragon? WriteToErrorLog("Scan = New Quests"); } else// haven't completed all quests { this.SetPageInfoEX(); // we need to set up cards even if not right // this.ScanCardSuccess.SetActive(true); activateThis = NextActive.SCANSUCCESS; WriteToErrorLog("Scan = Progress Quests"); } } else if (currentLocation != Location.SANC2) // wrong station { this.SetPageInfoEX(); // we need to set up cards even if not right // this.ScanCardWrong.SetActive(true); activateThis = NextActive.SCANWRONG; WriteToErrorLog("Scan = Wrong Station"); //update cards ui? //update dragon ui? } //TODO sanctuary too early if (currentLocation == Location.SANC2) { int currentDragonLevel = this.MyCurrentToy.customData.GetInt("DragonLevel", 0); //release it if (currentDragonLevel > 1) { int currentDragonsReleased = this.MyCurrentToy.customData.GetInt("DragonsReleased", 0); // this.SetPageInfoEX(); currentDragonsReleased += 1; this.MyCurrentToy.customData.SetInt("DragonsReleased", currentDragonsReleased); MyCurrentToy.customData.Remove("NewUser"); MyCurrentToy.customData.Remove("DragonLevel"); //setactive // SanctuaryPage.SetActive(true); activateThis = NextActive.SANCPAGE; } else if (currentDragonLevel < 2)//too early { // SanctuaryTooSoon.SetActive(true); activateThis = NextActive.SANCTOOSOON; } } //TODO sanctuary } leftScanParticles.gameObject.SetActive(false); rightscanParticles.gameObject.SetActive(false); idleparticles1.gameObject.SetActive(false); idleparticles2.gameObject.SetActive(false); // if(MegaScanInParticles.gameObject.activeSelf) MegaScanInParticles.Play(); //at this point it will always contain the key, this is just to prevent nulls if (playerScanInTimes.ContainsKey(CurrentPlayerID)) { playerScanInTimes[CurrentPlayerID] = Time.time; } string tempDebug = ""; tempDebug += ""; //clear text tempDebug += "\n Toy id = " + theToy.bitToysId; tempDebug += "\n Owner id = " + theToy.ownerId; tempDebug += "\n Style id = " + theToy.styleId; tempDebug += "\n SKU id = " + theToy.skuId; tempDebug += "\n customData has: " + theToy.customData.ToString(); tempDebug += "\n " + System.DateTime.Now; tempDebug += "\n ******************************"; this.WriteToErrorLog(tempDebug); foreach (KeyValuePair <string, float> entry in playerScanInTimes) { this.WriteToErrorLog("\n Player ID: " + entry.Key.ToString() + " val is " + entry.Value.ToString()); }//end for each //reset the location timer back to 0 (dont get a new location) GetComponent <PickLocationTimer>().ResetTimer(); //handle screen activations this.ScanScreen.SetActive(false);// deactivate scan screen //UPDATE CUSTOM DATA!!! int currentDragonLevel2 = this.MyCurrentToy.customData.GetInt("DragonLevel", 0); this.MyCurrentToy.customData.SendAsync();//update that toy data! }//end of else valid scan } // end of function