Esempio n. 1
0
    public void show(ByteBuffer buffer)
    {
        if (bank_account_pref == null)
        {
            bank_account_pref = Resources.Load <GameObject>("prefabs/look-bank-account");
        }
        if (address_account_pref == null)
        {
            address_account_pref = Resources.Load <GameObject>("prefabs/look-address");
        }
        gameObject.SetActive(true);
        string        icon_str   = buffer.ReadString();
        string        nikeName   = buffer.ReadString();
        string        signature  = buffer.ReadString();
        string        title      = buffer.ReadString();
        string        registTime = buffer.ReadString();
        List <string> addresses  = new List <string>();
        int           size       = buffer.ReadInt();

        for (int i = 0; i < size; i++)
        {
            string address = buffer.ReadString();
            addresses.Add(address);
        }
        string name = buffer.ReadString();

        cur_tel_str = buffer.ReadString();
        MainData.BankAccount bacnkAccount = new MainData.BankAccount();
        bacnkAccount.deserialize(buffer);
        buffer.ReadString();
        buffer.ReadString();
        buffer.ReadString();
        string    totalDealVale = buffer.ReadString();
        int       hp            = buffer.ReadInt();
        int       zp            = buffer.ReadInt();
        int       cp            = buffer.ReadInt();
        Transform body          = transform.FindChild("scroll").FindChild("body");

        body.localPosition = Vector3.zero;
        body.GetComponent <UIPanel>().clipOffset = Vector2.zero;
        Transform container = body.FindChild("container");
        UISprite  icon      = container.FindChild("icon").GetComponent <UISprite>();

        icon.spriteName = icon_str;
        UILabel label = container.FindChild("nikeName").GetComponent <UILabel>();

        label.text = nikeName;
        label      = container.FindChild("signature").FindChild("value").GetComponent <UILabel>();
        label.text = signature;
        label      = container.FindChild("title").FindChild("value").GetComponent <UILabel>();
        label.text = title;
        label      = container.FindChild("registTime").FindChild("value").GetComponent <UILabel>();
        string[] ss  = registTime.Split(" "[0]);
        string[] ssy = ss[0].Split("-"[0]);
        label.text = ssy[0] + "年" + ssy[1] + "月" + ssy[2] + "日";
        Transform address_trans = container.FindChild("address");

        label = address_trans.FindChild("value").GetComponent <UILabel>();
        DownOpenLink adress_open_link = address_trans.GetComponent <DownOpenLink>();
        GameObject   address_suns     = address_trans.FindChild("suns").gameObject;

        address_suns.SetActive(false);
        if (addresses.Count == 0)
        {
            label.text = "保密";
            address_trans.FindChild("down").gameObject.SetActive(false);
            address_trans.FindChild("up").gameObject.SetActive(false);
        }
        else
        {
            label.text = "已设置" + addresses.Count + "个地址";
            address_trans.FindChild("down").gameObject.SetActive(true);
            address_trans.FindChild("up").gameObject.SetActive(false);
            MyUtilTools.clearChild(address_suns.transform);
            float y = 0;
            for (int i = 0; i < addresses.Count; i++)
            {
                GameObject look_address = NGUITools.AddChild(address_suns, address_account_pref);
                look_address.name = "look_address" + i;
                UILabel bank_value = look_address.transform.FindChild("value").GetComponent <UILabel>();
                bank_value.text = addresses[i];
                look_address.transform.localPosition = new Vector3(0, y, 0);
                y -= 100;
            }
            adress_open_link.offset = -y - 10;
        }
        label      = container.FindChild("name").FindChild("value").GetComponent <UILabel>();
        label.text = name;
        label      = container.FindChild("tel").FindChild("value").GetComponent <UILabel>();
        label.text = cur_tel_str;
        Transform tel_trans = container.FindChild("tel").FindChild("call");

        if (cur_tel_str.Equals("保密"))
        {
            tel_trans.gameObject.SetActive(false);
        }
        else
        {
            tel_trans.gameObject.SetActive(true);
            UIButton tel_button = tel_trans.GetComponent <UIButton>();
            tel_button.onClick.Clear();
            tel_button.onClick.Add(new EventDelegate(telphone));
        }
        Transform  bank_trans    = container.FindChild("bank");
        UILabel    account_label = bank_trans.FindChild("value").GetComponent <UILabel>();
        GameObject bank_suns     = bank_trans.FindChild("suns").gameObject;

        bank_suns.SetActive(false);
        DownOpenLink bank_open_link = bank_trans.GetComponent <DownOpenLink>();

        if (bacnkAccount.names.Count == 0)
        {
            account_label.text = "未绑定银行卡";
            bank_trans.FindChild("down").gameObject.SetActive(false);
            bank_trans.FindChild("up").gameObject.SetActive(false);
        }
        else
        {
            account_label.text = "已绑定" + bacnkAccount.names.Count + "张";
            bank_trans.FindChild("down").gameObject.SetActive(true);
            bank_trans.FindChild("up").gameObject.SetActive(false);
            MyUtilTools.clearChild(bank_suns.transform);
            float y = 0;
            for (int i = 0; i < bacnkAccount.names.Count; i++)
            {
                GameObject look_account = NGUITools.AddChild(bank_suns, bank_account_pref);
                look_account.name = "look_account" + i;
                UILabel bank_value = look_account.transform.FindChild("name").FindChild("value").GetComponent <UILabel>();
                bank_value.text = bacnkAccount.names[i];
                bank_value      = look_account.transform.FindChild("account").FindChild("value").GetComponent <UILabel>();
                bank_value.text = bacnkAccount.accounts[i];
                bank_value      = look_account.transform.FindChild("openAddress").FindChild("value").GetComponent <UILabel>();
                bank_value.text = bacnkAccount.openAddresses[i];
                bank_value      = look_account.transform.FindChild("openNames").FindChild("value").GetComponent <UILabel>();
                bank_value.text = bacnkAccount.openNames[i];
                look_account.transform.localPosition = new Vector3(0, y, 0);
                y -= 420;
            }
            bank_open_link.offset = -y - 30;
        }
        Transform deal_trans = container.FindChild("deal-info");
        UILabel   deal_value = deal_trans.FindChild("deal-value").FindChild("Label").GetComponent <UILabel>();

        deal_value.text = totalDealVale;
        UILabel hp_value = deal_trans.FindChild("hp").FindChild("Label").GetComponent <UILabel>();

        hp_value.text = hp + "";
        UILabel zp_value = deal_trans.FindChild("zp").FindChild("Label").GetComponent <UILabel>();

        zp_value.text = zp + "";
        UILabel cp_value = deal_trans.FindChild("cp").FindChild("Label").GetComponent <UILabel>();

        cp_value.text = cp + "";
    }
