Esempio n. 1
0
    public void OnClick()
    {
        if (UserMgr.UserInfo.gold < transform.root.FindChild("CardPowerUp").GetComponent <CardPowerUp>().mFee)
        {
            UtilMgr.NotEnoughGold();
            return;
        }

        if (name.Equals("BtnPowerUp"))
        {
            mLevelBefore = transform.root.FindChild("CardPowerUp").GetComponent <CardPowerUp>().mTargetCard.cardLevel;
            mCardUpEvent = new CardUpEvent(ReceivedLevelUp);
            NetMgr.CardLevelUp(
                transform.root.FindChild("CardPowerUp").GetComponent <CardPowerUp>().mTargetCard,
                transform.root.FindChild("CardPowerUp").GetComponent <CardPowerUp>().mCardFeedList, mCardUpEvent);
        }
        else
        {
            mClassBefore = transform.root.FindChild("CardPowerUp").GetComponent <CardPowerUp>().mTargetCard.cardClass;
            mCardUpEvent = new CardUpEvent(ReceivedRankUp);
            NetMgr.CardRankUp(
                transform.root.FindChild("CardPowerUp").GetComponent <CardPowerUp>().mTargetCard,
                transform.root.FindChild("CardPowerUp").GetComponent <CardPowerUp>().mCardFeedList[0], mCardUpEvent);
        }
    }
Esempio n. 2
0
 // Use this for initialization
 void Start()
 {
     Debug.Log("Love Start!");
     InitNanoo();
     mEvent = new GetEventsEvent(new EventDelegate(this, "GotEvents"));
     NetMgr.GetEvents(BaseNanooRequest.API_TYPE.NOTICE, mEvent);
 }
 public override void OnClosing()
 {
     // 销毁
     Destroy(roomUICameraGo);
     NetMgr.GetInstance().tcpSock.msgDist.DelListener(Protocol.GetAchieve, RecvGetAchieve);
     NetMgr.GetInstance().tcpSock.msgDist.DelListener(Protocol.GetRoomList, RecvGetRoomList);
 }
    public void GotUID()
    {
        LoginInfo loginInfo = new LoginInfo();

        loginInfo.teamCode = mTeamCode;
        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            loginInfo.DeviceID = IOSMgr.GetMsg();
        }
        else
        {
            loginInfo.DeviceID = SystemInfo.deviceUniqueIdentifier;
        }
        if (Application.platform == RuntimePlatform.Android)
        {
            loginInfo.osType = 1;
        }
        else if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            loginInfo.osType = 2;
        }
        else if (Application.platform == RuntimePlatform.OSXEditor)
        {
            loginInfo.osType = 1;
        }

        NetMgr.LoginGuest(loginInfo, mLoginEvent, UtilMgr.IsTestServer(), true);
    }
Esempio n. 5
0
 public void Update()
 {
     //消息
     msgDist.Update();
     //心跳
     if (status == Status.Connected)
     {
         //定时器
         if (Time.time - lastTickTime > heartBeatTime)
         {
             ProtocolBase protocol = NetMgr.GetHeatBeatProtocol();
             Send(protocol);
             lastTickTime = Time.time;
         }
     }
     if (count == 1)
     {
         lock
         (locker)
         {
             msgDist.Clear();
             PanelMgr.instance.OpenPanel <Disconnect>("");
             count = 0;
         }
     }
 }
Esempio n. 6
0
    public void onLoginResp(string code)
    {
        if (code.Length == 0)
        {
            return;
        }

        Debug.Log("onLoginResp: " + code);

        Dictionary <string, object> args = new Dictionary <string, object> ();

        args["code"] = code;
        args["os"]   = getOS();

        Http.GetInstance().Get("/wechat_auth", args, ret => {
            int errcode = Convert.ToInt32(ret["errcode"]);

            Debug.Log("errcode=" + errcode);

            if (errcode == 0)
            {
                string account = (string)ret["account"];
                string token   = (string)ret["token"];

                PlayerPrefs.SetString("wx_account", account);
                PlayerPrefs.SetString("wx_sign", token);

                NetMgr.GetInstance().Login(account, token);
            }
        }, err => {
            Debug.Log("login fail: " + err);
        });
    }
Esempio n. 7
0
 void InitUserMonthly()
 {
     mUserEvent = new EntryListEvent(ReceivedUserRanking);
     NetMgr.UserMonthlyRanking(mUserEvent);
     transform.FindChild("Top").FindChild("LblTitle").GetComponent <UILabel>().
     text = UtilMgr.GetLocalText("StrMonthlyRanking");
 }
