void Awake() { if (plate == null) { plate = transform.GetComponent <UIPlate>(); } ; }
public void InitData(ArithmeticQuestion arithmeticQuestion) { if (arithmeticQuestion == null) { return; } InitObject(); curQuestionData.answerList.Clear(); string tmpStr = arithmeticQuestion.OptionContent; string[] str = tmpStr.Split(','); for (int i = 0; i < str.Length; i++) { curQuestionData.answerList.Add(int.Parse(str[i])); } for (int i = 0; i < arithmeticQuestion.ItemList.Count; i++) { switch (i) { case 0: curQuestionData.rightOne = arithmeticQuestion.ItemList[i].Expression; break; case 1: curQuestionData.rightTwo = arithmeticQuestion.ItemList[i].Expression; break; } } curQuestionData.result = curQuestionData.rightOne + curQuestionData.rightTwo; if (originPlate != null && originTitle != null) { DestoryPlate(); for (int i = 0; i < curQuestionData.answerList.Count; i++) { GameObject go = (GameObject)Instantiate(originPlate); go.transform.parent = MoveObject.transform; go.transform.localRotation = Quaternion.identity; go.transform.localScale = Vector3.one; UIPlate plate = go.transform.GetComponent <UIPlate>(); if (plate != null) { plateList.Add(plate); } go = (GameObject)Instantiate(originTitle); go.transform.parent = titleObject.transform; go.transform.localRotation = Quaternion.identity; go.transform.localScale = Vector3.one; UITitle title = go.transform.GetComponent <UITitle>(); if (title != null) { titleList.Add(title); } } SetPlatePosition(); } }
void OnDrop(GameObject go) { UIPlate plate = go.transform.GetComponent <UIPlate>(); if (plate != null) { plate.ResetPostion(true); } }
void OnDrop(GameObject go) { if (go.transform.GetComponent <UIPlate>()) { UIPlate plate = go.transform.GetComponent <UIPlate>(); plate.backSprite.depth = 6; plate.icon.depth = 7; plate.ResetPostion(true); if (!UIArithmeticGuideManager.isGuide) { if (UIArithmeticGuideManager.Instance != null) { UIArithmeticGuideManager.Instance.PlayWrongDragAudio(); } } } }
void OnDrop(GameObject go) { if (go.transform.GetComponent <UIPlate>()) { UIPlate plate = go.transform.GetComponent <UIPlate>(); plate.backSprite.depth = 6; plate.icon.depth = 7; if (plate.icon != null) { plate.icon.transform.parent = this.transform; plate.icon.transform.localPosition = Vector3.zero; plate.icon.alpha = 0; sprite = plate.icon; this.plate = plate; if (plate.data.answer == UIPlateManager.instance.curQuestionData.rightOne || plate.data.answer == UIPlateManager.instance.curQuestionData.rightTwo) { plate.ResetPostion(false); plate.SetColliderEnable(false); SetCollierEnable(false); Invoke("SetSpriteRightBack", 0.2f); if (PlayMonsterAnimations.instance != null) { PlayMonsterAnimations.instance.PlayEatAnimation(); } } else { plate.ResetPostion(true); SetCollierEnable(false); plate.SetColliderEnable(false); Invoke("SetSpriteWrongBack", 0.2f); if (PlayMonsterAnimations.instance != null) { PlayMonsterAnimations.instance.PlayEatAnimation(); } } } } }
void OnDrop(GameObject go) { if(go.transform.GetComponent<UIPlate>()) { UIPlate plate = go.transform.GetComponent<UIPlate>(); plate.backSprite.depth = 6; plate.icon.depth = 7; if(plate.icon != null) { plate.icon.transform.parent = this.transform; plate.icon.transform.localPosition = Vector3.zero; plate.icon.alpha = 0; sprite = plate.icon; this.plate = plate; if(plate.data.answer == UIPlateManager.instance.curQuestionData.rightOne || plate.data.answer == UIPlateManager.instance.curQuestionData.rightTwo) { plate.ResetPostion(false); plate.SetColliderEnable(false); SetCollierEnable(false); Invoke("SetSpriteRightBack",0.2f); if(PlayMonsterAnimations.instance != null) { PlayMonsterAnimations.instance.PlayEatAnimation(); } }else{ plate.ResetPostion(true); SetCollierEnable(false); plate.SetColliderEnable(false); Invoke("SetSpriteWrongBack",0.2f); if(PlayMonsterAnimations.instance != null) { PlayMonsterAnimations.instance.PlayEatAnimation(); } } } } }
void Awake() { if (plate == null) plate = transform.GetComponent<UIPlate>();; }