Exemplo n.º 1
0
    /// <summary>
    /// 加载升级奖励数据
    /// </summary>
    IEnumerator InitLevelup()
    {
//		TextAsset s = Resources.Load( WGConfig.Path_levelup)as TextAsset;
        ResourceRequest rr = Resources.LoadAsync(WGConfig.Path_levelup);

        yield return(rr);

        TextAsset s = rr.asset as TextAsset;

        using (StreamReader sr = new StreamReader(new MemoryStream(s.bytes)))
        {
            string line;
            while ((line = sr.ReadLine()) != null)
            {
                try{
                    LevelUPReward lr = SDK.Deserialize <LevelUPReward>(line);
                    lr.refreshWeight();
                    dicLevelUpReward.Add(lr.level, lr);
                }
                catch (IOException e) {
                    Debug.Log(e.ToString());
                }
            }
        }
        Resources.UnloadAsset(s);
    }
Exemplo n.º 2
0
    /// <summary>
    /// 加载收集品的数据
    /// </summary>
    IEnumerator LoadCollectionParam()
    {
//		TextAsset s = Resources.Load(WGConfig.Path_conllectioninfo) as TextAsset;

        ResourceRequest rr = Resources.LoadAsync(WGConfig.Path_conllectioninfo);

        yield return(rr);

        TextAsset s = rr.asset as TextAsset;

        dicCollection = new Dictionary <int, BCCollectionInfo>();
        BCCollectionInfo tem;

        using (StreamReader sr = new StreamReader(new MemoryStream(s.bytes)))
        {
            string line;
            int    index = 0;
            while ((line = sr.ReadLine()) != null)
            {
                tem = SDK.Deserialize <BCCollectionInfo>(line);
                dicCollection.Add(tem.ID, tem);
                szCollectionObj.Add(dicGameObj[tem.ID]);
                index++;
            }
        }

        Resources.UnloadAsset(s);
    }
Exemplo n.º 3
0
    public void loadSuperTiger()
    {
        if (szSuperTiger.Count <= 0)
        {
            TextAsset s = Resources.Load(WGConfig.Path_SuperTiger) as TextAsset;

            MDTiger tem;
            using (StreamReader sr = new StreamReader(new MemoryStream(s.bytes)))
            {
                string line;
                while (!string.IsNullOrEmpty(line = sr.ReadLine()))
                {
                    //Debug.Log(line);
                    tem = SDK.Deserialize <MDTiger>(line);
                    szSuperTiger.Add(tem);
                }
            }

            int num = szSuperTiger.Count;

            _szSuperTigerWeight = new List <int>();

            _szSuperTigerWeight.Add(szSuperTiger[0].Weight);

            for (int i = 1; i < num; i++)
            {
                _szSuperTigerWeight.Add(_szSuperTigerWeight[i - 1] + szSuperTiger[i].Weight);
            }
            _AllTigerWeight = _szSuperTigerWeight[num - 1];

            Resources.UnloadAsset(s);
        }
    }
Exemplo n.º 4
0
    IEnumerator loadYHPayData()
    {
        TextAsset ta = null;

        if (YeHuoSDK.bUsePayCode2)
        {
//			 ta = Resources.Load(WGConfig.Path_YHPayDataExt) as TextAsset;
            ResourceRequest rr = Resources.LoadAsync(WGConfig.Path_YHPayDataExt);
            yield return(rr);

            ta = rr.asset as TextAsset;
        }
        else
        {
//		    ta = Resources.Load(WGConfig.Path_YHPayData) as TextAsset;
            ResourceRequest rr = Resources.LoadAsync(WGConfig.Path_YHPayData);
            yield return(rr);

            ta = rr.asset as TextAsset;
        }

        YHMDPayData tem;

        using (StreamReader sr = new StreamReader(new MemoryStream(ta.bytes)))
        {
            string line;
            while (!string.IsNullOrEmpty(line = sr.ReadLine()))
            {
                tem = SDK.Deserialize <YHMDPayData>(line);
                dicYHPayData.Add(tem.id, tem);
            }
        }
        Resources.UnloadAsset(ta);
    }
Exemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        Time.timeScale = 0;
        InvokeBlock(1f, () => {
            //WG.SLog("this is 1111111");
        });


        MDOrder od = SDK.Deserialize <MDOrder>(myTest);


        Debug.Log(SDK.Serialize(od));



        int   max    = 100000;
        float result = 1;

        for (int i = 0; i < max; i++)
        {
            result = result * getx(max);
        }
        Debug.Log("======" + result);

        Debug.Log("====" + getH());
    }
