Пример #1
0
        protected override void OnInit(object userData)
        {
            base.OnInit(userData);
            GUILink link = GetComponent <GUILink>();

            subMainKeyBoard = link.AddComponent <SubMainKeyBoard>("PanelJoinRoom");
            link.SetEvent("BtnSangong", UIEventType.Click, OnStartSangong);
            link.SetEvent("BtnShop", UIEventType.Click, OnShopClick);
            link.SetEvent("BtnJoinRoom", UIEventType.Click, OnJoinRoom);
            link.SetEvent("BtnClub", UIEventType.Click, OnOpenClub);
            link.SetEvent("BtnHistory", UIEventType.Click, OnOpenHistory);
            link.SetEvent("BtnRule", UIEventType.Click, OnOpenRule);
            link.SetEvent("BtnSurface", UIEventType.Click, OnOpenSurface);

            role = GameManager.Instance.GetRoleData();
            //string id = "user_id=" + role.id.Value;
            //string token = "access_token=" + role.token.Value;
            //long time = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000;
            //string timeStr = "timestamp=" + time.ToString();

            Recv_Get_MainPage mainPage = NetWorkManager.Instance.CreateGetMsg <Recv_Get_MainPage>(GameConst._mainPage,
                                                                                                  GameManager.Instance.GetSendInfoStringList <Send_Get_MainPage>(role.id.Value, role.token.Value));

            if (mainPage != null && mainPage.code == 0)
            {
                role.SetRoleProperty(mainPage.data);
            }
        }
Пример #2
0
    public bool RemoveEvent(string name, UIEventType ev, EventDelegate.Callback callback)
    {
        GUILink.UILink uILink = this.GetUILink(name);
        bool           result;

        if (uILink == null)
        {
            Debug.Log(string.Format("[GUILink] AddEvent object {0} is not exist", name));
            result = false;
        }
        else
        {
            UIEventTrigger uIEventTrigger = uILink.Get <UIEventTrigger>();
            if (uIEventTrigger == null)
            {
                result = false;
            }
            else
            {
                List <EventDelegate> delegateList = GUILink.GetDelegateList(uIEventTrigger, ev);
                result = (delegateList != null && EventDelegate.Remove(delegateList, callback));
            }
        }
        return(result);
    }
Пример #3
0
        protected override void OnInit(object userData)
        {
            base.OnInit(userData);
            GUILink link = GetComponent <GUILink>();

            link.SetEvent("ButtonClose", UIEventType.Click, OnClickExit);

            historyTextList = new List <HistoryText>();

            Text delta = link.Get <Text>("Text1");

            for (int i = 0; i < 6; i += 2)
            {
                HistoryText temp = new HistoryText();
                temp.count = link.Get <Text>("Text" + (i + 1));
                temp.score = link.Get <Text>("Text" + (i + 2));
                historyTextList.Add(temp);
            }

            historyItem = link.Get <HistoryItem>("HistoryItem");
            historyItem.SetActive(false);
            itemList = new List <HistoryItem>();

            link.SetEvent("ButtonLeft", UIEventType.Click, _ => ChangeHistoryPage(-1));
            link.SetEvent("ButtonRight", UIEventType.Click, _ => ChangeHistoryPage(1));

            pageHistoryList = new Dictionary <int, List <HistorySingleBaseData> >();
        }
Пример #4
0
        protected override void OnInit(object userData)
        {
            base.OnInit(userData);
            GUILink link = GetComponent <GUILink>();

            TextContent = link.Get <Text>("TextContent");
            TextPsd     = link.Get("TextPsd");
            TextTitle   = link.Get("TextTitle");
            for (int i = 0; i < 10; i++)
            {
                int index = i;
                link.SetEvent("Button" + i, UIEventType.Click, x =>
                {
                    if (inputText.Value == -1)
                    {
                        inputText.Value = index;
                    }
                    else if (inputText.Value < 1000)
                    {
                        inputText.Value = inputText.Value * 10 + index;
                    }
                });
            }

            link.SetEvent("ButtonOK", UIEventType.Click, ClickOk);
            link.SetEvent("ButtonDel", UIEventType.Click, ClickDel);
            link.SetEvent("ButtonClose", UIEventType.Click, _ => { OnClose(null); });
        }
