예제 #1
0
    protected override void OnDragDropRelease(GameObject surface)
    {
        if (surface != null)
        {
            if (aau == null)
            {
                aau = gameObject.GetComponent <UI_AlternativeAnswerUnit>();
            }

            switch (surface.name)
            {
            case "Answer_Right":
                Debug.Log("设置正确答案");
                GameApp.Instance.HomePageUI.SetQuestionUI.SetAnswer(-1, aau.Name.text);
                break;

            case "Answer_Error_1":
                Debug.Log("设置错误答案1");
                GameApp.Instance.HomePageUI.SetQuestionUI.SetAnswer(0, aau.Name.text);
                break;

            case "Answer_Error_2":
                Debug.Log("设置错误答案2");
                GameApp.Instance.HomePageUI.SetQuestionUI.SetAnswer(1, aau.Name.text);
                break;

            case "Answer_Error_3":
                Debug.Log("设置错误答案3");
                GameApp.Instance.HomePageUI.SetQuestionUI.SetAnswer(2, aau.Name.text);
                break;
            }
        }

        base.OnDragDropRelease(surface);
    }
예제 #2
0
    private void RefreshAlternativeAnswerBg()
    {
        for (int i = 0; i < AlternativeGrid.transform.childCount; i++)
        {
            Transform child = AlternativeGrid.transform.GetChild(i);
            UI_AlternativeAnswerUnit aau = child.GetComponent <UI_AlternativeAnswerUnit>();
            aau.Bg.spriteName = "katonganniu_tuhuang";

            if (aau.Name.text == RightAnswerLab.text)
            {
                aau.Bg.spriteName = "katonganniu_lv";
            }
            for (int j = 0; j < ErrorAnswerLab.Length; j++)
            {
                if (aau.Name.text == ErrorAnswerLab[j].text)
                {
                    aau.Bg.spriteName = "katonganniu_juhuang";
                }
            }
        }
    }
예제 #3
0
    void RefreshAlternativeAnswerList()
    {
        MyTools.DestroyChildNodes(AlternativeGrid.transform);

        foreach (KeyValuePair <int, MagicCardConfig> pair in CsvConfigTables.Instance.MagicCardCsvDic)
        {
            if (pair.Value.SystemID == CurSystemID && pair.Value.ThemeID == CurThemeID)
            {
                GameObject newUnit = NGUITools.AddChild(AlternativeGrid.gameObject, AlternativeAnswerUnitPrefab);
                newUnit.SetActive(true);
                newUnit.name = "AlternativeAnswerUnit_" + pair.Key;

                UI_AlternativeAnswerUnit mc = newUnit.GetComponent <UI_AlternativeAnswerUnit>();
                mc.Set(pair.Value);

                AlternativeGrid.repositionNow = true;
            }
        }

        RefreshAlternativeAnswerBg();
    }