Exemplo n.º 6
0
    public MDDataCoin loadDataCoin(bool decrypt)
    {
        MDDataCoin data       = null;
        string     encrpytStr = null;
        string     decryptStr = null;

        try {
            // Create an instance of StreamReader to read from a file.
            // The using statement also closes the StreamReader.
            using (StreamReader sr = new StreamReader(SharedCoinPath)) {
                // Read and display lines from the file until the end of the file is reached.
                encrpytStr = sr.ReadToEnd();
            }

            if (decrypt)
            {
                decryptStr = Crypto.DecryptStringAES(encrpytStr, Consts.sharedSecret);
                data       = SDK.Deserialize <MDDataCoin> (decryptStr);
            }
            else
            {
                data = SDK.Deserialize <MDDataCoin> (encrpytStr);
            }
        } catch (Exception e) {
            // Let the user know what went wrong.
            //WG.SLog (e.Message);
        }

        return(data);
    }
Exemplo n.º 7
0
    IEnumerator LoadShopData()
    {
        Dictionary <int, MDShopData> uniTemp = new Dictionary <int, MDShopData>();

        if (YeHuoSDK.bUsePayCode2)
        {
//			TextAsset tt = Resources.Load(WGConfig.Path_ShopDataExt) as TextAsset;

            ResourceRequest rr = Resources.LoadAsync(WGConfig.Path_ShopDataExt);
            yield return(rr);

            TextAsset tt = rr.asset as TextAsset;

            if (tt != null)
            {
                using (StreamReader sr = new StreamReader(new MemoryStream(tt.bytes)))
                {
                    string     line;
                    MDShopData sd;
                    bool       inUni = false;
                    while (!string.IsNullOrEmpty(line = sr.ReadLine()))
                    {
                        sd = SDK.Deserialize <MDShopData>(line);
                        ProcessShopData(sd);
                        uniTemp.Add(sd.idx, sd);
                    }
                }
            }
            Resources.UnloadAsset(tt);
        }

//		TextAsset ta = Resources.Load(WGConfig.Path_ShopData) as TextAsset;

        ResourceRequest rr1 = Resources.LoadAsync(WGConfig.Path_ShopData);

        yield return(rr1);

        TextAsset ta = rr1.asset as  TextAsset;

        using (StreamReader sr = new StreamReader(new MemoryStream(ta.bytes)))
        {
            string     line;
            MDShopData sd;
            while (!string.IsNullOrEmpty(line = sr.ReadLine()))
            {
                sd = SDK.Deserialize <MDShopData>(line);
                ProcessShopData(sd);

                if (YeHuoSDK.bUsePayCode2 && uniTemp.ContainsKey(sd.idx))
                {
                    sd = uniTemp[sd.idx];
                    uniTemp.Remove(sd.idx);
                }
                szShopData.Add(sd);
            }
        }
        Resources.UnloadAsset(ta);
    }
Exemplo n.º 8
0
    /// <summary>
    /// 加载物品配置表
    /// </summary>
    IEnumerator LoadBCGameObjConfig()
    {
//		TextAsset BC =  Resources.Load(WGConfig.Path_BCObj)as TextAsset;
        ResourceRequest rr = Resources.LoadAsync(WGConfig.Path_BCObj);

        yield return(rr);

        TextAsset BC = rr.asset as TextAsset;

        dicGameObj = new Dictionary <int, BCObj>();
        BCObj tem;

        using (StreamReader sr = new StreamReader(new MemoryStream(BC.bytes)))
        {
            string line;
            while ((line = sr.ReadLine()) != null)
            {
                tem = SDK.Deserialize <BCObj>(line) as BCObj;
                dicGameObj.Add(tem.ID, tem);
                GameObject go = null;

                go = Resources.Load("items/res" + tem.Res) as GameObject;

                tem.goRes = go;

                List <BCObj> szType = null;
                dicTypeGameObj.TryGetValue(tem.Type, out szType);
                if (szType == null)
                {
                    szType = new List <BCObj>();
                    dicTypeGameObj.Add(tem.Type, szType);
                }
                if (!szType.Contains(tem))
                {
                    szType.Add(tem);
                }


                if (tem.BCType == BCGameObjectType.Item)
                {
                    szItemsObj.Add(tem);
                }
            }
        }

        Resources.UnloadAsset(BC);
    }