Пример #5
0
    public EventDelegate SetEvent(string name, UIEventType ev, EventDelegate.Callback callback, float interval = 0f)
    {
        GUILink.UILink uILink = this.GetUILink(name);
        EventDelegate  result;

        if (uILink == null)
        {
            Debug.Log(string.Format("[GUILink] AddEvent object {0} is not exist", name));
            result = null;
        }
        else
        {
            UIEventTrigger uIEventTrigger = uILink.Get <UIEventTrigger>();
            if (null == uIEventTrigger)
            {
                uIEventTrigger = uILink.Add <UIEventTrigger>();
            }
            List <EventDelegate> delegateList = GUILink.GetDelegateList(uIEventTrigger, ev);
            if (delegateList != null)
            {
                result = EventDelegate.Set(delegateList, callback, interval);
            }
            else
            {
                result = null;
            }
        }
        return(result);
    }
Пример #6
0
    public override void OnInspectorGUI()
    {
        GUILink link = target as GUILink;

        GUI.changed = false;
        if (link.Links != null)
        {
            RegisterUndo("GUILink Change", link);
            for (int i = 0; i < link.Links.Count; i++)
            {
                GUILink.UILink uilink  = link.Links[i];
                GameObject     linkobj = uilink.LinkObj;

                if (!linkobj)
                {
                    uilink.Name = errostr;
                    continue;
                }
                if (linkobj)
                {
                    if (string.IsNullOrEmpty(uilink.Name) || uilink.Name == errostr)
                    {
                        uilink.Name = linkobj.name;
                    }
                    if (!uilink.component || uilink.component.gameObject != linkobj.gameObject)
                    {
                        uilink.component = linkobj.gameObject.GetComponent <MonoBehaviour>();
                    }
                }
            }
            EditorUtility.SetDirty(link);
        }
        base.OnInspectorGUI();
    }
Пример #7
0
        protected override void OnInit(object userData)
        {
            base.OnInit(userData);
            GUILink link = GetComponent <GUILink>();

            link.SetEvent("ButtonClose", UIEventType.Click, OnClickExit);
            link.SetEvent("ButtonCreate", UIEventType.Click, OnCreateRoom);
        }
Пример #8
0
        protected override void OnInit(object userData)
        {
            base.OnInit(userData);
            GUILink link = GetComponent <GUILink>();

            TextScore = link.Get <Text>("TextScore");
            slider    = link.Get <Slider>("Slider");
            link.SetEvent("ButtonOK", UIEventType.Click, OnButtonOK);
            link.SetEvent("ButtonClose", UIEventType.Click, OnButtonClose);
        }
Пример #9
0
        protected override void OnInit(object userData)
        {
            base.OnInit(userData);
            GUILink link = GetComponent <GUILink>();

            link.SetEvent("Start", UIEventType.Click, OnStartButtonClick);
            link.SetEvent("Quit", UIEventType.Click, OnQuitButtonClick);

            Textrecv = link.Get <Text>("Textrecv");
            Textsend = link.Get <Text>("Textsend");
        }
Пример #10
0
        protected override void OnInit(object userData)
        {
            base.OnInit(userData);
            GUILink link = GetComponent <GUILink>();

            textName  = link.Get <Text>("TextName");
            textId    = link.Get <Text>("TextID");
            textToken = link.Get <Text>("TextTicket");
            textMoney = link.Get <Text>("textMoney");
            icon      = link.Get <Image>("headicon");
            //link.SetEvent("BtnSangong", UIEventType.Click, OnStartSangong);
        }
Пример #11
0
    protected override void OnInit(object userData)
    {
        base.OnInit(userData);

        GUILink link = GetComponent <GUILink>();

        text_id    = link.Get <Text>("id_Text");
        text_name  = link.Get <Text>("name_Text");
        text_info  = link.Get <Text>("info_Text");
        text_vip   = link.Get <Text>("vip_Text");
        text_count = link.Get <Text>("count_Text");
    }
