public bool Hint(LevelHint aLevelHint, bool aIsNoneOnly, bool aIsForce, bool aIsWithAnimation) { if (!levelWord.isCompleted && ((aLevelHint > levelWord.hint) | aIsForce) && (!aIsNoneOnly || levelWord.hint == LevelHint.None)) { levelWord.hint = aLevelHint; BoardLetter[] componentsInChildren = base.gameObject.GetComponentsInChildren <BoardLetter>(); switch (aLevelHint) { case LevelHint.GoodStart: componentsInChildren[0].Hint(aLevelHint, aIsWithAnimation); break; case LevelHint.StartAndFinish: componentsInChildren[0].Hint(aLevelHint, aIsWithAnimation); componentsInChildren[componentsInChildren.Length - 1].Hint(aLevelHint, aIsWithAnimation, 0.2f); break; case LevelHint.Expose: { float num = 0f; for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].Hint(aLevelHint, aIsWithAnimation, num); num += 0.2f; } break; } } return(true); } return(false); }
public void Set(LevelLetter aLevelLetter, float aWordLetterOffset, Order aOrder, HintDirection aHintDirection, bool aIsLevelCompleted, LevelType aLevelType) { boxCollider.size = new Vector2(aWordLetterOffset, aWordLetterOffset); IsAvailable = true; levelType = aLevelType; Letter = aLevelLetter.letter.ToUpper(); type = (((!aIsLevelCompleted && aLevelLetter.isCoin) || aLevelType == LevelType.BonusRound || aLevelType == LevelType.DailyPuzzle) ? Type.Coin : Type.Normal); order = aOrder; X = aLevelLetter.x; Y = aLevelLetter.y; IsSelected = false; SelectedIndex = -1; IsMarked = false; hintType = LevelHint.None; hintDirection = aHintDirection; isHintParticle = true; isShining = false; shiningCounter = 0f; base.transform.localPosition = new Vector3(((float)X + 0.5f) * aWordLetterOffset, (0f - ((float)Y + 0.5f)) * aWordLetterOffset, 0f); tile.GetComponent <Canvas>().sortingOrder = X + Y + 1; tileShine.material = new Material(tileShine.material); tileShine.gameObject.SetActive(value: false); tileSelected.SetActive(value: false); hint.SetActive(value: false); if (order == Order.First) { hintDotFirst.gameObject.SetActive(value: true); hintDotOther.gameObject.SetActive(value: false); } else if (order == Order.Last) { hintDotFirst.gameObject.SetActive(value: false); hintDotOther.gameObject.SetActive(value: true); } else { hintDotFirst.gameObject.SetActive(value: false); hintDotOther.gameObject.SetActive(value: true); } selector.SetActive(value: false); selectorLeft.SetActive(value: false); selectorRight.SetActive(value: false); selectorUp.SetActive(value: false); selectorDown.SetActive(value: false); Text[] componentsInChildren = letter.GetComponentsInChildren <Text>(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].text = Letter; } letter.SetActive(value: true); letterSelected.SetActive(value: false); if (type == Type.Normal) { coin.SetActive(value: false); } else if (type == Type.Coin) { coin.SetActive(value: true); } }
public bool Hint(LevelHint aLevelHint) { if (aLevelHint <= LevelHint.Expose) { BoardWord[] componentsInChildren = base.gameObject.GetComponentsInChildren <BoardWord>(); int num = UnityEngine.Random.Range(0, componentsInChildren.Length); for (int i = 0; i < componentsInChildren.Length; i++) { int num2 = (num + i) % componentsInChildren.Length; if (componentsInChildren[num2].Hint(aLevelHint, aIsNoneOnly: true, aIsForce: false, aIsWithAnimation: true)) { ELSingleton <LevelsSettings> .Instance.Save(); return(true); } } for (int j = 0; j < componentsInChildren.Length; j++) { int num3 = (num + j) % componentsInChildren.Length; if (componentsInChildren[num3].Hint(aLevelHint, aIsNoneOnly: false, aIsForce: false, aIsWithAnimation: true)) { ELSingleton <LevelsSettings> .Instance.Save(); return(true); } } } else if (aLevelHint == LevelHint.Tip) { return(Tip()); } return(false); }
public void Load(BinaryReader aBinaryReader, int aVersion) { if (aVersion >= 100) { isCompleted = aBinaryReader.ReadBoolean(); hint = (LevelHint)aBinaryReader.ReadInt32(); } }
public int GetAmount(LevelHint aHintType) { for (int i = 0; i < hints.Count; i++) { if (hints[i].type == aHintType) { return(hints[i].amount); } } return(0); }
public int GetCoins(LevelHint aHintType) { for (int i = 0; i < hints.Count; i++) { if (hints[i].type == aHintType) { return(hints[i].coins); } } return(0); }
public void Hint(LevelHint aLevelHint, bool aIsWithAnimation, float aDelay = 0f) { if (aLevelHint != 0 && !IsMarked) { hintType = aLevelHint; isHintParticle = aIsWithAnimation; if (!aIsWithAnimation) { HintEnded(); } Invoke("HintInvoke", aDelay); } }
public void ChangeAmount(LevelHint aHintType, int aAmount) { for (int i = 0; i < hints.Count; i++) { if (hints[i].type == aHintType) { hints[i].amount += aAmount; if (hints[i].amount < 0) { hints[i].amount = 0; } ELSingleton <ApplicationSettings> .Instance.Save(); } } }
public bool IsHintAvailable(LevelHint aHintType, int aLevelNumber) { for (int i = 0; i < hints.Count; i++) { if (hints[i].type == aHintType) { if (!hints[i].isAvailable && aLevelNumber >= ELSingleton <XmlSettings> .Instance.hintsConfig[i].level - 1) { hints[i].isAvailable = true; ELSingleton <ApplicationSettings> .Instance.Save(); } return(hints[i].isAvailable); } } return(false); }
private void HintButton(LevelHint aHintType) { if (state != State.Play || aHintType == LevelHint.None) { return; } if ((ELSingleton <HintManager> .Instance.GetAmount(aHintType) > 0 || (ELSingleton <HintManager> .Instance.GetCoins(aHintType) > 0 && ELSingleton <CoinsManager> .Instance.Coins >= ELSingleton <HintManager> .Instance.GetCoins(aHintType))) && board.Hint(aHintType)) { if (ELSingleton <HintManager> .Instance.GetAmount(aHintType) > 0) { ELSingleton <HintManager> .Instance.ChangeAmount(aHintType, -1); } else { ELSingleton <CoinsManager> .Instance.AddCoins(-ELSingleton <HintManager> .Instance.GetCoins(aHintType)); shopButton.AddCoins(-ELSingleton <HintManager> .Instance.GetCoins(aHintType)); } ELSingleton <AudioManager> .Instance.PlaySfx(soundHint); AnalyticsManager instance = ELSingleton <AnalyticsManager> .Instance; Dictionary <string, object> dictionary = new Dictionary <string, object>(); object value; switch (aHintType) { default: value = "none"; break; case LevelHint.Tip: value = "tip"; break; case LevelHint.Expose: value = "expose"; break; case LevelHint.StartAndFinish: value = "start_and_finish"; break; case LevelHint.GoodStart: value = "good_start"; break; } dictionary.Add("type", value); dictionary.Add("level", level.number + 1); instance.Event("hint_used", dictionary); } else if (ELSingleton <HintManager> .Instance.GetAmount(aHintType) == 0 && (ELSingleton <HintManager> .Instance.GetCoins(aHintType) < 0 || ELSingleton <CoinsManager> .Instance.Coins < ELSingleton <HintManager> .Instance.GetCoins(aHintType))) { ShopButton(); ELSingleton <AudioManager> .Instance.PlaySfx(soundButtonGeneral); } else { ELSingleton <AudioManager> .Instance.PlaySfx(soundButtonX); } goodStartButton.Setup(); startAndFinishButton.Setup(); exposeButton.Setup(); tipButton.Setup(); ELSingleton <TutorialWindow> .Instance.Hide(); }
public void Reset() { isCompleted = false; hint = LevelHint.None; }