Exemplo n.º 9
0
    IEnumerator loadAllReward()
    {
//		TextAsset ta = Resources.Load(WGConfig.Path_Reward) as TextAsset;
        ResourceRequest rr = Resources.LoadAsync(WGConfig.Path_Reward);

        yield return(rr);

        TextAsset ta = rr.asset as TextAsset;

        using (StreamReader sr = new StreamReader(new MemoryStream(ta.bytes)))
        {
            string line = sr.ReadToEnd();


            mAllReward = SDK.Deserialize <YHMDAllReward>(line);
        }
        Resources.UnloadAsset(ta);
    }
Exemplo n.º 10
0
    /// <summary>
    /// 加载小熊的数据
    /// </summary>
    IEnumerator LoadBearParam()
    {
//		TextAsset BC =  Resources.Load(WGConfig.Path_BearParam)as TextAsset;
        ResourceRequest rr = Resources.LoadAsync(WGConfig.Path_BearParam);

        yield return(rr);

        TextAsset BC = rr.asset as TextAsset;

        dicBearParam  = new Dictionary <int, WGBearParam>();
        dicBearUnLock = new SortedDictionary <int, List <WGBearParam> >();
        WGBearParam tem;

        using (StreamReader sr = new StreamReader(new MemoryStream(BC.bytes)))
        {
            string line;

            while ((line = sr.ReadLine()) != null)
            {
//				//WG.SLog(line);
                tem = SDK.Deserialize <WGBearParam>(line);

                dicBearParam.Add(tem.id, tem);
                szBearsData.Add(tem);
                List <WGBearParam> idlist = null;
                if (tem.unlock >= 0)
                {
                    if (dicBearUnLock.TryGetValue(tem.unlock, out idlist))
                    {
                        idlist.Add(tem);
                    }
                    else
                    {
                        idlist = new List <WGBearParam>();
                        idlist.Add(tem);
                        dicBearUnLock.Add(tem.unlock, idlist);
                    }
                }

//				//WG.SLog(JsonFx.Json.JsonWriter.Serialize(tem));
            }
        }
        Resources.UnloadAsset(BC);
    }
Exemplo n.º 11
0
    IEnumerator loadAchievement()
    {
//		TextAsset ta = Resources.Load(WGConfig.Path_Achievement) as TextAsset;
        ResourceRequest rr = Resources.LoadAsync(WGConfig.Path_Achievement);

        yield return(rr);

        TextAsset ta = rr.asset as TextAsset;

        using (StreamReader sr = new StreamReader(new MemoryStream(ta.bytes)))
        {
            string        line;
            MDAchievement ach;
            while (!string.IsNullOrEmpty(line = sr.ReadLine()))
            {
                ach = SDK.Deserialize <MDAchievement>(line);

                if (!YeHuoSDK.bCommonTiger && ach.goals.Contains(4112))
                {
                }
                else
                {
                    szAchievement.Add(ach);

                    for (int i = 0, max = ach.goals.Count; i < max; i++)
                    {
                        if (dicGoalAchieve.ContainsKey(ach.goals[i]))
                        {
                            dicGoalAchieve[ach.goals[i]].Add(ach);
                        }
                        else
                        {
                            List <MDAchievement> temp = new List <MDAchievement>();
                            temp.Add(ach);
                            dicGoalAchieve.Add(ach.goals[i], temp);
                        }
                    }
                    processAchievementDescription(ach);
                }
            }
        }
        Resources.UnloadAsset(ta);
    }
Exemplo n.º 12
0
    void Create()
    {
        string   res = "";
        DataCoin dc;

        using (StreamReader sr = new StreamReader(new MemoryStream(taCoinData.bytes)))
        {
            res = sr.ReadToEnd();
            dc  = SDK.Deserialize <DataCoin>(res);
        }

        for (int i = 0; i < dc.CoinPos.Count; i++)
        {
            GameObject go = Instantiate(goCoin) as GameObject;
            SDK.AddChild(go, this.gameObject);
            go.transform.position   = SDK.toV3(dc.CoinPos[i]);
            go.transform.localScale = coinScale;
            go.transform.rotation   = Quaternion.Euler(new Vector3(0, 0, 180));
        }
    }
