Пример #1
0
    public void OrderOk(string orderId, int shopId)
    {
        Dictionary <string, string> map;
        GameParam param;

        ShopData sData = ShopData.GetData(shopId);

        map                            = new Dictionary <string, string>();
        map["Order_Id"]                = orderId;
        map["Product_Name"]            = sData == null? "": sData._Name;
        map["Currency_Amount"]         = sData == null? "": sData._Price.ToString();
        map["Currency_Type"]           = "CNY";
        map["Payment_Type"]            = Game.getInstance().getChannelId();
        map["Virtual_Currency_Amount"] = sData == null? "": sData._Num.ToString();
        param                          = new GameParam(map);
        GameAnalytics.getInstance().callFuncWithParam("onChargeRequest", param);

        //这里统计支付完成
        PopText.Instance.Show(LanguageManager.instance.GetValue("paySuccess"), PopText.WarningType.WT_Tip);
        param = new GameParam(orderId);
        GameAnalytics.getInstance().callFuncWithParam("onChargeSuccess", param);
        map                    = new Dictionary <string, string>();
        map["User_Id"]         = GamePlayer.Instance.InstId.ToString();
        map["Order_Id"]        = orderId;
        map["Currency_Amount"] = sData == null ? "" : sData._Price.ToString();
        map["Currency_Type"]   = "CNY";
        map["Payment_Type"]    = Game.getInstance().getChannelId();
        GameAdTracking.getInstance().onPay(map);
    }
Пример #2
0
    void OnAccountChange(CommonEvent.DefineAccountOperate type)
    {
        Dictionary <string, string> paramMap = new Dictionary <string, string>();

        paramMap["Account_Id"]      = GameUser.getInstance().getUserID();
        paramMap["Account_Name"]    = GamePlayer.Instance.InstName;
        paramMap["Account_Type"]    = Convert.ToString((int)AccountType.ANONYMOUS);
        paramMap["Account_Level"]   = GamePlayer.Instance.GetIprop(PropertyType.PT_Level).ToString();
        paramMap["Account_Operate"] = Convert.ToString((int)type);
        paramMap["Account_Gender"]  = Convert.ToString((int)AccountGender.UNKNOWN);
        paramMap["Server_Id"]       = GameManager.ServId_.ToString();
        paramMap["Account_Age"]     = "18";
        GameParam param1 = new GameParam(paramMap);

        GameAnalytics.getInstance().callFuncWithParam("setAccount", param1);

        if (type == CommonEvent.DefineAccountOperate.LOGIN)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();
            dic["User_Id"]   = GameUser.getInstance().getUserID();
            dic["Role_Id"]   = GamePlayer.Instance.InstId.ToString();
            dic["Role_Name"] = GamePlayer.Instance.InstName;
            GameAdTracking.getInstance().onLogin(dic);

            if (GamePlayer.Instance.isCreate)
            {
                if (GameAdTracking.getInstance().isFunctionSupported("onCreateRole"))
                {
                    GameAdTracking.getInstance().trackEvent("onCreateRole", dic);
                }
            }
        }
        else if (type == CommonEvent.DefineAccountOperate.REGISTER)
        {
            GameAdTracking.getInstance().onRegister(GameUser.getInstance().getUserID());
        }

        if (GamePlayer.Instance.InstId == 0)
        {
            return;
        }

        if (string.IsNullOrEmpty(GamePlayer.Instance.InstName))
        {
            return;
        }

        if (GamePlayer.Instance.GetIprop(PropertyType.PT_Level) == 0)
        {
            return;
        }

        if (GamePlayer.Instance.createTime_ == 0)
        {
            return;
        }

        if (GameUser.getInstance().isFunctionSupported("submitLoginGameRole"))
        {
            Dictionary <string, string> map = new Dictionary <string, string>();
            map["roleId"]    = GamePlayer.Instance.InstId.ToString();
            map["roleName"]  = GamePlayer.Instance.InstName;
            map["roleLevel"] = GamePlayer.Instance.GetIprop(PropertyType.PT_Level).ToString();
            map["zoneId"]    = GameManager.ServId_.ToString();
            map["zoneName"]  = GameManager.ServName_;
            map["roleCTime"] = Convert.ToString(GamePlayer.Instance.createTime_);
            map["balance"]   = GamePlayer.Instance.GetIprop(PropertyType.PT_MagicCurrency).ToString();
            map["partyName"] = GuildSystem.Mguild == null ? "" : GuildSystem.Mguild.guildName_;
            map["vipLevel"]  = GamePlayer.Instance.GetIprop(PropertyType.PT_VipLevel).ToString();
            string sdType = "";
            switch (type)
            {
            case CommonEvent.DefineAccountOperate.LOGIN:
                if (GamePlayer.Instance.isCreate)
                {
                    sdType = "2";
                }
                else
                {
                    sdType = "1";
                }
                if (GlobalValue.channelID.Equals("000003"))
                {
                    map["roleLevelMTime"] = crtTimeStamp();
                }
                else
                {
                    map["roleLevelMTime"] = "-1";
                }
                break;

            case CommonEvent.DefineAccountOperate.LOGOUT:
                sdType = "4";
                if (GlobalValue.channelID.Equals("000003"))
                {
                    map["roleLevelMTime"] = crtTimeStamp();
                }
                else
                {
                    map["roleLevelMTime"] = "-1";
                }
                break;

            default:
                sdType = "1";
                map["roleLevelMTime"] = crtTimeStamp();
                break;
            }
            map["dataType"] = sdType;
            GameParam param = new GameParam(map);
            GameUser.getInstance().callFuncWithParam("submitLoginGameRole", param);
            ClientLog.Instance.Log(GamePlayer.Instance.InstId.ToString() + " " + GamePlayer.Instance.InstName + " " + GamePlayer.Instance.GetIprop(PropertyType.PT_Level).ToString() + " " + GamePlayer.Instance.createTime_.ToString());
        }
    }