Exemplo n.º 1
0
        void Start()
        {
            for(int i=0;i<56;i++)
            {
                loadingpercent[i]=GameObject.Find("percent"+i).GetComponent<Image>();

            }
            for(int i=0;i<10;i++)
            {
                load[i]=GameObject.Find(""+i).GetComponent<RectTransform>();
                y[i]=load [i].localPosition.y;
                up_down[i] =false ;

            }
            BeginConnectTime=Time.time;
            time=Time.time;
            guy_image=GameObject.Find ("guy").GetComponent<Image>();
            guy_rect=GameObject.Find ("guy").GetComponent<RectTransform>();

            proxy = Singletons.GET<LobbyService>();
            model = Singletons.GET<UserModel>();
            roommodel=Singletons.GET <RoomModel>();
            proxy.OnLobbyUserInfo = OnUserInfo;
            proxy.OnLobbyMyHousingItemList=OnMyHousingItemList;
            proxy.OnLobbyCharInfo=OnCharInfo;
            proxy.OnLobbyCashInfo=OnCashInfo;
            proxy.OnLobbyConnectAuth = delegate(Cmdlib.cmdGAME_ANSWER_CONNECT_AUTH data) {
                if (data.GetAck () == 1) {
                    proxy.LobbyLoginAuth (model.LALA_data.login_name, model.LALA_data.auth_key, 0, 0, 0);
                } else {

                }
            };

            proxy.OnLobbyLoginAuth = delegate(Cmdlib.cmdGAME_ANSWER_LOGIN_AUTH data) {
                if (data.GetAck () == 1) {
                    model.GALA_data=data;
                    WebLog.Log("登陆成功了!!!!");
                    proxy.LobbyUserInfo(data.security_key);
                } else {

                }
            };
            proxy.OnLobbyEnterLobby=delegate(cmdGAME_ANSWER_ENTER_LOBBY data) {
                if(data.GetAck()==1)
                {
                    WebLog.Log(data+"进入大厅");
                    //proxy.LobbyEventList();
                }
            };
            /*	proxy.OnLobbyEventList=delegate(cmdGAME_ANSWER_EVENT_LIST data) {
                roommodel.GAEL_EventList=data;
                proxy.LobbyRoomList((byte)eROOM_PAGE_TYPE.ROOM_PAGE_TYPE_NONE,(byte)eMATCH_VIEW_TYPE.MATCH_VIEW_TYPE_ITEM,(byte)eROOM_VIEW_TYPE.ROOM_VIEW_TYPE_INDIVIDUAL);
            };
            proxy.OnLobbyRoomList=delegate(cmdGAME_ANSWER_ROOM_LIST data) {
                if(data.GetAck()==1)
                {
                    WebLog.Log(data);
                //	roommodel.RoomInfo.Clear();
                }
            };
            proxy.OnLobbyNotifyRoomListPage=delegate(cmdGameNotifyRoomListPage data) {
                roommodel.GNRLG_Page=data;
                WebLog.Log(data);
            };

            proxy.OnLobbyNotifyRoomListAdd=delegate(cmdGameNotifyRoomListAdd data) {
                WebLog.Log("添加房间");
                roommodel.RoomInfo.Add(data.info);

            };*/
            lobbynetwork=Singletons.GET<LobbyNetWork>();
            lobbynetwork.Connect(1,model .LALA_data.ip,model.LALA_data.port,OnConnected);
        }