Exemplo n.º 13
0
    // Use this for initialization
    void Start()
    {
        //StartRotate();
        Instance = this;
        TextAsset s = Resources.Load(WGConfig.Path_Tiger) as TextAsset;

        TigerInfo tem;

        using (StreamReader sr = new StreamReader(new MemoryStream(s.bytes)))
        {
            string line;
            while ((line = sr.ReadLine()) != null)
            {
                tem = SDK.Deserialize <TigerInfo>(line);
                _szTigerInfo.Add(tem);
            }
        }

        Resources.UnloadAsset(s);


        int num = _szTigerInfo.Count;

        _TigerWeightList = new List <int>();

        _TigerWeightList.Add(_szTigerInfo[0].Weight);

        for (int i = 1; i < num; i++)
        {
            if (_szTigerInfo[i].ID == 4112)
            {
                _777Index = i;
            }
            _TigerWeightList.Add(_TigerWeightList[i - 1] + _szTigerInfo[i].Weight);
        }
        _AllTigerWeight = _TigerWeightList[num - 1];

        _shareWorld    = WGGameWorld.Instance;
        _CurrentShowID = new int[3];
        _WantShowID    = new int[3];
    }
Exemplo n.º 14
0
    IEnumerator LoadRewardPackage()
    {
//		TextAsset ta = Resources.Load(WGConfig.Path_RewardPackage) as TextAsset;
        ResourceRequest rr = Resources.LoadAsync(WGConfig.Path_RewardPackage);

        yield return(rr);

        TextAsset ta = rr.asset as TextAsset;

        using (StreamReader sr = new StreamReader(new MemoryStream(ta.bytes)))
        {
            string          line;
            MDRewardPackage sd;
            while (!string.IsNullOrEmpty(line = sr.ReadLine()))
            {
                sd = SDK.Deserialize <MDRewardPackage>(line);
                dicRewardPackage.Add(sd.id, sd);
            }
        }
        Resources.UnloadAsset(ta);
    }
Exemplo n.º 15
0
    IEnumerator loadTigerInfo()
    {
//		TextAsset ta = Resources.Load(WGConfig.Path_TigerInfo) as TextAsset;
        ResourceRequest rr = Resources.LoadAsync(WGConfig.Path_TigerInfo);

        yield return(rr);

        TextAsset ta = rr.asset as TextAsset;

        using (StreamReader sr = new StreamReader(new MemoryStream(ta.bytes)))
        {
            string      line;
            MDTigerInfo ti;
            while (!string.IsNullOrEmpty(line = sr.ReadLine()))
            {
                ti = SDK.Deserialize <MDTigerInfo>(line);
                dicTigerInfo.Add(ti.id, ti);
            }
        }
        Resources.UnloadAsset(ta);
    }
Exemplo n.º 16
0
    IEnumerator loadFuafei()
    {
//		TextAsset ta = Resources.Load(WGConfig.Path_Huafei) as TextAsset;
        ResourceRequest rr = Resources.LoadAsync(WGConfig.Path_Huafei);

        yield return(rr);

        TextAsset ta = rr.asset as TextAsset;

        using (StreamReader sr = new StreamReader(new MemoryStream(ta.bytes)))
        {
            string     line;
            MDV2HuaFei hf;
            while (!string.IsNullOrEmpty(line = sr.ReadLine()))
            {
                hf = SDK.Deserialize <MDV2HuaFei>(line);
                szHuaFei.Add(hf);
            }
        }
        Resources.UnloadAsset(ta);
    }
Exemplo n.º 17
0
    IEnumerator loadConfig()
    {
        ResourceRequest rr = Resources.LoadAsync(WGConfig.Path_Config);

        yield return(rr);

        TextAsset ta = rr.asset as TextAsset;

//		TextAsset ta = Resources.Load(WGConfig.Path_Config) as TextAsset;
        using (StreamReader sr = new StreamReader(new MemoryStream(ta.bytes)))
        {
            string line = sr.ReadToEnd();
            if (!string.IsNullOrEmpty(line))
            {
                Core.cfg = SDK.Deserialize <Config>(line);
                Core.fc  = new FinalConfig(Core.cfg);
            }
//			//WG.SLog(line);
        }
        Resources.UnloadAsset(ta);
    }