Esempio n. 8
0
    public void prev(int step = 1)
    {
        int id = current / 3;

        if (id >= step)
        {
            id -= step;
        }
        else
        {
            id = 0;
        }

        NetMgr       net = NetMgr.GetInstance();
        PomeloClient pc  = net.pc;

        pc.flush();

        RoomMgr rm = RoomMgr.GetInstance();

        rm.prepareReplay(mRoom, mBaseInfo);
        mCount = mBaseInfo.mahjongs.Count;

        gotoAction(id);
    }
Esempio n. 9
0
    // Use this for initialization
    new void Start()
    {
        base.Start();

        if (UtilMgr.IsMLB())
        {
            transform.FindChild("SprTitle").FindChild("SprK").gameObject.SetActive(false);
        }
        else
        {
            transform.FindChild("SprTitle").FindChild("SprK").gameObject.SetActive(true);
        }

        transform.FindChild("Terms").gameObject.SetActive(false);

        transform.FindChild("RegisterUsername").gameObject.SetActive(false);

        transform.FindChild("RegisterUsername").localPosition
            = new Vector3(0f, UtilMgr.GetScaledPositionY());

//		if(UtilMgr.IsMLB())
//			transform.FindChild("SprTitle").GetComponent<UISprite>().spriteName = "logo_title1";

        if (mNick != null)
        {
            Debug.Log("Nick is " + mNick);
            Login();
            return;
        }
        mVersionEvent = new CheckVersionEvent(new EventDelegate(ReceivedVersion));
//		transform.FindChild("Terms").GetComponent<Terms>().Init();
        NetMgr.CheckVersion(mVersionEvent, false);
    }
Esempio n. 10
0
 public void Init()
 {
     mIdx        = 0;
     mCardInfo   = null;
     mSkillEvent = new SkillsetListEvent(ReceivedSkill);
     NetMgr.SkillsetList(mSkillEvent);
 }
Esempio n. 11
0
    public static void destroy_club_room(int id, string room_tag, int club_id, Action <bool> cb)
    {
        NetMgr nm = NetMgr.GetInstance();

        JsonObject ob = new JsonObject();

        ob["roomid"]   = id;
        ob["room_tag"] = room_tag;
        ob["club_id"]  = club_id;

        nm.request_apis("destroy_club_room", ob, data => {
            NormalReturn ret = JsonUtility.FromJson <NormalReturn> (data.ToString());
            if (ret.errcode != 0)
            {
                Debug.Log("destroy club room fail");
                if (cb != null)
                {
                    cb(false);
                }
                return;
            }

            if (cb != null)
            {
                cb(true);
            }
        });
    }
Esempio n. 12
0
    public void OnClick()
    {
        int featured = 0;
        int type     = 0;

        mContestEvent = new ContestListEvent(new EventDelegate(ReceivedContest));
        Com.LOOG("DFSBtns-OnClick", name);

        if (transform.parent.name.Equals("Special_League"))
        {
            featured = ContestListInfo.FEATURED_SPECIAL;
            type     = ContestListInfo.TYPE_ALL;
            mTitle   = UtilMgr.GetLocalText("StrSpecialLeague");
        }
        else if (transform.parent.name.Equals("50"))
        {
            featured = ContestListInfo.TYPE_ALL;
            type     = ContestListInfo.TYPE_FIFTY;
            mTitle   = UtilMgr.GetLocalText("Str50vs50");
        }
        else if (transform.parent.name.Equals("Ranking"))
        {
            featured = ContestListInfo.TYPE_ALL;
            type     = ContestListInfo.TYPE_RANK;
            mTitle   = UtilMgr.GetLocalText("StrRanking");
        }

        NetMgr.GetContestList(featured, type, mContestEvent);
    }
Esempio n. 13
0
    public void get_coins(Action cb = null)
    {
        NetMgr nm = NetMgr.GetInstance();

        nm.request_apis("get_coins", null, ret => {
            GetCoins gc = JsonUtility.FromJson <GetCoins> (ret.ToString());
            if (gc.errcode != 0)
            {
                Debug.Log("get_coins fail: " + gc.errmsg);
                return;
            }

            userMgr.gems  = gc.gems;
            userMgr.coins = gc.golds;

            if (eventUpCoins != null)
            {
                eventUpCoins();
            }

            if (cb != null)
            {
                cb.Invoke();
            }
        });
    }
