Exemple #1
0
    void _refresh(DealBody item, GameObject obj_suns)
    {
        MyUtilTools.clearChild(obj_suns.transform);
        float y = 0;

        for (int i = 0; i < item.reverts.Count; i++)
        {
            DealBody.Revert revert     = item.reverts[i];
            GameObject      obj_revert = NGUITools.AddChild(obj_suns, pref_revert_detail);
            obj_revert.name = "revert_" + i;
            obj_revert.transform.localPosition = new Vector3(0, y, 0);
            y -= revert.update(obj_revert);
            GameObject events = obj_revert.transform.FindChild("event").gameObject;
            for (int j = 0; j < events.transform.childCount; j++)
            {
                GameObject child = events.transform.GetChild(j).gameObject;
                child.SetActive(false);
            }
            if (MainData.instance.user.id == revert.uid)
            {
                Transform trans = events.transform.FindChild("revoke");
                trans.localPosition = new Vector3(-50, 0, 0);
                UIButton      button        = trans.GetComponent <UIButton>();
                EventDelegate event_delegat = new EventDelegate(this, "openDelRevert");
                event_delegat.parameters[0]     = new EventDelegate.Parameter();
                event_delegat.parameters[0].obj = new RevertDel(revert, "撤销");
                button.onClick.Add(event_delegat);
                trans.gameObject.SetActive(true);
            }
            else
            {
                Transform trans = events.transform.FindChild("look");
                trans.localPosition = new Vector3(-320, 0, 0);
                UIButton      button        = trans.GetComponent <UIButton>();
                EventDelegate event_delegat = new EventDelegate(this, "openLook");
                event_delegat.parameters[0]     = new EventDelegate.Parameter();
                event_delegat.parameters[0].obj = new LongParamter(item.id);
                event_delegat.parameters[1]     = new EventDelegate.Parameter();
                event_delegat.parameters[1].obj = new LongParamter(revert.uid);
                button.onClick.Add(event_delegat);
                trans.gameObject.SetActive(true);

                trans = events.transform.FindChild("revert");
                trans.localPosition = new Vector3(240, 0, 0);
                button        = trans.GetComponent <UIButton>();
                event_delegat = new EventDelegate(this, "openRevert");
                event_delegat.parameters[0]     = new EventDelegate.Parameter();
                event_delegat.parameters[0].obj = item;
                event_delegat.parameters[1]     = new EventDelegate.Parameter();
                event_delegat.parameters[1].obj = new LongParamter(revert.uid);
                button.onClick.Add(event_delegat);
                trans.gameObject.SetActive(true);
            }
        }
    }
Exemple #2
0
    void initLook(DealBody item)
    {
        transform.FindChild("base").gameObject.SetActive(false);
        GameObject look = transform.FindChild("look").gameObject;

        look.SetActive(true);
        if (lookContainer == null)
        {
            lookContainer = look.transform.FindChild("scroll").FindChild("body").FindChild("container").gameObject;
        }
        MyUtilTools.clearChild(lookContainer.transform);
        lookContainer.transform.parent.GetComponent <UIPanel>().clipOffset = Vector2.zero;
        lookContainer.transform.parent.localPosition = new Vector3(0, 0, 0);
        if (DealEvent.pref_detail == null)
        {
            DealEvent.pref_detail = Resources.Load <GameObject>("prefabs/deal-detail");
        }
        if (DealEvent.pref_revert_detail == null)
        {
            DealEvent.pref_revert_detail = Resources.Load <GameObject>("prefabs/revert-detail");
        }
        GameObject deal_obj = NGUITools.AddChild(lookContainer, DealEvent.pref_detail);

        deal_obj.name = "deal";
        deal_obj.transform.localPosition = new Vector3(0, 280, 0);
        item.insterItem(deal_obj, false);
        deal_obj.transform.FindChild("event").gameObject.SetActive(false);
        GameObject reverts = deal_obj.transform.FindChild("reverts").gameObject;
        float      y       = 0;

        for (int i = 0; i < item.reverts.Count; i++)
        {
            DealBody.Revert revert     = item.reverts[i];
            GameObject      revert_obj = NGUITools.AddChild(reverts, DealEvent.pref_revert_detail);
            revert_obj.transform.localPosition = new Vector3(0, y, 0);
            y -= revert.update(revert_obj, false);
            revert_obj.name = "revert_" + i;
            revert_obj.transform.FindChild("event").gameObject.SetActive(false);
        }
    }