Exemplo n.º 18
0
    IEnumerator LoadCoinData()
    {
//		TextAsset s = Resources.Load(WGConfig.Path_SceneData) as TextAsset;

        ResourceRequest rr = Resources.LoadAsync(WGConfig.Path_SceneData);

        yield return(rr);

        TextAsset s = rr.asset as TextAsset;

        string dc = "";

        using (StreamReader sr = new StreamReader(new MemoryStream(s.bytes)))
        {
            dc = sr.ReadToEnd();

            mDataCoin = SDK.Deserialize <DataCoin>(dc);
        }

        Resources.UnloadAsset(s);
    }
Exemplo n.º 19
0
    IEnumerator loadObjectType()
    {
        TextAsset ta = Resources.Load(WGConfig.Path_Types) as TextAsset;

        ResourceRequest rr = Resources.LoadAsync(WGConfig.Path_Types);

        yield return(rr);

        ta = rr.asset as TextAsset;

        using (StreamReader sr = new StreamReader(new MemoryStream(ta.bytes)))
        {
            string line;
            MDType tp;
            while (!string.IsNullOrEmpty(line = sr.ReadLine()))
            {
                tp = SDK.Deserialize <MDType>(line);
                dicObjType.Add(tp.ID, tp.Type);
            }
        }
        Resources.UnloadAsset(ta);
    }
Exemplo n.º 20
0
    IEnumerator LoadWeaponData()
    {
//		TextAsset ta = Resources.Load(WGConfig.Path_Weapon) as TextAsset;
        ResourceRequest rr = Resources.LoadAsync(WGConfig.Path_Weapon);

        yield return(rr);

        TextAsset ta = rr.asset as TextAsset;

        using (StreamReader sr = new StreamReader(new MemoryStream(ta.bytes)))
        {
            string   line;
            MDWeapon weapon;
            while (!string.IsNullOrEmpty(line = sr.ReadLine()))
            {
                weapon = SDK.Deserialize <MDWeapon>(line);
                szWeapons.Add(weapon);
//				//WG.SLog(SDK.Serialize(weapon));
            }
        }
        Resources.UnloadAsset(ta);
    }
Exemplo n.º 21
0
    IEnumerator LoadSkill()
    {
//		TextAsset ta = Resources.Load(WGConfig.Path_Skill) as TextAsset;
        ResourceRequest rr = Resources.LoadAsync(WGConfig.Path_Skill);

        yield return(rr);

        TextAsset ta = rr.asset as TextAsset;

        using (StreamReader sr = new StreamReader(new MemoryStream(ta.bytes)))
        {
            string  line;
            MDSkill sd;
            while (!string.IsNullOrEmpty(line = sr.ReadLine()))
            {
                sd = SDK.Deserialize <MDSkill>(line);
                szSkills.Add(sd);
                dicSkills.Add(sd.id, sd);
            }
//			//WG.SLog(JsonFx.Json.JsonWriter.Serialize(dicSkills));
        }
        Resources.UnloadAsset(ta);
    }
Exemplo n.º 22
0
    void InitDailyView(bool signed)
    {
        if (signed)
        {
            buttonOK.isEnabled = false;
            buttonOK.GetComponentInChildren <UILabel>().text        = "已领取";
            buttonOK.GetComponentInChildren <UISprite>().spriteName = "v3Button_gray";
            buttonOK.transform.parent.Find("Button_ok_1").GetComponentInChildren <UISprite>().spriteName = "v2Button_yellowred";
        }
        else
        {
            buttonOK.GetComponentInChildren <UILabel>().text = "领取";
            buttonOK.transform.parent.Find("Button_ok_1").GetComponentInChildren <UISprite>().spriteName = "v3Button_gray";
            buttonOK.GetComponentInChildren <UISprite>().spriteName = "v2Button_yellowred";
            buttonOK.isEnabled = true;
        }
        TextAsset ta = Resources.Load(WGConfig.Path_Daily) as TextAsset;

        using (StreamReader sr = new StreamReader(new MemoryStream(ta.bytes)))
        {
            MDDailyReward dr   = null;
            string        line = "";
            while (!string.IsNullOrEmpty(line = sr.ReadLine()))
            {
                dr = SDK.Deserialize <MDDailyReward>(line);
                szDaily7Reward.Add(dr);
            }
        }
        Resources.UnloadAsset(ta);
        labPayTip.ESetActive(false);
//		WGDataController _dataCtrl = WGDataController.Instance;
//		YHMDPayData payData=_dataCtrl.getYHMDPay(YHPayType.DOUBLE_reward);
//		float costMenoy=payData.payCost;
//		string payKey=payData.payKey.ToString();
////		float costMenoy = 30;
////		string payKey = "114";
////		if(YeHuoSDK.bUsePayCode2)
////		{
////			costMenoy = 20;
////			payKey = "214";
////		}
//		string okString = "ok";
//
//
//
//		#if YES_OK
//		string content = WGStrings.getFormateInt(1081,1104,"",costMenoy.ToString());
//		okString = WGStrings.getText(1104);
//		#elif YES_BUY
//		string content = WGStrings.getFormateInt(1081,1104,"",costMenoy.ToString());
//		okString = WGStrings.getText(1104);
//#elif YES_GET
//		string content = WGStrings.getFormateInt(1081,1101,"",costMenoy.ToString());
//		okString = WGStrings.getText(1101);
//		#elif YES_QueRen
//		string content = WGStrings.getFormateInt(1081,1104,"",costMenoy.ToString());
//		okString = WGStrings.getText(1104);
//		#else
//		string content = WGStrings.getFormateInt(1081,1101,"",costMenoy.ToString());
//		okString = WGStrings.getText(1101);
//		#endif
//		labPayTip.text = content;
//		labDoubleOkTitle.text = okString;
//		if(YeHuoSDK.mTipType != 0)
//		{
//			labPayTip.ESetActive(false);
//		}
    }
