Esempio n. 1
0
 void Awake()
 {
     panelname = "MainLobbyPanel";
     LeftBtn   = this.transform.FindChild("Drag/LeftBtn").gameObject;
     if (LeftBtn != null)
     {
         ButtonClickListener listener = ButtonClickListener.AddEventListener(LeftBtn);
         listener.onClick = Down;
     }
     RightBtn = this.transform.FindChild("Drag/RightBtn").gameObject;
     if (RightBtn != null)
     {
         ButtonClickListener listener = ButtonClickListener.AddEventListener(RightBtn);
         listener.onClick = Down;
     }
     DragArea = this.transform.FindChild("Drag/DragArea").gameObject;
     CarTypeControler.CarRoot.position = new Vector3(DragArea.transform.position.x, DragArea.transform.position.y - 1.0f, 0.0f);
     if (DragArea != null)
     {
         EventTriggerListener listener = EventTriggerListener.AddEventListener(DragArea);
         listener.onDown = DragCar;
         listener.onDrag = CarOnDrag;
         listener.onUp   = DragUp;
     }
 }
Esempio n. 2
0
    private void Awake()
    {
        panelname = "ChatPanel";
        transform.localPosition = new Vector3(500, 0, 0);
        panel     = transform.Find("Panel").gameObject;
        ChatEnter = this.transform.Find("ChatEnter").gameObject;
        if (ChatEnter != null)
        {
            ButtonClickListener listener = ButtonClickListener.AddEventListener(ChatEnter);
            listener.onClick = OnClick;
        }

        ShowChat = false;
        if (panel != null)
        {
            r = panel.GetComponent <References>();
            if (r != null)
            {
                ChatTips = r.Object[0].GetComponent <Text>();
                FaceIcon = r.Object[3];
                if (FaceIcon != null)
                {
                    FaceIcon.AddComponent <ButtonClickListener>().onClick = FacePanelOpen;
                }
                SendBtn = r.Object[4];
                if (SendBtn != null)
                {
                    SendBtn.AddComponent <ButtonClickListener>().onClick = SendMsg;
                }
                SendText = r.Object[2].GetComponent <InputField>();
                ChatRoot = r.Object[1];
                if (ChatRoot != null)
                {
                    ScrollGrid = ChatRoot.GetComponent <GridLayoutGroup>();
                    CellHeight = ScrollGrid.spacing.y + ScrollGrid.cellSize.y;
                    GridRect   = ChatRoot.GetComponent <RectTransform>();
                }
                Scroll     = r.Object[5].GetComponent <ScrollRect>();
                ScrollRect = r.Object[5].GetComponent <RectTransform>();
                EmojiBg    = r.Object[6];
                if (!EmojiBg.activeInHierarchy)
                {
                    EmojiBg.SetActive(true);
                }
                EmojiItemRoot = r.Object[7];
                if (EmojiBg != null)
                {
                    EmojiBg.AddComponent <ButtonClickListener>().onClick = CloseEmojiPanel;
                }
            }
        }
        TcpNet.Instance.RegisterServiceHandler((int)Stype.TalkRoom, TalkRoomServiceEventHandler);
        RegisterTalkRoomServiceCmdHandler();
    }