示例#1
0
    void InitScroll()
    {
        var speakList = new List <string>(); // MyDebug.list;

        for (int i = MyDebug.list.Count - 1; i >= 0; i--)
        {
            speakList.Add(MyDebug.list[i]);
        }

        scrollRect.onValueChanged.AddListener(OnValueChange);
        myScrollRect.createitemobject = delegate(int index, UnityAction <GameObject> action)
        {
            if (rankItem != null)
            {
                var cellObj = Instantiate(rankItem.gameObject);
                var handler = action;
                if (handler != null)
                {
                    handler(cellObj);
                }
            }
        };
        myScrollRect.updateItem = delegate(ItemCell o, int index)
        {
            o.item.GetComponent <Text>().text = speakList[index];
        };
        myScrollRect.Init(speakList.Count);
    }
示例#2
0
 void InitScroll()
 {
     scrollRect.onValueChanged.AddListener(OnValueChange);
     myScrollRect.createitemobject = delegate(int index, UnityAction <GameObject> action)
     {
         if (talkItem != null)
         {
             GameObject cellObj = Instantiate(talkItem.gameObject);
             action(cellObj);
         }
     };
     myScrollRect.updateItem = delegate(ItemCell o, int index)
     {
         o.item.GetComponent <TalkItem>().Init(speakList[index], CloseUI);
     };
     myScrollRect.Init(speakList.Count);
 }
示例#3
0
 /// <summary>
 /// 生成战绩下拉列表
 /// </summary>
 void InitRoundScroll()
 {
     roundscrollRect.onValueChanged.AddListener(roundScrollRect.OnValueChange);
     roundScrollRect.createitemobject = delegate(int index, UnityAction <GameObject> action)
     {
         if (roundrecordItem != null)
         {
             GameObject cellObj = Instantiate(roundrecordItem.gameObject);
             action(cellObj);
         }
     };
     roundScrollRect.updateItem = delegate(ItemCell o, int index)
     {
         o.item.GetComponent <RecordButton>().SetroundScore(roundList[index], index);
     };
     roundScrollRect.Init(roundList.Count);
 }
示例#4
0
 void InitScroll()
 {
     speakList = TalkDataManager.Instance.list;
     scrollRect.onValueChanged.AddListener(OnValueChange);
     myScrollRect.createitemobject = delegate(int index, UnityAction <GameObject> action)
     {
         if (rankItem != null)
         {
             GameObject cellObj = Instantiate(rankItem.gameObject);
             action(cellObj);
         }
     };
     myScrollRect.updateItem = delegate(ItemCell o, int index)
     {
         o.item.transform.Find("Text").GetComponent <Text>().text = speakList[index].message;
         o.item.GetComponent <TalkButton>().id = speakList[index].id;
     };
     myScrollRect.Init(speakList.Count);
 }
示例#5
0
    void Win()
    {
        myScrollRect.gameObject.transform.localPosition = new Vector3(myScrollRect.gameObject.transform.localPosition.x,
                                                                      0, myScrollRect.gameObject.transform.localPosition.z);
        scrollRect.inertia = false;
        win  = RankManager.Instance.Win;
        list = new List <int>(win.Keys);
        scrollRect.onValueChanged.AddListener(OnValueChange);
        myScrollRect.createitemobject = delegate(int index, UnityAction <GameObject> action)
        {
            if (rankItem != null)
            {
                GameObject cellObj = Instantiate(rankItem.gameObject);
                action(cellObj);
            }
        };
        myScrollRect.updateItem = delegate(ItemCell o, int index)
        {
            switch (index)
            {
            case 0:
                ResourcesLoader.Load <Sprite>("BaseAssets/UI_Online/Game/UIPanel_Rank/rank_first", (sprite) => {
                    o.item.GetComponentsInChildren <Image>()[1].overrideSprite = sprite;
                });

                //o.item.GetComponentsInChildren<Image>()[1].sprite =
                //    Resources.Load("Image/rank_first", typeof(Sprite)) as Sprite;
                o.item.GetComponentsInChildren <Image>()[1].enabled = true;
                o.item.GetComponentsInChildren <Text>()[0].enabled  = false;
                break;

            case 1:
                ResourcesLoader.Load <Sprite>("BaseAssets/UI_Online/Game/UIPanel_Rank/rank_scend", (sprite) => {
                    o.item.GetComponentsInChildren <Image>()[1].overrideSprite = sprite;
                });

                //o.item.GetComponentsInChildren<Image>()[1].sprite =
                //Resources.Load("Image/rank_scend", typeof(Sprite)) as Sprite;
                o.item.GetComponentsInChildren <Image>()[1].enabled = true;
                o.item.GetComponentsInChildren <Text>()[0].enabled  = false;
                break;

            case 2:
                ResourcesLoader.Load <Sprite>("BaseAssets/UI_Online/Game/UIPanel_Rank/rank_third", (sprite) => {
                    o.item.GetComponentsInChildren <Image>()[1].overrideSprite = sprite;
                });

                //o.item.GetComponentsInChildren<Image>()[1].sprite =
                //Resources.Load("Image/rank_third", typeof(Sprite)) as Sprite;
                o.item.GetComponentsInChildren <Image>()[1].enabled = true;
                o.item.GetComponentsInChildren <Text>()[0].enabled  = false;
                break;

            default:
                o.item.GetComponentsInChildren <Image>()[1].enabled = false;
                o.item.GetComponentsInChildren <Text>()[0].enabled  = true;
                break;
            }

            o.item.GetComponentsInChildren <Text>()[0].text = list[index].ToString();
            o.item.GetComponentsInChildren <Text>()[1].text = win[list[index]].name;
            o.item.GetComponentsInChildren <Text>()[2].text = win[list[index]].winCount.ToString();
        };
        myScrollRect.Init(win.Count);
        scrollRect.inertia = true;
    }