Exemplo n.º 23
0
    void OnMessage(string msg)
    {
        mMessage += msg + "\n";


        YHSDKMessage sdMsg = SDK.Deserialize <YHSDKMessage>(msg);

        //WG.Log("OnMessage==="+msg);
        if (sdMsg.a == 1)          //isMusicOn
        {
            if (sdMsg.k == 1)      //on

            {
                if (BCSoundPlayer.Instance != null)
                {
                    BCSoundPlayer.Instance.SwitchMusic = true;
                    BCSoundPlayer.Instance.SwitchSound = true;
                }
                else
                {
                    PlayerPrefs.SetInt(KEYMUSIC, 1);
                    PlayerPrefs.SetInt(KEYSOUND, 1);
                }
            }
            else if (sdMsg.k == 0)                // off

            {
                if (BCSoundPlayer.Instance != null)
                {
                    BCSoundPlayer.Instance.SwitchMusic = false;
                    BCSoundPlayer.Instance.SwitchSound = false;
                }
                else
                {
                    PlayerPrefs.SetInt(KEYMUSIC, 0);
                    PlayerPrefs.SetInt(KEYSOUND, 0);
                }
            }
        }
        else if (sdMsg.a == 2)            //getPayTipType  k=0 LONG_TIP; k= 1 SHORT_TIP;k=2 NO_TIP;
        //WG.Log ("getPayTipType===" + sdMsg.k);

        {
            mTipType = sdMsg.k;
        }
        else if (sdMsg.a == 3)            //payResult
        //WG.Log ("payResult ====" + sdMsg.k + "payCode====" + sdMsg.s);

        {
            if (dicPayBlock.ContainsKey(sdMsg.s))
            {
                System.Action <bool> myAct = dicPayBlock [sdMsg.s];
                dicPayBlock.Remove(sdMsg.s);
                if (myAct != null)
                {
                    myAct(sdMsg.k == 0);
                }
            }

            if (dicPayOrder.ContainsKey(sdMsg.s))
            {
                string order = dicPayOrder [sdMsg.s];
                if (sdMsg.k == 0)
                {
                                        #if TalkingData
                    TDGAVirtualCurrency.OnChargeSuccess(order);
                    int payKey = System.Int32.Parse(sdMsg.s);
                    payKey %= 100;
                                        #endif
//					string payName=WGDataController.Instance.getYHMDPay((YHPayType)payKey).name;
//					Dictionary<string ,object> dic=new Dictionary<string,object>();
//					dic.Add("item",payName);
//					TalkingDataGA.OnEvent("购买成功",dic);
                }
                dicPayOrder.Remove(sdMsg.s);
            }
        }
        else if (sdMsg.a == 4)
        {
            WGGameWorld.Instance.keyEscape = 0;
            if (sdMsg.k == 0)               // exit game
            {
                WGGameWorld.Instance.OnApplicationPause(true);
                HKDataStatistics.Self.OnApplicationPause(true);
                //TalkingDataGA.OnKill();
            }
            else                 //cancel exit game
                                 //HKDataStatistics.Self.OnApplicationPause (false);
            {
            }
        }
        else if (sdMsg.a == 5)            //getSpecificFunction callback
        {
            if (sdMsg.s.Equals("4"))      //对话费,超级老虎机,十连抽
            {
                bTiger_HuaFei = sdMsg.k == 1;
                Debug.Log("superTiger:" + bTiger_HuaFei);
                //bTiger_HuaFei=false;
                getSpecificFunction(8);                 //客服控制
            }
            else if (sdMsg.s.Equals("8"))               //客服控制默认关闭
            {
                bKeFu = (sdMsg.k == 0?false:true);
                getSpecificFunction(16);                 //文案是否清楚
            }
            else if (sdMsg.s.Equals("16"))               //文案是否清楚
            {
                bMsgClear = sdMsg.k == 0;
                getSpecificFunction(32);                 //SuperTiger
            }
            else if (sdMsg.s.Equals("32"))               //普通老虎机

            {
                bCommonTiger = sdMsg.k == 1;
                getSpecificFunction(64);
            }
            else if (sdMsg.s.Equals("64"))             //新手礼包
            {
                bShowNewhandGift = sdMsg.k == 1;
                getSpecificFunction(128);
            }
            else if (sdMsg.s.Equals("128"))             //幸运礼包
            {
                bShowLuckGift = sdMsg.k == 1;
                getSpecificFunction(256);
            }
            else if (sdMsg.s.Equals("256"))              //土豪礼包
            {
                bShowRichGift = sdMsg.k == 1;
                getSpecificFunction(512);
            }
            else if (sdMsg.s.Equals("512"))             //狂暴礼包
            {
                bShowPoweGift = sdMsg.k == 1;
                getSpecificFunction(1024);
            }
            else if (sdMsg.s.Equals("1024"))             //双倍奖励
            {
                bShowDoubleGift = sdMsg.k == 1;
                getSpecificFunction(2);
            }
            else if (sdMsg.s.Equals("2"))             //角色3合一
            {
                bShow3RoalGift = sdMsg.k == 1;
                Debug.Log("show3RoalGift" + bShow3RoalGift);
                getSpecificFunction(1);
            }
            else if (sdMsg.s.Equals("1"))             //指哪打哪

            {
                bShowFinger = sdMsg.k == 1;
                Debug.Log("showFinger" + bShowFinger);
            }
        }
        else if (sdMsg.a == 6)
        {
            mUserID = sdMsg.s;
        }
    }