Esempio n. 14
0
    public static void share_club(int club_id, bool tl)
    {
        Debug.Log("share_club: " + club_id);
        if (club_id == 0)
        {
            return;
        }

        string title = "<雀达麻友圈>";
        NetMgr nm    = NetMgr.GetInstance();

        nm.request_apis("get_club_detail", "club_id", club_id, data => {
            GetClubDetail ret = JsonUtility.FromJson <GetClubDetail> (data.ToString());
            if (ret.errcode != 0)
            {
                Debug.Log("get_club_detail fail");
                return;
            }

            string content = ret.data.name + "俱乐部(ID:" + club_id + ")邀请您加入\n" + ret.data.desc;

            Dictionary <string, object> args = new Dictionary <string, object>();
            args.Add("club", club_id);

            AnysdkMgr.GetInstance().share(title, content, args, tl);
        });
    }
Esempio n. 15
0
    public void createRoom(JsonObject conf, Action <JsonObject> cb)
    {
        NetMgr net = NetMgr.GetInstance();

        JsonObject args = new JsonObject();

        args.Add("conf", conf);

        Debug.Log("gamemgr createRoom");

        net.request_connector("create_private_room", args, ret => {
            int code = Convert.ToInt32(ret["errcode"]);
            if (code != 0)
            {
                if (code == 2222)
                {
                    Debug.Log("房卡不足");
                }
                else
                {
                    Debug.Log("创建房间失败,错误码:" + code);
                }
            }

            cb(ret);
        });
    }
Esempio n. 16
0
    public static void get_room_costs(Action <bool> cb)
    {
        NetMgr nm = NetMgr.GetInstance();

        nm.request_apis("get_room_costs", null, data => {
            GetRoomCosts ret = JsonUtility.FromJson <GetRoomCosts> (data.ToString());

            if (ret.errcode != 0)
            {
                Debug.Log("get_room_costs fail");
                if (cb != null)
                {
                    cb(false);
                }
                return;
            }

            sGetRoomCosts = ret;

            if (cb != null)
            {
                cb(true);
            }
        });
    }
Esempio n. 17
0
    public static void list_goods_from_shop(Action <bool> cb)
    {
        NetMgr nm = NetMgr.GetInstance();

        nm.request_apis("list_goods_from_shop", null, data => {
            ListGoodsFromShop ret = JsonUtility.FromJson <ListGoodsFromShop> (data.ToString());

            if (ret.errcode != 0)
            {
                Debug.Log("list_goods_from_shop fail");
                if (cb != null)
                {
                    cb(false);
                }
                return;
            }

            sListGoodsFromShop = ret;

            if (cb != null)
            {
                cb(true);
            }
        });
    }
Esempio n. 18
0
    public void onBtnSubmit()
    {
        string content = mContent.value;

        if (content == "")
        {
            GameAlert.Show("请填写反馈内容");
            return;
        }

        JsonObject ob = new JsonObject();

        ob["content"] = content;
        ob["qq"]      = "123";
        ob["phone"]   = "12345678901";

        NetMgr.GetInstance().request_apis("feedback", ob, data => {
            NormalReturn ret = JsonUtility.FromJson <NormalReturn> (data.ToString());
            if (ret.errcode != 0)
            {
                GameAlert.Show("提交失败, 请检查网络");
                return;
            }

            GameAlert.Show("感谢您的反馈,我们会尽快处理!", () => {
                back();
            });
        });
    }
Esempio n. 19
0
    public static void kick(int uid, int roomid, string room_tag, Action <bool> cb)
    {
        NetMgr nm = NetMgr.GetInstance();

        JsonObject ob = new JsonObject();

        ob["uid"]      = uid;
        ob["roomid"]   = roomid;
        ob["room_tag"] = room_tag;

        nm.request_connector("kick", ob, data => {
            NormalReturn ret = JsonUtility.FromJson <NormalReturn> (data.ToString());
            if (ret.errcode != 0)
            {
                Debug.Log("kick fail");
                if (cb != null)
                {
                    cb(false);
                }
                return;
            }

            if (cb != null)
            {
                cb(true);
            }
        });
    }