Пример #12
0
    protected override void OnInit(object userData)
    {
        base.OnInit(userData);

        GUILink link = this.gameObject.GetComponent <GUILink>();

        id    = link.Get <Text>("id");
        name  = link.Get <Text>("name");
        owner = link.Get <Text>("owner");

        link.SetEvent("goodButton", UIEventType.Click, _ => OnClick());
    }
Пример #13
0
        protected override void OnInit(object userData)
        {
            base.OnInit(userData);
            GUILink link = GetComponent <GUILink>();

            goodsItem = link.Get <GoodItem>("GoodInfo");
            goodsItem.SetActive(false);
            goodsList = new List <GoodItem>();

            link.SetEvent("ButtonClose", UIEventType.Click, OnClickExit);

            RefreshGoods();
        }
Пример #14
0
    protected override void OnInit(object userData)
    {
        base.OnInit(userData);

        GUILink link = this.gameObject.GetComponent <GUILink>();

        idstr = link.Get <Text>("Name");
        name  = link.Get <Text>("Num");
        icon  = link.Get <Image>("Image");
        price = link.Get <Text>("Price");

        //link.SetEvent("goodButton", UIEventType.Click, _ => OnClick());
    }
Пример #15
0
        protected override void OnInit(object userData)
        {
            base.OnInit(userData);
            GUILink link = GetComponent <GUILink>();

            panelWeixin = link.Get("PanelSurface");
            panelRule   = link.Get("PanelRule");
            titleName   = link.Get <Text>("TextName");

            content   = link.Get <Text>("TextDesc");
            container = link.Get <RectTransform>("Content");

            link.SetEvent("ButtonClose", UIEventType.Click, OnClickExit);
        }
Пример #16
0
    protected override void OnInit(object userData)
    {
        base.OnInit(userData);

        GUILink link = this.gameObject.GetComponent <GUILink>();

        id        = link.Get <Text>("Textid");
        room_name = link.Get <Text>("Textname");
        club_name = link.Get <Text>("Textclub");
        score     = link.Get <Text>("Textscore");
        type      = link.Get <Text>("Texttype");

        index = 0;
    }
Пример #17
0
    protected override void OnInit(object userData)
    {
        base.OnInit(userData);

        GUILink link = this.gameObject.GetComponent <GUILink>();

        textId      = link.Get <Text>("TextId");
        textName    = link.Get <Text>("TextName");
        textScore   = link.Get <Text>("TextScore");
        textNum     = link.Get <Text>("TextNum");
        textSeatNum = link.Get <Text>("TextSeatNum");

        index = 0;
    }
Пример #18
0
    protected override void OnInit(object userData)
    {
        base.OnInit(userData);

        GUILink link = GetComponent <GUILink>();

        link.SetEvent("Create", UIEventType.Click, OnCreateClub);
        btnMyClub = link.Get <Button>("My");
        link.SetEvent("My", UIEventType.Click, OnMyClub);

        searchItem = link.AddComponent <ClubSearchItem>("ClubInfo");
        searchItem.SetActive(false);

        searchItemList = new List <ClubSearchItem>();
    }
Пример #19
0
    protected override void OnInit(object userData)
    {
        base.OnInit(userData);

        GUILink link = this.gameObject.GetComponent <GUILink>();

        id     = link.Get <Text>("id");
        name   = link.Get <Text>("name");
        result = link.Get <Text>("result");

        link.SetEvent("accept", UIEventType.Click, _ => SetRequestClick(true));
        link.SetEvent("refuse", UIEventType.Click, _ => SetRequestClick(false));

        index = 0;
    }
Пример #20
0
    protected override void OnInit(object userData)
    {
        base.OnInit(userData);

        GUILink link = this.gameObject.GetComponent <GUILink>();

        idstr    = link.Get <Text>("id");
        nameStr  = link.Get <Text>("name");
        ownerStr = link.Get <Text>("owner");
        result   = link.Get <Text>("Result");
        handle   = link.Get <Button>("btnJoin");

        link.SetEvent("btnJoin", UIEventType.Click, OnClickJoin);

        //link.SetEvent("goodButton", UIEventType.Click, _ => OnClick());
    }
