Exemplo n.º 1
0
    public void Apply(Dictionary <LIGHT_TYPE, int> dic)
    {
        //resultLabel.text = GameData.Instance.gameInput;
        roundLabel.text = "R" + GameData.Instance.gameRound.ToString();
        //显示提示
        foreach (var item in dic)
        {
            for (int i = 0; i < item.Value; i++)
            {
                GameObject go = Instantiate(LightItemTemplate);
                go.SetActive(true);
                go.transform.parent = lightWidget.transform;

                lightItemList.Add(go);

                LightItemTemplate sc = go.GetComponent <LightItemTemplate>();
                sc.Apply(item);
                lightWidget.GetComponent <UIGrid>().repositionNow = true;
                lightWidget.GetComponent <UIGrid>().maxPerLine    = GameData.Instance.resultColumn;
                go.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f);

                go.GetComponent <TweenScale>().to = new Vector3(0.2f, 0.2f, 0.2f);;
            }
        }
        ShowCurResultItem();
    }
Exemplo n.º 2
0
    public IEnumerator ShowLight(Dictionary <LIGHT_TYPE, int> dictionary, GameObject go)
    {
        GameObject stageObj = go.transform.Find("StagePanel/stage_" + GameData.Instance.GameStage + "/ResultPanel/").gameObject;
        int        index    = 1;

        foreach (var item in dictionary)
        {
            for (int i = 0; i < item.Value; i++)
            {
                // Debug.LogError("item.Value " + item.Value);
                // Debug.LogError("i " + index);
                GameObject obj = stageObj.transform.Find("ResultItem_" + index).gameObject;
                obj.SetActive(true);
                LightItemTemplate sc = obj.GetComponent <LightItemTemplate>();
                sc.Apply(item);
                index++;

                /*  GameObject go = Instantiate(LightTemplate);
                 * go.SetActive(true);
                 * go.transform.parent = LightWidget.transform;
                 * go.transform.localPosition = Vector3.zero;
                 * go.transform.localScale = Vector3.one;
                 *
                 * LightItemTemplate sc = go.GetComponent<LightItemTemplate>();
                 * sc.Apply(item);
                 * LightWidget.GetComponent<UIGrid>().repositionNow = true;
                 * LightWidget.GetComponent<UIGrid>().maxPerLine = GameData.Instance.resultColumn;
                 * lightItemList.Add(go);
                 */
                NGUITools.PlaySound(showLightMusic, 0.1f);
                NGUITools.soundVolume = 1;
                yield return(new WaitForSeconds(0.1f));
            }
        }
    }
Exemplo n.º 3
0
    public IEnumerator ShowLight(Dictionary <LIGHT_TYPE, int> dictionary)
    {
        foreach (var item in dictionary)
        {
            for (int i = 0; i < item.Value; i++)
            {
                GameObject go = Instantiate(LightTemplate);
                go.SetActive(true);
                go.transform.parent        = LightWidget.transform;
                go.transform.localPosition = Vector3.zero;
                go.transform.localScale    = Vector3.one;

                LightItemTemplate sc = go.GetComponent <LightItemTemplate>();
                sc.Apply(item);
                LightWidget.GetComponent <UIGrid>().repositionNow = true;
                LightWidget.GetComponent <UIGrid>().maxPerLine    = GameData.Instance.resultColumn;
                lightItemList.Add(go);
                NGUITools.PlaySound(showLightMusic, 0.1f);
                NGUITools.soundVolume = 1;
                yield return(new WaitForSeconds(0.1f));
            }
        }
    }