Exemplo n.º 24
0
    IEnumerator loadString()
    {
        Dictionary <int, MFText> uniDic = new Dictionary <int, MFText>();

        if (YeHuoSDK.bUsePayCode2)
        {
//			TextAsset tt= Resources.Load(WGConfig.Path_StringExt) as TextAsset;
            ResourceRequest rr = Resources.LoadAsync(WGConfig.Path_StringExt);
            yield return(rr);

            TextAsset tt = rr.asset as TextAsset;

            using (StreamReader sr = new StreamReader(new MemoryStream(tt.bytes)))
            {
                string line;
                while ((line = sr.ReadLine()) != null)
                {
                    if (line.StartsWith("#") || line.Trim().Equals(string.Empty))
                    {
                        //skip this line
                        continue;
                    }
                    try{
                        MFText text = SDK.Deserialize <MFText>(line);
                        uniDic.Add(text.ID, text);
                    }
                    catch (System.Exception e) {
                        Debug.LogError(line + "####" + e.ToString());
                    }
                }
            }
            Resources.UnloadAsset(tt);
        }

//		TextAsset ta = Resources.Load(WGConfig.Path_String) as TextAsset;
        ResourceRequest rr1 = Resources.LoadAsync(WGConfig.Path_String);

        yield return(rr1);

        TextAsset ta = rr1.asset as TextAsset;

        using (StreamReader sr = new StreamReader(new MemoryStream(ta.bytes)))
        {
            string line;
            while ((line = sr.ReadLine()) != null)
            {
                if (line.StartsWith("#") || line.Trim().Equals(string.Empty))
                {
                    //skip this line
                    continue;
                }
                try{
                    MFText text = SDK.Deserialize <MFText>(line);
                    if (YeHuoSDK.bUsePayCode2)
                    {
                        if (uniDic.ContainsKey(text.ID))
                        {
                            text = uniDic[text.ID];
                            uniDic.Remove(text.ID);
                        }
                    }

                    dicStrings.Add(text.ID, text);
                }
                catch (System.Exception e) {
                    //WG.LogError(line+"####"+e.ToString());
                }
            }
        }

        WGStrings.instance.InitDataWithAsset(dicStrings);
        Resources.UnloadAsset(ta);
    }