Пример #21
0
        public bool RemoveEvent(UIEventType ev, EventDelegate.Callback callback)
        {
            UIEventTrigger uIEventTrigger = base.gameObject.GetComponent(typeof(UIEventTrigger)) as UIEventTrigger;
            bool           result;

            if (uIEventTrigger == null)
            {
                result = false;
            }
            else
            {
                List <EventDelegate> delegateList = GUILink.GetDelegateList(uIEventTrigger, ev);
                result = (delegateList != null && EventDelegate.Remove(delegateList, callback));
            }
            return(result);
        }
Пример #22
0
    protected override void OnInit(object userData)
    {
        base.OnInit(userData);

        GUILink link = GetComponent <GUILink>();

        for (int i = 0; i < tabStr.Length; i++)
        {
            Toggle temp = link.Get <Toggle>(tabStr[i]);
            toggleList.Add(temp);

            int index = i;
            link.SetEvent(tabStr[i], UIEventType.Click, _ => OnClickChange(index));
        }

        curIndex = 0;
    }
Пример #23
0
    protected override void OnInit(object userData)
    {
        base.OnInit(userData);

        GUILink link = this.gameObject.GetComponent <GUILink>();

        id             = link.Get <Text>("id");
        name           = link.Get <Text>("name");
        headIcon       = link.Get <Image>("head");
        result         = link.Get <Text>("result");
        result.enabled = false;

        btnrefuse = link.Get <Button>("refuse");
        btnaccept = link.Get <Button>("accept");
        link.SetEvent("refuse", UIEventType.Click, _ => OnHandleRequest(false));
        link.SetEvent("accept", UIEventType.Click, _ => OnHandleRequest(true));
    }
Пример #24
0
    protected override void OnInit(object userData)
    {
        base.OnInit(userData);

        GUILink link = GetComponent <GUILink>();

        for (int i = 0; i < toggleStr.Length; i++)
        {
            Button temp = link.Get <Button>(toggleStr[i]);
            toggleList.Add(temp);

            Text tempText = link.Get <Text>("Text_" + i);
            labelList.Add(tempText);

            int index = i;
            link.SetEvent(toggleStr[i], UIEventType.Click, _ => OnClickChange(index));
        }

        link.SetEvent("ButtonBack", UIEventType.Click, BackToSearch);

        //panelInfoList = link.AddComponent<SubPanelClubInfoList>("Page");
        panelInfo = link.AddComponent <subPanelBaseClubInfo>("PanelBaseInfo");

        SubChildPanelMember childMember = link.AddComponent <SubChildPanelMember>("PanelMembers");

        childPanelList.Add(childMember);
        SubChildPanelGames childGame = link.AddComponent <SubChildPanelGames>("PanelGames");

        childPanelList.Add(childGame);
        SubChildPanelRequest childRequest = link.AddComponent <SubChildPanelRequest>("PanelRequest");

        childPanelList.Add(childRequest);

        for (int i = 0; i < toggleInfoStr.Length; i++)
        {
            Toggle temp = link.Get <Toggle>(toggleInfoStr[i]);
            toggleInfoList.Add(temp);

            int index = i;
            link.SetEvent(toggleInfoStr[i], UIEventType.Click, _ => OnClickInfoPanelChange(index));
        }

        curIndex      = 0;
        curChildIndex = 0;
    }
Пример #25
0
    protected override void OnInit(object userData)
    {
        base.OnInit(userData);

        GUILink link = this.gameObject.GetComponent <GUILink>();

        head        = link.Get <Image>("Head");
        textId      = link.Get <Text>("TextId");
        textName    = link.Get <Text>("TextName");
        textManager = link.Get <Text>("TextManager");

        handle = link.Get <Button>("ButtonHandle");
        link.SetEvent("ButtonHandle", UIEventType.Click, OnDeleteMember);
        btnSetManager = link.Get <Text>("TextSetManager");
        link.SetEvent("ButtonManager", UIEventType.Click, OnSetManager);

        index = 0;
    }