Esempio n. 20
0
    void enterGangState(int state, int pai = 0)
    {
        _gangState = state;

        List <int> gp = _options.gangpai;

        switch (state)
        {
        case 0:
            if (gp.Count == 1)
            {
                enterGangState(1, gp [0]);
            }
            else
            {
                showGangOpt(true);
                // checkGangPai();
            }

            break;

        case 1:
            NetMgr.GetInstance().send("gang", "pai", pai);
            enterGangState(-1);
            break;

        case -1:
            showGangOpt(false);
            checkChuPai(false);
            break;

        default:
            break;
        }
    }
Esempio n. 21
0
 public void PowerOn()
 {
     transform.FindChild("TF_Post").gameObject.SetActive(false);
     UtilMgr.AddBackEvent(new EventDelegate(this, "BackPressed"));
     Mail = new GetMailEvent(new EventDelegate(this, "Setdata"));
     NetMgr.GetUserMailBox(UserMgr.UserInfo.memSeq, Mail);
 }
Esempio n. 22
0
 void FixedUpdate()
 {
     if (NetMgr.getSingleton().isConnected())
     {
         MSGProcess.processMsg(NetMgr.getSingleton().msgData(), OnProcessFinish);
     }
 }
Esempio n. 23
0
    void RegComplete(DialogueMgr.BTNS btn)
    {
        mContestEvent = new ContestListEvent(new EventDelegate(ReceivedContest));
        string title = transform.root.FindChild("Contests").FindChild("Top")
                       .FindChild("LblRanking").GetComponent <UILabel>().text;
        int featured = 0;
        int type     = 0;

        if (title.Equals(UtilMgr.GetLocalText("StrSpecialLeague")))
        {
            featured = ContestListInfo.FEATURED_SPECIAL;
            type     = ContestListInfo.TYPE_ALL;
        }
        else if (title.Equals(UtilMgr.GetLocalText("Str50vs50")))
        {
            featured = ContestListInfo.TYPE_ALL;
            type     = ContestListInfo.TYPE_FIFTY;
        }
        else if (title.Equals(UtilMgr.GetLocalText("StrRanking")))
        {
            featured = ContestListInfo.TYPE_ALL;
            type     = ContestListInfo.TYPE_RANK;
        }
        NetMgr.GetContestList(featured, type, mContestEvent);
    }
Esempio n. 24
0
    void ReceivedLogin()
    {
        if (mLoginEvent.Response.code == 1)
        {
            DialogueMgr.ShowDialogue(UtilMgr.GetLocalText("StrServerError"), mCheckEvent.Response.message,
                                     DialogueMgr.DIALOGUE_TYPE.Alert, null);
        }

        UserMgr.LoginInfo = mLoginEvent.Response.data;

        int year = int.Parse(mLoginEvent.Response.data.serverTime.Substring(0, 4));
        int mon  = int.Parse(mLoginEvent.Response.data.serverTime.Substring(4, 2));
        int day  = int.Parse(mLoginEvent.Response.data.serverTime.Substring(6, 2));
        int hour = int.Parse(mLoginEvent.Response.data.serverTime.Substring(8, 2));
        int min  = int.Parse(mLoginEvent.Response.data.serverTime.Substring(10, 2));
        int sec  = int.Parse(mLoginEvent.Response.data.serverTime.Substring(12, 2));

        System.DateTime dt = new System.DateTime(year, mon, day, hour, min, sec);
//		Debug.Log("dt is "+dt.ToString("yyyyMMddhhmmss"));
        System.TimeSpan ts = dt - System.DateTime.Now;
        UserMgr.DiffTicks = ts.Ticks;

//		Debug.Log("diff is "+ts.Minutes+":"+ts.Seconds);
//		Debug.Log("myTime is "+System.DateTime.Now.ToString("yyyyMMddhhmmss"));
//		Debug.Log("diffTicks are "+UserMgr.DiffTicks);

        mProfileEvent = new GetProfileEvent(new EventDelegate(ReceivedProfile));
        NetMgr.GetProfile(mLoginEvent.Response.data.memSeq, mProfileEvent);
    }
 /// <summary>
 /// 登出回调
 /// </summary>
 /// <param name="protocol"></param>
 public void OnLogoutBack(GameMessage message)
 {
     PanelMgr._instance.OpenPanel <TipPanel>("", "登出成功!");
     PanelMgr._instance.OpenPanel <LoginPanel>("");
     NetMgr.GetInstance().tcpSock.Close();
     Close();
 }
