コード例 #1
0
    void Start()
    {
        HttpReqUtil.getInstance().Get("http://fwdown.hy51v.com/Last/ServerConfig.json", ServerConfig.init);

        choiceServer = gameObject.transform.Find("ChoiceServer").gameObject;
        curServer    = gameObject.transform.Find("CurServer").gameObject;

        gameObject.transform.Find("Button_start").GetComponent <Button>().onClick.AddListener(() =>
        {
            PlayerPrefs.SetInt("ServerIndex", ServerConfig.listData.IndexOf(serverData));

            Socket_C.getInstance().m_onSocketEvent_Receive = SocketEvent_C.OnReceive;
            Socket_C.getInstance().m_onSocketEvent_Connect = SocketEvent_C.OnConnect;

            Socket_C.getInstance().Start(serverData.ip, "", serverData.port);
        });

        curServer.transform.Find("Button").GetComponent <Button>().onClick.AddListener(() =>
        {
            choiceServer.transform.localScale = new Vector3(1, 1, 1);
        });

        choiceServer.transform.Find("Button_close").GetComponent <Button>().onClick.AddListener(() =>
        {
            choiceServer.transform.localScale = new Vector3(0, 0, 0);
        });
    }
コード例 #2
0
    public void reqSign()
    {
        C2S_Sign c2s = new C2S_Sign();

        c2s.Tag = (int)CSParam.NetTag.Sign;
        c2s.Id  = PlayerData.UserInfoData.Id;

        Socket_C.getInstance().Send(c2s);
    }
コード例 #3
0
    public void reqLogin()
    {
        C2S_Login c2s = new C2S_Login();

        c2s.Tag      = (int)CSParam.NetTag.Login;
        c2s.DeviceId = SystemInfo.deviceUniqueIdentifier;

        Socket_C.getInstance().Send(c2s);
    }
コード例 #4
0
    public void reqUserInfo()
    {
        C2S_UserInfo c2s = new C2S_UserInfo();

        c2s.Tag      = (int)CSParam.NetTag.UserInfo;
        c2s.DeviceId = PlayerData.UserInfoData.Id;

        Socket_C.getInstance().Send(c2s);
    }
コード例 #5
0
    public void reqChangeEquip()
    {
        C2S_ChangeEquip c2s = new C2S_ChangeEquip();

        c2s.Tag       = (int)CSParam.NetTag.ChangeEquip;
        c2s.DeviceId  = PlayerData.UserInfoData.Id;
        c2s.EquipList = PlayerData.UserInfoData.EquipList;
        c2s.BagList   = PlayerData.UserInfoData.BagList;

        Socket_C.getInstance().Send(c2s);
    }