Exemplo n.º 25
0
    void TBMessage(string msg)
    {
        Debug.Log(msg);
        TBData data = SDK.Deserialize <TBData>(msg);

        Debug.Log(SDK.Serialize(data));


        if (data.act == TBACT.TBInitDidFinish)
        {
        }
        else if (data.act == TBACT.TBLoginResult)
        {
            WGAlertViewController.Self.hiddenConnecting();
        }
        else if (data.act == TBACT.TBBuyGoodsDidSuccessWithOrder)
        {
            WGAlertViewController.Self.hiddenConnecting();
            BuySuccess(data);
        }
        else if (data.act == TBACT.TBBuyGoodsDidFailedWithOrder)
        {
            WGAlertViewController.Self.showAlertView(1800 + data.status).alertViewBehavriour = (ab, view) => {
                switch (ab)
                {
                case MDAlertBehaviour.CLICK_OK:
                    view.hiddenView();
                    break;

                case MDAlertBehaviour.DID_HIDDEN:
                    WGAlertViewController.Self.hiddeAlertView(view.gameObject);
                    break;
                }
            };
            WGAlertViewController.Self.hiddenConnecting();
            ShopOrderManager.getInstance().setOrderStatu(data.order, ShopOrderManager.BuyFail);
            ShopOrderManager.getInstance().saveShopOrder();
        }
        else if (data.act == TBACT.TBBuyGoodsDidStartRechargeWithOrder)
        {
//			TBSDK.TBCheckOrder(data.order);
//			WGAlertViewController.Self.showConnecting();
        }
        else if (data.act == TBACT.TBBuyGoodsDidCancelByUser)
        {
            WGAlertViewController.Self.showAlertView(1810).alertViewBehavriour = (ab, view) => {
                switch (ab)
                {
                case MDAlertBehaviour.CLICK_OK:
                    view.hiddenView();
                    break;

                case MDAlertBehaviour.DID_HIDDEN:
                    WGAlertViewController.Self.hiddeAlertView(view.gameObject);
                    break;
                }
            };
            ShopOrderManager.getInstance().setOrderStatu(data.order, ShopOrderManager.BuyCancel);
            ShopOrderManager.getInstance().saveShopOrder();
            WGAlertViewController.Self.hiddenConnecting();
        }
        else if (data.act == TBACT.TBDidLogout)
        {
        }
        else if (data.act == TBACT.TBLeavedPlatform)
        {
            if (!string.IsNullOrEmpty(data.order))
            {
#if TBSDK
                TBSDK.TBCheckOrder(data.order);
#endif
            }
            else
            {
                WGAlertViewController.Self.hiddenConnecting();
            }
        }
        else if (data.act == TBACT.TBCheckOrderFinishedWithOrder)
        {
            WGAlertViewController.Self.hiddenConnecting();
            if (data.status == 1 || data.status == 3)
            {
                BuySuccess(data);
            }
            else if (data.status == 0 || data.status == 2 || data.status == -1)
            {
                ShopOrderManager.getInstance().setOrderStatu(data.order, ShopOrderManager.BuyFail);
                WGAlertViewController.Self.showAlertView(1820 + data.status).alertViewBehavriour = (ab, view) => {
                    switch (ab)
                    {
                    case MDAlertBehaviour.CLICK_OK:
                        view.hiddenView();
                        break;

                    case MDAlertBehaviour.DID_HIDDEN:
                        WGAlertViewController.Self.hiddeAlertView(view.gameObject);
                        break;
                    }
                };
            }
        }
        else if (data.act == TBACT.TBCheckOrderDidFailed)
        {
            WGAlertViewController.Self.showAlertView(1811).alertViewBehavriour = (ab, view) => {
                switch (ab)
                {
                case MDAlertBehaviour.CLICK_OK:
                    view.hiddenView();
                    break;

                case MDAlertBehaviour.DID_HIDDEN:
                    WGAlertViewController.Self.hiddeAlertView(view.gameObject);
                    break;
                }
            };
            WGAlertViewController.Self.hiddenConnecting();
        }
    }