Esempio n. 26
0
 public void Init(CardInfo info, int idx)
 {
     mIdx        = idx;
     mCardInfo   = info;
     mSkillEvent = new SkillsetListEvent(ReceivedSkill);
     NetMgr.SkillsetList(mSkillEvent);
 }
Esempio n. 27
0
    private void Update()
    {
        if (NetScene.getInstance().queMes.Count > 0)
        {
            MessageVO vo = NetScene.getInstance().queMes.Dequeue();
            Serializer.Deserialize(vo.protocol, vo.data);


            if (NetScene.getInstance().frame % 350 == 0)
            {
                ModelFactory.getStance().spawn();
                txtLog.text = ModelFactory.getStance().curSpawn + "/" + ModelFactory.maxSpawn;
                //txtLog.text = Random.Range(1, 100).ToString();
            }
        }

        if (NetMgr.GetInstance().client.GetReadMsg() != null &&
            NetMgr.GetInstance().client.GetReadMsg().Count > 0)
        {
            string s = NetMgr.GetInstance().client.GetReadMsg().Dequeue();
            txtLog.text = s;
            Debug.Log(s);
        }

        if (NetMgr.GetInstance().client.GetLog() != null &&
            NetMgr.GetInstance().client.GetLog().Count > 0)
        {
            string s = NetMgr.GetInstance().client.GetLog().Dequeue();
            Debug.Log(s);
        }
        keyboardMove();
        shoot();
    }
Esempio n. 28
0
 public void moveAuto(Map.position pos)
 {
     JFPackage.PAG_WALK wakl = new JFPackage.PAG_WALK(playerID(), pos._x, pos._z, (byte)Map.Direction.LEFT);
     NetMgr.getSingleton().sendMsg(wakl);
     setPerMoveState();
     SetMove(pos);
 }
    void DialogueHandler(DialogueMgr.BTNS btn)
    {
        if (btn == DialogueMgr.BTNS.Btn1)
        {
            JoinMemberInfo        memInfo = new JoinMemberInfo();
            UpdateMemberInfoEvent event1  = null;
            //memInfo.Photo;
            //memInfo.MemberID
            memInfo.MemberName  = SetName;
            memInfo.MemberEmail = UserMgr.UserInfo.memberEmail;

            Debug.Log("send Team code : " + SetTeamCode);
            memInfo.FavoBB = SetTeamCode;
            if (GalleryCheck)
            {
                memInfo.MemImage = UserMgr.UserInfo.memberEmail;
                if (Setimagebyte == null)
                {
                    Setimagebyte = UserMgr.UserInfo.Textures.EncodeToPNG();
                }
                memInfo.PhotoBytes = Setimagebyte;
                Setimagebyte       = null;
                GalleryCheck       = false;
            }
            event1 = new UpdateMemberInfoEvent(new EventDelegate(this, "Set"));
            NetMgr.UpdateMemberInfo(memInfo, event1, UtilMgr.IsTestServer(), false);
        }
    }
Esempio n. 30
0
    public void onBtnJoin()
    {
        string club_id = id.value;
        int    cid     = 0;

        if (club_id == "" || !int.TryParse(club_id, out cid))
        {
            GameAlert.Show("请填写俱乐部ID");
            reset();
            return;
        }

        NetMgr nm = NetMgr.GetInstance();

        nm.request_apis("apply_join_club", "club_id", cid, data => {
            NormalReturn ret = JsonUtility.FromJson <NormalReturn> (data.ToString());
            if (ret.errcode != 0)
            {
                GameAlert.Show(ret.errmsg);
                reset();
                return;
            }

            GameAlert.Show("已成功申请,请等待管理员审核", () => {
                gameObject.SetActive(false);
                id.value = "";
            });
        });
    }
Esempio n. 31
0
 public static NetMgr GetInstance()
 {
     if (_instance == null)
     {
         lock (lockHelper)
         {
             if (_instance == null)
             {
                 _instance = new NetMgr();
                 _instance.Init();
             }
         }
     }
     return _instance;
 }
Esempio n. 32
0
	void FindSceneNetMgr () {
		sceneNetMgr = FindObjectOfType<NetMgr> ();
		targetManager = FindObjectOfType<NetworkManager> ();
		if (difficultySlider != null)
			difficultySlider.value = sceneNetMgr.difficulty;
	}
Esempio n. 33
0
 void Awake()
 {
     Instance = this;
 }