示例#1
0
    public static void init()
    {
        Dictionary <string, object> data = new Dictionary <string, object> ();

        data["cmd"] = "init";
        HttpRequestService.sendRequest(data, null, null, BI_FORM_KEY);
    }
    public void getNoticeService()
    {
        if (NoticeModel.Instance.hasGotNotice == false)
        {
            Dictionary <string, object> data = new Dictionary <string, object> ();
            data["cmd"]  = "getNotice";
            data["lang"] = "zh_cn";

#if UNITY_IPHONE
            string systemLang = PlayerPrefs.GetString("iOS_systemLanguage");
            if (systemLang != "zh-Hans")
            {
                data["lang"] = "zh_tw";
            }
#endif

            HttpRequestService.sendRequest(data, new HttpRequestService.RequestSuccessDelegate(onGetNoticesSuccess), new HttpRequestService.RequestFailDelegate(onGetNoticesFail));
        }

/*		else
 *              {
 *                      NoticeModel.Instance.PopupIfNecessary();
 *              }
 */
    }
示例#3
0
 void syncConsumeData()
 {
     if (BIModel.Instance.BIConsumeDataList.Count > 0)
     {
         Dictionary <string, object> data = new Dictionary <string, object> ();
         data["cmd"] = "consume";
         data["bi"]  = BIModel.Instance.BIConsumeDataList;
         HttpRequestService.sendRequest(data, new HttpRequestService.RequestSuccessDelegate(onSyncConsumeSuccess), null, BI_FORM_KEY);
     }
 }
示例#4
0
    // Use this for initialization
    void Start()
    {
        Dictionary <string, object> data = new Dictionary <string, object> ();

        data["cmd"]     = "login";
        data["version"] = AppSettings.frontEndVersion;
        data["device"]  = MFPDeviceAndroid.Instance.getDeviceModel();

        HttpRequestService.sendRequest(data, new HttpRequestService.RequestSuccessDelegate(onLoginSuccess), null);
    }
示例#5
0
 void syncScoreData()
 {
     if (BIModel.Instance.BIScoreDataList.Count > 0)
     {
         Dictionary <string, object> data = new Dictionary <string, object> ();
         data["cmd"] = "level_up";
         data["v"]   = AppSettings.frontEndVersion.ToString();
         data["bi"]  = BIModel.Instance.BIScoreDataList;
         HttpRequestService.sendRequest(data, new HttpRequestService.RequestSuccessDelegate(onSyncScoreSuccess), null, BI_FORM_KEY);
     }
 }
示例#6
0
    public static void log(string message)
    {
        Dictionary <string, object> data = new Dictionary <string, object> ();

        data["cmd"] = "client_log";
        Dictionary <string, object> biData = new Dictionary <string, object> ();

        biData["message"] = message;
        data["bi"]        = biData;
        HttpRequestService.sendRequest(data, null, null, BI_FORM_KEY);
    }
示例#7
0
    public static void login(string account = "anonymous")
    {
        Dictionary <string, object> data = new Dictionary <string, object> ();

        data["cmd"] = "biLogin";
        Dictionary <string, object> biData = new Dictionary <string, object> ();

        biData["account"] = account;
        data["bi"]        = biData;
        HttpRequestService.sendRequest(data, null, null, BI_FORM_KEY);
    }
    void OnClick()
    {
        long curTime = (long)System.DateTime.Now.Subtract(baseDate).TotalSeconds;

        if (curTime - _lastClickTime < 10)
        {
            GameObject TipObj   = GameObject.Find("MFP Gift Panel Portrait/Tip1");
            UILabel    tipLabel = TipObj.GetComponent <UILabel>();
            tipLabel.text = Language.Get("INPUT_TOO_FAST");
            return;
        }

        _lastClickTime = (long)System.DateTime.Now.Subtract(baseDate).TotalSeconds;             // Can't send new request in 10 seconds

        GameObject labelObj = GameObject.Find("MFP Gift Panel Portrait/Input/Label");
        UILabel    labelCom = labelObj.GetComponent <UILabel>();

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

        data["cmd"] = "convert";
        data["id"]  = labelCom.text;

        HttpRequestService.sendRequest(data, new HttpRequestService.RequestSuccessDelegate(onAskGiftSuccess), new HttpRequestService.RequestFailDelegate(onAskGiftFail));
    }
    // Use this for initialization
    void Start()
    {
        //int x = PlayerPrefs.GetInt("TUTORIAL_TORCH_ITEM", 0);
        //PlayerPrefs.SetInt("TUTORIAL_TORCH_ITEM", 1);
        // OutputLevelScores
        //PlayerPrefs.SetInt("key_360", 1);

        // record that user has already get to map level
        QihooSnsModel.Instance.goToMapLevelOnce = true;
        if (QihooSnsModel.Instance.Using360Login)
        {
            //UserSNSManager.Instance.showFloatWnd();
        }

        // [1] sync cached high scores
        HighScoreModel.Instance.Deserialize();
        Dictionary <int, int> cachedHighScores = HighScoreModel.Instance._highScores;

        if (cachedHighScores != null && cachedHighScores.Count > 0)
        {
            Dictionary <string, object> data = new Dictionary <string, object> ();
            data["cmd"]        = "saveData";
            data["deviceId"]   = SystemInfo.deviceUniqueIdentifier;
            data["platformId"] = QihooSnsModel.Instance.UserID;
            data["levelScore"] = HighScoreModel.Instance._highScores;

            HttpRequestService.sendRequest(data, new HttpRequestService.RequestSuccessDelegate(onGetNoticesSuccess), null);
        }

        // [2] sync user friend scores
        Dictionary <string, object> data1 = new Dictionary <string, object> ();

        data1["cmd"]         = "getFriend";
        data1["platformIds"] = QihooSnsModel.Instance.FriendListStr;
        //data1["platformIds"] ="599315361,29886669,384531921,630180399,291875798,291201194";
        //data1["platformIds"] = "622792586,384531921,291201194,291257815,371301281";
        //data1["platformIds"] = "612146777,291201194,404357426,317138868,291257815,401061065,622792586,599315361,371301281,29886669,626838463,271149288";
        long curTime = LivesSystem.TimeSeconds();

        if (data1["platformIds"] != "" && curTime - QihooSnsModel.Instance.LastGetFriendTime > 300)
        {
            // no secode get friend service in 5 minutes
            QihooSnsModel.Instance.LastGetFriendTime = LivesSystem.TimeSeconds();
            HttpRequestService.sendRequest(data1, new HttpRequestService.RequestSuccessDelegate(onGetFriendScoreSuccess), new HttpRequestService.RequestFailDelegate(onGetFriendScoreFailure));
        }
        else
        {
            UpdateFriendNameInMap();
        }


        /*
         * if (QihooSnsModel.Instance.FriendListStr == "")
         * {
         *      data1["platformIds"] = QihooSnsModel.Instance.FriendListStr + "1,2,3,4,5,6,7";
         * }
         * else
         * {
         *      data1["platformIds"] = QihooSnsModel.Instance.FriendListStr + ",1,2,3,4,5,6,7";
         * }
         */

        // [3] sync current level with 360
        if (QihooSnsModel.Instance.Using360Login)
        {
            UserSNSManager.Instance.UploadData(QihooSnsModel.Instance.UserID, UserManagerCloud.Instance.CurrentUser.LastFinishedLvl.ToString());
        }
    }