Esempio n. 2
0
    public void OnlyPop(string title_str, MainData.BankAccount accounts)
    {
        if (pre_text_label == null)
        {
            pre_text_label = Resources.Load <GameObject>("prefabs/textLabel");
        }
        panel.alpha = 0.1f;
        gameObject.SetActive(true);
        CameraUtil.push(5, 3);
        if (title_str != null)
        {
            UILabel label_title = transform.FindChild("up").FindChild("title").GetComponentInChildren <UILabel>();
            label_title.text = title_str;
        }
        UITexture back = transform.FindChild("back").GetComponent <UITexture>();

        if (accounts.names.Count > 16)
        {//需要滚屏
            back.height = 820;
            int len = 50;
            if (pre_container == null)
            {
                pre_container = Resources.Load <GameObject>("prefabs/popup-container");
            }
            GameObject ob_temp = NGUITools.AddChild(transform.FindChild("container").gameObject, pre_container);
            ob_temp.name = "body";
            ob_temp.transform.localPosition = new Vector3(0, -40, 0);
            GameObject container = ob_temp.transform.FindChild("container").gameObject;
            float      start     = 320;
            for (int i = 0; i < accounts.names.Count; i++)
            {
                GameObject sun = NGUITools.AddChild(container, pre_text_label);
                sun.name = "sun" + i;
                sun.transform.localPosition = new Vector3(-325, start, 0);
                UILabel label = sun.GetComponent <UILabel>();
                label.text      = accounts.names[i] + ":" + accounts.accounts[i];
                label.alignment = NGUIText.Alignment.Center;
                label.width     = 650;
                label.height    = 40;
                label.color     = Color.black;
                start          -= len;
            }
            scroll_drag.scrollView = ob_temp.GetComponent <UIScrollView>();
        }
        else
        {
            GameObject container = transform.FindChild("container").gameObject;
            int        space     = 50;
            back.height = 100 + accounts.names.Count * space;
            float start = accounts.names.Count / 2 * space - (accounts.names.Count % 2 == 0 ? space : space / 2) - 20;
            for (int i = 0; i < accounts.names.Count; i++)
            {
                GameObject sun = NGUITools.AddChild(container, pre_text_label);
                sun.name = "sun" + i;
                sun.transform.localPosition = new Vector3(-325, start, 0);
                UILabel label = sun.GetComponent <UILabel>();
                label.text      = accounts.names[i] + ":" + accounts.accounts[i];
                label.alignment = NGUIText.Alignment.Center;
                label.width     = 650;
                label.height    = 40;
                label.color     = Color.black;
                start          -= space;
            }
        }
    }