123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- using System;
- public class UICoupones : MonoBehaviour {
- // Use this for initialization
- public List<GameObject> items = new List<GameObject>();
- public GameObject CouponePrefab;
- public Transform Scroll;
- public UIButton BackButton;
- void Start()
- {
- BackButton.onClick.Add(new EventDelegate(OnBack));
- }
- private void OnBack()
- {
- NGUIMenuScript.Instance.ShowMenu(NGUIMenuScript.NGUIMenus.Menu);
- NGUIMenuScript.Instance.CloseMenu(NGUIMenuScript.NGUIMenus.Coupones);
- }
- void OnEnable ()
- {
- CouponePrefab.SetActive(true);
- foreach (var item in items)
- {
- Destroy(item);
- }
- items.Clear();
- for (int i = 0; i < ServerGiftManager.Instance.Coupons.Count; i++)
- {
- var go = (GameObject)Instantiate(CouponePrefab);
- go.AddComponent<UIDragPanelContents>();
- go.transform.parent = Scroll.transform;
- go.transform.localScale = Vector3.one;
- go.transform.localPosition = new Vector3(0,0,-0.5f);
- go.GetComponent<UIButtonCouponeInfo>().Rename(ServerGiftManager.Instance.Coupons[i].name);
- go.GetComponent<UIButtonCouponeInfo>().CouponeIndex= i;
- go.GetComponent<UIButton>().onClick.Add(new EventDelegate(OnCoupone));
- items.Add(go);
- Scroll.GetComponent<UIGrid>().repositionNow = true;
- }
- CouponePrefab.SetActive(false);
- }
-
- private void OnCoupone()
- {
- NGUIMenuScript.Instance.ShowMenu(NGUIMenuScript.NGUIMenus.CouponeGet);
- NGUIMenuScript.Instance.CloseMenu(NGUIMenuScript.NGUIMenus.Coupones);
- //NGUIMenuScript.Instance.UiGetCoupone.CouponeInit(couponInfo);
- }
- /*private static EventDelegate.Callback OnCoupone(ServerGiftManager.CouponInfo couponInfo)
- {
-
-
- return NGUIMenuScript.Instance.UiGetCoupone.CouponeInit(couponInfo);
- }*/
- // Update is called once per frame
- void Update () {
-
- }
- }
|