Пример #26
0
    private static void AddGameObjectToLink()
    {
        UnityEngine.GameObject select = Selection.activeGameObject;
        if (select == null)
        {
            return;
        }
        if (!select.activeInHierarchy)
        {
            Debug.LogError(string.Format("【GUILink】自动添加对象失败:请先激活需要添加的对象和GUILink对象", select.name), select);
            return;
        }

        GUILink link = FindInParents <GUILink>(select.transform);

        if (link == null)
        {
            Debug.LogError(string.Format("【GUILink】自动添加对象失败:{0}父节点无GUILink组件", select.name), select);
            return;
        }

        if (link.gameObject == select && select.transform.parent != null)
        {
            link = FindInParents <GUILink>(select.transform.parent);
        }
        if (link == null)
        {
            Debug.LogError(string.Format("【GUILink】自动添加对象失败:{0}父节点无GUILink组件", select.name), select);
            return;
        }
        link.ReBuildLinkMap();
        if (link.Get(select.name) == null)
        {
            GUILink.UILink item = new GUILink.UILink();
            item.Name    = select.name;
            item.LinkObj = select;
            link.Links.Add(item);
            Debug.Log(string.Format("【GUILink】自动添加对象成功:{0}  GUILink:{1}", select.name, link.name), link);
        }
        else
        {
            Debug.LogError(string.Format("【GUILink】自动添加对象失败:已经存在重复名字{0}的对象  GUILink:{1}", select.name, link.name), link);
        }
    }
Пример #27
0
    protected override void OnInit(object userData)
    {
        base.OnInit(userData);

        GUILink link = GetComponent <GUILink>();

        name = link.Get <InputField>("nameInputField");
        name.onValueChanged.AddListener(NameChange);
        info = link.Get <InputField>("infoInputField");
        info.onValueChanged.AddListener(InfoChange);
        Search = link.Get <Dropdown>("Dropdown");
        Search.onValueChanged.AddListener(BeReachChange);

        nameStr    = "";
        infoStr    = "";
        canBeReach = true;

        link.SetEvent("create", UIEventType.Click, SendCreateInfo);
    }
Пример #28
0
    protected override void OnOpen(object userData)
    {
        base.OnOpen(userData);

        if (userData == null)
        {
            return;
        }

        GUILink link = GetComponent <GUILink>();

        requestItem = link.GetComponent <ClubRequestItem>("Background");
        requestItem.SetActive(false);
        if (requestItemList == null)
        {
            requestItemList = new List <ClubRequestItem>();
        }

        InitLocal((List <ApplicantsData>)userData);
    }
Пример #29
0
    protected override void OnOpen(object userData)
    {
        base.OnOpen(userData);

        if (userData == null)
        {
            return;
        }

        GUILink link = GetComponent <GUILink>();

        gameItem = link.GetComponent <ClubGameItem>("running");
        gameItem.SetActive(false);
        if (gameItemList == null)
        {
            gameItemList = new List <ClubGameItem>();
        }

        InitLocal((List <RunGameData>)userData);
    }
Пример #30
0
        protected override void OnInit(object userData)
        {
            base.OnInit(userData);
            GUILink link = GetComponent <GUILink>();

            textName       = link.Get <Text>("TextName");
            textScore      = link.Get <Text>("TextScore");
            TextStyle      = link.Get <Text>("TextStyle");
            cardPos        = link.Get <Transform>("cardPos");
            bidIcon        = link.Get <Image>("bid");
            headIcon       = link.Get <Image>("headIcon");
            imgReady       = link.Get <Image>("img_ready");
            scoreImg       = link.Get <Image>("scoreImg");
            textName.text  = "";
            textScore.text = "";
            scoreImg.gameObject.SetActive(false);
            headIcon.gameObject.SetActive(false);
            textScore.gameObject.SetActive(false);
            link.SetEvent("headIcon", UIEventType.Click, OnClickHead);
        }