Ejemplo n.º 1
0
 void Awake()
 {
     if (plate == null)
     {
         plate = transform.GetComponent <UIPlate>();
     }
     ;
 }
Ejemplo n.º 2
0
    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();
        }
    }
Ejemplo n.º 3
0
    void OnDrop(GameObject go)
    {
        UIPlate plate = go.transform.GetComponent <UIPlate>();

        if (plate != null)
        {
            plate.ResetPostion(true);
        }
    }
Ejemplo n.º 4
0
 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();
             }
         }
     }
 }
Ejemplo n.º 5
0
 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();
                 }
             }
         }
     }
 }
Ejemplo n.º 6
0
	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>();;
	}