示例#1
0
    // 触发事件(继承自BehaviourTrigger)aa
    public override void SyncUpdate(sdBehaviourStateBlock kBehaviourStateBlock)
    {
        if (kBehaviourStateBlock.BehaviourStateEventType != EBehaviourStateEventType.enBSET_Killed)
        {
            return;
        }

        if (mIsTriggered != true)
        {
            mIsTriggered = true;
            if (IsEnterTrigger && NotifyEnterTrigger != null)
            {
                if (!BundleGlobal.IsMobile())
                {
                    //Debug.Log("sdKilledBehaviourTrigger::NotifyEnterTrigger");
                }
                NotifyEnterTrigger(this);
            }
        }

        if (mIsTriggered != false)
        {
            mIsTriggered = false;
            if (IsLeaveTrigger && NotifyLeaveTrigger != null)
            {
                if (!BundleGlobal.IsMobile())
                {
                    //Debug.Log("sdKilledBehaviourTrigger::NotifyLeaveTrigger");
                }
                NotifyLeaveTrigger(this);
            }
        }
    }
示例#2
0
    void __PreLoadResource(string path, uint refCount, System.Type t)
    {
        if (!BundleGlobal.IsMobile())
        {
            return;
        }
        if (path.Length == 0)
        {
            return;
        }
        bool resourceExist = resourceDB.ContainsKey(path);

        if (resourceExist)
        {
            ResourceTask task = resourceDB[path] as ResourceTask;
            task.Ref = refCount;
        }
        else
        {
            ResourceTask task = new ResourceTask();
            task._name       = path;
            task._param      = null;
            task.Ref         = refCount;
            resourceDB[path] = task;

            AddTask(path, t, -1);
        }
    }
示例#3
0
    public void Initialize()
    {
        if (VERSION_CODE.Length >= 0)
        {
            return;
        }
        if (Application.isEditor)
        {
            VERSION_CODE = "100";
        }
        else
        {
            VERSION_CODE = BundleGlobal.AppVersion()["versionName"].Split('.')[3];
            Debug.Log("BundleGlobal.AppVersion ");
        }

        m_strLogPath   = BundleGlobal.LocalPath + "log.txt";
        m_strErrorPath = BundleGlobal.LocalPath + "error.txt";
        if (File.Exists(m_strLogPath))
        {
            File.Delete(m_strLogPath);
        }
        if (File.Exists(m_strErrorPath))
        {
            StartCoroutine(Upload());
        }

        Application.RegisterLogCallback(HandleLog);
    }
示例#4
0
    void OnChargeBtn(GameObject go)
    {
        foreach (ChargeInfo chargeInfo in _chargeInfos)
        {
            if (go == chargeInfo.chargeBtn)
            {
                if (chargeInfo.monthCardId != 0)
                {
                    return;
                }

                //
                GHome.GetInstance().Pay("", BundleGlobal.AppVersion()["Area"], chargeInfo.productCode, "", (code, msg, data) =>
                {
                    if (code == Constants.ERROR_CODE_SUCCESS)
                    {
                    }
                    else
                    {
                    }
                });

                return;
            }
        }
    }
示例#5
0
    // 触发动作(触发条件调用,继承自sdBehaviourAction)aa
    public override void DoSyncAction()
    {
        if (!BundleGlobal.IsMobile())
        {
            //Debug.Log("sdSummonBehaviourAction::DoSyncAction");
        }

        if (mSummonLevelArea == null)
        {
            GameObject kSummonLevelAreaObject = GameObject.Find(mLevelAreaName);
            if (kSummonLevelAreaObject)
            {
                mSummonLevelArea = kSummonLevelAreaObject.GetComponent <sdLevelArea>();
            }

            if (mSummonLevelArea == null)
            {
                return;
            }
        }

        sdSummonBehaviourAction kDelaySummonBehaviourAction = this.Clone() as sdSummonBehaviourAction;

        kDelaySummonBehaviourAction.TimeStamp        = Time.time;
        kDelaySummonBehaviourAction.mSummonLevelArea = this.mSummonLevelArea;

        mBehaviourAdvancedState.AddBehaviourActionToDelayList(kDelaySummonBehaviourAction);
    }
示例#6
0
    public static void init()
    {
        CliProto.AddEncode_Decode();
        if (Application.platform != RuntimePlatform.WindowsEditor)
        {
            Login_IP = "127.0.0.1";
        }
        else
        {
            // 只有在内网172网段才使用内网服务器地址.. 并且不是移动平台..
            string ip  = Network.player.ipAddress;
            int    idx = ip.IndexOf('.');
            // !!!
            // 请在login场景的bt_startgame按钮的属性表里设置Serverip,不要直接修改这个脚本
            // !!!
            if (idx > 0 && ip.Substring(0, idx) == "172" && (!BundleGlobal.IsMobile() || BundleGlobal.InternalNetDebug))
            {
                Login_IP     = "172.30.10.124";
                bInternalNet = true;
            }
            else
            {
                Login_IP = "127.0.0.1";
            }
        }
        Login_Port = 8000;

        setCallBackFunc((ushort)CliProto.EN_CliProto_MessageID.GCID_ERROR, OnMessage_GCID_ERROR);

        SDGlobal.Log("before enterscene");
        sdEnterScene.init();
        SDGlobal.Log("before item Msg");
        sdItemMsg.init();
        SDGlobal.Log("itemMsg");
        sdSkillMsg.init();
        SDGlobal.Log("actorMsg");
        sdActorMsg.init();
        SDGlobal.Log("petMsg");
        sdPetMsg.init();
        SDGlobal.Log("chat");
        sdChatMsg.init();
        SDGlobal.Log("friend");
        sdFriendMsg.init();
        SDGlobal.Log("ActGameMsg");
        sdActGameMsg.init();
        sdMallMsg.init();
        SDGlobal.Log("MailMsg");
        sdMailMsg.init();
        SDGlobal.Log("pvpMsg");
        sdPVPMsg.init();
        SDGlobal.Log("AwardCenterMsg");
        sdAwardCenterMsg.init();
        SDGlobal.Log("RoleCreateMsg");
        sdRoleCreateMsg.init();
        sdMysteryShopMsg.init();
        sdRankLisrMsg.init();
        sdBBSMsg.init();
        sdLevelMsg.init();
    }
示例#7
0
    // 触发动作(触发条件调用,继承自sdBehaviourAction)aa
    public override void DoSyncAction()
    {
        if (!BundleGlobal.IsMobile())
        {
            //Debug.Log("sdSkillBehaviourAction::DoSyncAction");
        }

        sdDelaySkillBehaviourAction kDelaySkillBehaviourAction = new sdDelaySkillBehaviourAction();

        kDelaySkillBehaviourAction.Count                  = this.Count;
        kDelaySkillBehaviourAction.DelayTime              = this.mDelayTime;
        kDelaySkillBehaviourAction.IntervalTime           = this.mIntervalTime;
        kDelaySkillBehaviourAction.TimeStamp              = this.mTimeStamp;
        kDelaySkillBehaviourAction.BehaviourAdvancedState = this.mBehaviourAdvancedState;

        kDelaySkillBehaviourAction.SkillBehavuourAction = this;

        mBehaviourAdvancedState.AddBehaviourActionToDelayList(kDelaySkillBehaviourAction);
    }
示例#8
0
    //进入世界boss反馈..
    private static void msg_SC_WB_ENTER_ACK(int iMsgID, ref CMessage msg)
    {
        CliProto.SC_WB_ENTER_ACK refMsg = (CliProto.SC_WB_ENTER_ACK)msg;

        if (refMsg.m_Result == 0)
        {
            HeaderProto.SWorldBossInfo info = refMsg.m_Info;
            sdActGameMgr.Instance.BuildWorldBossInfo(info);

            GameObject wnd = sdGameLevel.instance.NGUIRoot;
            if (wnd)
            {
                sdUIWorldBossWnd bossWnd = wnd.GetComponentInChildren <sdUIWorldBossWnd>();
                if (bossWnd)
                {
                    bossWnd.RefreshWorldBossUI();
                    bossWnd.RefreshLBItemListPage();

                    int iLevelID = sdActGameMgr.Instance.GetWorldBossLevelID();
                    if (iLevelID > 0)
                    {
                        sdLevelInfo.SetCurLevelId(iLevelID);
                        // 通知宠物管理器..
                        sdNewPetMgr.Instance.OnEnterLevel();
                        sdUICharacter.Instance.iCurrentLevelID    = iLevelID;
                        sdUICharacter.Instance.bCampaignLastLevel = false;
                        sdUICharacter.Instance.SetBattleType((byte)HeaderProto.LEVEL_BATTLE_TYPE.LEVEL_BATTLE_TYPE_WORLD_BOSS);
                        //申请进入场景..
                        BundleGlobal.SetBundleDontUnload("UI/$FightUI.unity3d");
                        sdResourceMgr.Instance.LoadResource("UI/UIPrefab/$Fight.prefab", sdUIWorldBossWndBtn.OnLoadFightUI, null);
                        sdUILoading.ActiveLoadingUI("cave1", "凶恶的世界BOSS");
                        bossWnd.setbossmodelVisible(false);
                        bossWnd.m_bWorldBossAck = true;

                        sdActGameMgr.Instance.m_uuWorldBossLastBlood = sdActGameMgr.Instance.m_WorldBossInfo.m_Blood;
                        sdActGameMgr.Instance.m_uuWorldBossNowBlood  = sdActGameMgr.Instance.m_WorldBossInfo.m_Blood;
                    }
                }
            }
        }
    }
示例#9
0
    private static void OnMessage_SCID_LEVEL_ACK(int iMsgID, ref CMessage msg)
    {
        CliProto.SC_LEVEL_ACK refMSG = (CliProto.SC_LEVEL_ACK)msg;

        if (refMSG.m_LevelBattleType == (byte)HeaderProto.LEVEL_BATTLE_TYPE.LEVEL_BATTLE_TYPE_NORMAL)
        {
            if (refMSG.m_Result == 0)
            {
                sdGlobalDatabase.Instance.globalData["TuituAck"] = 1;
                sdLevelInfo.BeginLevel();
            }
            else
            {
                sdUILoading.UnactiveLoadingUI();
                sdUICharacter.Instance.ShowOkMsg(SGDP.ErrorString(refMSG.m_Result), null);
                return;
            }
        }
        else if (refMSG.m_LevelBattleType == (byte)HeaderProto.LEVEL_BATTLE_TYPE.LEVEL_BATTLE_TYPE_ABYSS)
        {
            GameObject     wnd     = sdGameLevel.instance.NGUIRoot;
            sdUILapBossWnd bossWnd = null;
            if (wnd)
            {
                bossWnd = wnd.GetComponentInChildren <sdUILapBossWnd>();
            }
            if (bossWnd == null)
            {
                return;
            }

            if (refMSG.m_Result == 0)
            {
                //申请进入场景..
                BundleGlobal.SetBundleDontUnload("UI/$FightUI.unity3d");
                sdResourceMgr.Instance.LoadResource("UI/UIPrefab/$Fight.prefab", sdUILapBossWndBtn.OnLoadFightUI, null);
                bossWnd.setbossmodelVisible(false);
                sdUILoading.ActiveLoadingUI("forest", "欢迎进入深渊BOSS领地");

                bossWnd.m_bTuituAck = true;
            }
            else
            {
                sdUILoading.UnactiveLoadingUI();
                bossWnd.setbossmodelVisible(true);
                SGDP.Error(refMSG.m_Result);
                return;
            }
        }
        else if (refMSG.m_LevelBattleType == (byte)HeaderProto.LEVEL_BATTLE_TYPE.LEVEL_BATTLE_TYPE_PET_TRAIN)
        {
            if (refMSG.m_Result == 0)
            {
                sdPTManager.Instance.m_nAttack = 0;
                sdNewPetMgr.Instance.OnEnterLevel();

                string    bundlePath = "";
                string    levelName  = "";
                int       index;
                Hashtable ptTable = sdConfDataMgr.Instance().GetTable("dmdsxactivitytemplateconfig.pttemplates");
                Hashtable table   = ptTable[sdPTManager.Instance.m_ChoiceLevel.ToString()] as Hashtable;
                int       level   = int.Parse(table["LevelID"].ToString());
                for (int i = 0; i < sdLevelInfo.levelInfos.Length; i++)
                {
                    if (sdLevelInfo.levelInfos[i].levelID == level)
                    {
                        string str = (string)sdLevelInfo.levelInfos[i].levelProp["Scene"];
                        bundlePath = str + ".unity.unity3d";
                        index      = str.LastIndexOf("/");
                        levelName  = str.Substring(index + 1);
                        break;
                    }
                }
                BundleGlobal.Instance.StartLoadBundleLevel(bundlePath, levelName);
            }
            else
            {
                sdUILoading.UnactiveLoadingUI();
                sdUICharacter.Instance.ShowOkMsg(SGDP.ErrorString(refMSG.m_Result), null);
                return;
            }
        }

        Debug.Log("tuitu ack");
        sdUICharacter.Instance.SetBattleType(refMSG.m_LevelBattleType);
        //sdUICharacter.Instance.SetFreeMedicineNum((int)refMSG.m_FreePotionCount);
        sdUICharacter.Instance.SetFreeReliveNum((int)refMSG.m_FreeReliveCount);
        //sdUICharacter.Instance.SetMedicinePrice((int)refMSG.m_PotionPrice);
        sdUICharacter.Instance.SetRelivePrice((int)refMSG.m_RelivePrice);

        // 初始化掉落表..
        CliProto.SMonsterInfos kSrcMonsterInfoList = refMSG.m_Monster;
        SDGlobal.msMonsterDropTable = new Hashtable();
        for (int i = 0; i < kSrcMonsterInfoList.m_Count; i++)
        {
            CliProto.SMonsterInfo kSrcMonsterInfo  = kSrcMonsterInfoList.m_List[i];
            CliProto.SDropInfos   kSrcMonsterDrops = kSrcMonsterInfo.m_Drop;

            SDMonsterDrop kMonsterDropItem = new SDMonsterDrop();
            kMonsterDropItem.money     = (int)kSrcMonsterDrops.m_Money;
            kMonsterDropItem.items     = new int[kSrcMonsterDrops.m_Count];
            kMonsterDropItem.itemCount = new int[kSrcMonsterDrops.m_Count];

            CliProto.SDropInfo[] kSrcMonsterDropInfo = kSrcMonsterDrops.m_List;
            for (int j = 0; j < kSrcMonsterDrops.m_Count; j++)
            {
                kMonsterDropItem.items[j]     = (int)kSrcMonsterDropInfo[j].m_TemplateID;
                kMonsterDropItem.itemCount[j] = kSrcMonsterDropInfo[j].m_Count;
            }

            SDGlobal.msMonsterDropTable[(uint)kSrcMonsterInfo.m_Index] = kMonsterDropItem;
        }

        int iCount = refMSG.m_InitialBuffCount;

        if (iCount != 0)
        {
            int[] buffArray = new int[iCount];
            for (int i = 0; i < iCount; i++)
            {
                buffArray[i] = (int)refMSG.m_InitialBuffID[i];
            }
            sdGlobalDatabase.Instance.globalData["InitBuff"] = buffArray;
        }
    }
示例#10
0
    // 触发事件(继承自BehaviourTrigger)aa
    public override void SyncUpdate(sdBehaviourStateBlock kBehaviourStateBlock)
    {
        if (kBehaviourStateBlock.BehaviourStateEventType != EBehaviourStateEventType.enBSET_HP)
        {
            return;
        }

        int   iMaxHP               = kBehaviourStateBlock.MaxHP;
        int   iLastHP              = kBehaviourStateBlock.PreviousHP;
        int   iCurrentHP           = iLastHP + kBehaviourStateBlock.ChangeHP;
        float fLastHPPercentage    = (float)iLastHP / (float)iMaxHP;
        float fCurrentHPPercentage = (float)iCurrentHP / (float)iMaxHP;

        if (fCurrentHPPercentage < mConditionPercent)
        {
            if (fLastHPPercentage >= mConditionPercent)
            {
                if (mBHPBTCType == EHPBehaviourTriggerCompareType.enBHPBTCT_Less)
                {
                    if (mIsTriggered != true)
                    {
                        mIsTriggered = true;
                        if (IsEnterTrigger && NotifyEnterTrigger != null)
                        {
                            if (!BundleGlobal.IsMobile())
                            {
                                //Debug.Log("sdHPBehaviourTrigger::NotifyEnterTrigger");
                            }
                            NotifyEnterTrigger(this);
                        }
                    }

                    if (mIsTriggered != false)
                    {
                        mIsTriggered = false;
                        if (IsLeaveTrigger && NotifyLeaveTrigger != null)
                        {
                            if (!BundleGlobal.IsMobile())
                            {
                                //Debug.Log("sdHPBehaviourTrigger::NotifyLeaveTrigger");
                            }
                            NotifyLeaveTrigger(this);
                        }
                    }
                }
            }
        }
        else
        {
            if (fLastHPPercentage < mConditionPercent)
            {
                if (mBHPBTCType == EHPBehaviourTriggerCompareType.enBHPBTCT_EqualBigger)
                {
                    if (mIsTriggered != true)
                    {
                        mIsTriggered = true;
                        if (IsEnterTrigger && NotifyEnterTrigger != null)
                        {
                            if (!BundleGlobal.IsMobile())
                            {
                                //Debug.Log("sdHPBehaviourTrigger::NotifyEnterTrigger");
                            }
                            NotifyEnterTrigger(this);
                        }
                    }

                    if (mIsTriggered != false)
                    {
                        mIsTriggered = false;
                        if (IsLeaveTrigger && NotifyLeaveTrigger != null)
                        {
                            if (!BundleGlobal.IsMobile())
                            {
                                //Debug.Log("sdHPBehaviourTrigger::NotifyLeaveTrigger");
                            }
                            NotifyLeaveTrigger(this);
                        }
                    }
                }
            }
        }
    }
示例#11
0
    IEnumerator UpdateProcess()
    {
        //APK Update
#if UNITY_ANDROID
        if (Application.platform == RuntimePlatform.Android)
        {
            glupgrade.gluInit();
            glupgrade.getCallback()._onDownloadChange = OnProcessChanged;
            glupgrade.getCallback()._onMD5CheckStart  = OnMD5CheckStart;
            glupgrade.getCallback()._onMD5CheckFinish = OnMD5CheckFinish;
            glupgrade.getCallback()._onDownloadStart  = OnDownloadStart;
            glupgrade.getCallback()._onDownloadFinish = OnDownloadFinished;
            if (m_slUpdateBar)
            {
                m_slUpdateBar.gameObject.SetActive(true);
                m_slUpdateBar.value = 0.0f;
            }

            bool ApkUpdate = false;
            while (true)
            {
                if (SDGlobal.apkUpdateEnable)
                {
                    if (!ApkUpdate)
                    {
                        int ret = glupgrade.checkNetworkStatus();
                        if (ret == 1)
                        {
                            Debug.Log("WiFi OK!");
                        }
                        else if (ret == 2)
                        {
                            Debug.Log("GPRS OK!");
                            //yield return new WaitForSeconds(10.0f);
                        }
                        else
                        {
                            sdUICharacter.Instance.ShowLoginMsg("APP更新:没有可使用的网络!3秒后重试。");
                            yield return(new WaitForSeconds(3.0f));

                            continue;
                        }

                        ApkUpdate = true;

                        ret = glupgrade.InitUpgradeEx(3000);
                        Debug.Log("InitUpgradeEx() return: " + ret);

                        if (ret == 0) // 不需要升级
                        {
                            Debug.Log("no app update");
                            break;
                        }
                        else if (ret == 1) // 强制升级
                        {
                            //sdUICharacter.Instance.ShowLoginMsg("New Version Founded, Please Waiting...");
                            glupgrade.startUpdate();
                        }
                        else if (ret == 2)// 非强制升级
                        {
                            Debug.Log("No Force Update");
                            //break;
                        }
                        else if (ret == 3)
                        {
                            sdUICharacter.Instance.ShowLoginMsg("APP更新:内部错误(访问升级接口httpCode非200)");
                            ApkUpdate = false;
                        }
                        else if (ret == 4)// 非强制升级
                        {
                            sdUICharacter.Instance.ShowLoginMsg("APP更新:内部错误(访问升级接口网络出错)");
                            ApkUpdate = false;
                        }
                        else if (ret == 5)// 非强制升级
                        {
                            sdUICharacter.Instance.ShowLoginMsg("APP更新:内部错误(JSON格式转换出错)");
                            ApkUpdate = false;
                        }
                        else if (ret == 6)// 非强制升级
                        {
                            sdUICharacter.Instance.ShowLoginMsg("APP更新:获取渠道打包信息失败!");
                            ApkUpdate = false;
                        }
                        else if (ret == 6)// 非强制升级
                        {
                            sdUICharacter.Instance.ShowLoginMsg("APP更新:手机SD卡不可用!");
                            ApkUpdate = false;
                        }
                        else
                        {
                            break;
                        }
                    }
                    yield return(new WaitForSeconds(5.0f));
                }
                else
                {
                    break;
                }
            }
        }
        if (m_slUpdateBar)
        {
            m_slUpdateBar.gameObject.SetActive(false);
        }
#endif

#if UNITY_IPHONE
#endif

        sdUICharacter.Instance.HideLoginMsg();

        if (Application.platform == RuntimePlatform.WindowsEditor)
        {
        }
        else
        {
            //读取分区信息..
            Debug.Log("Read Server Area Information");
            while (true)
            {
                string AreaID = BundleGlobal.AppVersion()["Area"];
                Debug.Log("AreaID=" + AreaID);
                WWW w = new WWW("http://180.96.39.128:8004/arealist?areaid=" + AreaID);
                yield return(w);

                if (w.error == null)
                {
                    JsonParse jp = new JsonParse();
                    jp.Parse(w.text);
                    BundleGlobal.Instance.cdn = jp.cdnlist.ToArray();
                    //BundleGlobal.Instance.
                    //jp.serverlist
                    SDNetGlobal.m_lstSrvInfo    = jp.serverlist;
                    SDNetGlobal.serverNotice    = jp.notice;
                    SDNetGlobal.defaultServerID = jp.defaultServer;

                    RefreshNotification(jp.Pushlist);
                    break;
                }
                else
                {
                    sdUICharacter.Instance.ShowLoginMsg("读取分区信息错误:" + w.error);
                }
            }
            GetSaveAreaInfo();
        }
        sdUICharacter.Instance.HideLoginMsg();

        //bbs
        if (SDNetGlobal.serverNotice.Length != 0)
        {
            sdUICharacter.Instance.ShowbbsWnd(true, SDNetGlobal.serverNotice, true, false);
        }

        //Update Bundle
        BundleGlobal.Instance.StartUpdateAllBundles();
        if (m_slUpdateBar)
        {
            m_slUpdateBar.gameObject.SetActive(true);
        }
        while (BundleGlobal.Instance.updating)
        {
            if (m_slUpdateBar && BundleGlobal.Instance.needDownLoadNum > 0)
            {
                m_slUpdateBar.value = (float)BundleGlobal.Instance.downloadedNum / (float)BundleGlobal.Instance.needDownLoadNum;
                if (m_slUpdateBar.value > 0 && m_slUpdateBar.value < 0.022f)
                {
                    m_slUpdateBar.value = 0.022f;
                }
            }
            if (m_lbUpdateInfo)
            {
                int Percent = BundleGlobal.Instance.GetBundlePercent();
                if (Percent == 100)
                {
                    Percent = 99;
                }
                string s = Percent + "%][";
                if (Percent < 10)
                {
                    s = "[0" + s;
                }
                else
                {
                    s = "[" + s;
                }
                m_lbUpdateInfo.text = "更新资源..." + s + BundleGlobal.Instance.downloadedNum + "/" + BundleGlobal.Instance.needDownLoadNum + "]";
            }
            yield return(0);
        }
        if (m_slUpdateBar)
        {
            m_slUpdateBar.gameObject.SetActive(false);
        }
        if (m_lbUpdateInfo)
        {
            m_lbUpdateInfo.text = "加载游戏配置文件...";
        }

        //Load All Config File
        LoadLevelConfig();

        while (m_strLevelConf == "" ||
               m_strLevelLang == "" ||
               m_strLevelMeta == "" ||
               m_strLevelBox == "")
        {
            yield return(0);
        }


        sdLevelInfo.LoadLevelConfig(m_strLevelConf, m_strLevelLang, m_strLevelMeta, m_strLevelBox);
        sdResourceDependenceTable.GetSingleton().LoadMonsterTable("$Conf/MonsterDependence.xml", false);
        sdResourceDependenceTable.GetSingleton().LoadMonsterTable("$Conf/PetDependence.xml", false);
        sdAITable.GetSingleton().LoadAITable("$Conf/AITable.xml", false);
        sdConfDataMgr.Instance().Init(false);

        while (!sdConfDataMgr.Instance().isInitFinish())
        {
            yield return(0);
        }
        sdUICharacter.Instance.HideLoginMsg();
        //Init GHOME GPUSH
        if (Application.platform == RuntimePlatform.Android ||
            Application.platform == RuntimePlatform.IPhonePlayer)
        {
            GHOME_CODE = -2;
            while (GHOME_CODE != 0)
            {
                if (GHOME_CODE == -2)
                {
                    GHOME_CODE = -1;
                    Debug.Log("InitGHome");
                    Init_GHOME_GPUSH();
                }
                else
                {
                    if (GHOME_CODE == 1)
                    {
                        Debug.Log("InitGHome Failed!");
                        GHOME_CODE = -2;
                    }
                    else
                    {
                        yield return(0);
                    }
                }
            }
            GPUSH_API.Init("791000015", "9728werwerwc53ba8cded5a6a2227dd8");
            sdUICharacter.Instance.HideLoginMsg();
        }
        else
        {
            m_btEnterGameButton.SetActive(false);
            SDGlobal.StartGetMacAddress();
        }
        if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
        {
            UILabel lb_srvName = m_btGameServer.transform.FindChild("Background").FindChild("Label").GetComponent <UILabel>();
            lb_srvName.text = SDNetGlobal.serverName;
        }

        StartCoroutine(LoginProcess());
    }
示例#12
0
    void LoginGHome(bool bActiveUI)
    {
        GHome.GetInstance().Login((code, msg, data) =>
        {
            Debug.Log("Login callback code: " + code + " msg: " + msg);
            if (code == 0)
            {
                GHome.GetInstance().LoginArea(BundleGlobal.AppVersion()["Area"]);

                Debug.Log("CallBack Success.");
                SDGlobal.phoneNumber = (string)data["userId"];
                SDGlobal.ticket      = (string)data["ticket"];
                if (bActiveUI)
                {
                    if (m_btEnterGameButton)
                    {
                        m_btEnterGameButton.SetActive(true);
                    }

                    if (m_btGameServer)
                    {
                        m_btGameServer.SetActive(true);
                    }
                    if (m_btSystemNotice)
                    {
                        m_btSystemNotice.SetActive(true);
                    }


                    if (m_btPlayVideo)
                    {
                        string str = sdConfDataMgr.Instance().GetSetting("firstEnter");
                        m_btPlayVideo.SetActive(str.Length != 0);
                    }
                }

                if (m_gHomeAccountButton)
                {
                    if (bActiveUI)
                    {
                        m_gHomeAccountButton.SetActive(true);
                    }
                    UILabel buttonLabel = m_gHomeAccountButton.GetComponentInChildren <UILabel>();
                    if (buttonLabel)
                    {
                        //buttonLabel.text = SDGlobal.phoneNumber.Replace("+86", "");
                    }
                }

                Debug.Log("CallBack Success. OK!");
                GHOME_CODE = 0;
            }
            else if (code == -1)
            {
                Debug.Log("code == -1");
                //GHOME_CODE = -1;
            }
            else
            {
                SDGlobal.gHomeLoginActivate = true;
                GHOME_CODE = 1;
                Debug.Log("Login Error Code=" + code);
            }
        });
    }
示例#13
0
    // Use this for initialization
    void Start()
    {
        // 初始化登录界面动画需要的变量.
        if (m_btEnterGameButton == null)
        {
            sdUICharacter.Instance.SelectSrvWnd = GameObject.Find("SelectServerWnd");
            GameObject obj;

            m_btEnterGameButton = GameObject.Find("bt_StartGame");
            if (m_btEnterGameButton)
            {
                m_btEnterGameButton.SetActive(false);
            }

            m_gHomeAccountButton = GameObject.Find("bt_Username");
            if (m_gHomeAccountButton)
            {
                m_gHomeAccountButton.SetActive(false);
            }

            m_btGameServer = GameObject.Find("bt_Server");
            if (m_btGameServer)
            {
                m_btGameServer.SetActive(false);
            }

            m_btPlayVideo = GameObject.Find("bt_PlayVideo");
            if (m_btPlayVideo)
            {
                m_btPlayVideo.SetActive(false);
            }

            m_btSystemNotice = GameObject.Find("bt_systemnotice");
            if (m_btSystemNotice != null)
            {
                m_btSystemNotice.SetActive(false);
            }

            string     verison       = BundleGlobal.AppVersion()["versionName"];
            GameObject Label_Version = GameObject.Find("Label_Version");
            if (Label_Version != null)
            {
                UILabel label = Label_Version.GetComponent <UILabel>();
                if (label != null)
                {
                    label.text = "Ver " + verison;
                }
            }

            m_userNameInput = GameObject.Find("Input");
            if (m_userNameInput)
            {
                // PC环境下使用非G加账号..
                if (Application.platform != RuntimePlatform.Android &&
                    Application.platform != RuntimePlatform.IPhonePlayer)
                {
                    m_userNameInput.SetActive(true);

                    FileStream file = null;
                    try
                    {
                        file = new FileStream("Assets/account.txt", FileMode.Open);
                    }
                    catch (System.Exception e)
                    {
                        Debug.Log(e.Message);
                    }

                    if (file != null)
                    {
                        byte[] data = new byte[file.Length];
                        file.Read(data, 0, (int)file.Length);
                        m_userNameInput.GetComponent <UIInput>().value = Encoding.UTF8.GetString(data);
                        file.Close();
                    }
                }
                else
                {
                    m_userNameInput.SetActive(false);
                }
            }

            obj = GameObject.Find("lb_UpdateBar");
            if (obj)
            {
                m_lbUpdateInfo = obj.GetComponent <UILabel>();
            }

            obj = GameObject.Find("pb_UpdateBar");
            if (obj)
            {
                m_slUpdateBar = obj.GetComponent <UISlider>();
            }
            if (m_slUpdateBar)
            {
                m_slUpdateBar.gameObject.SetActive(false);
            }

            obj = GameObject.Find("sp_fs0");
            if (obj)
            {
                m_spFS0 = obj.GetComponent <UISprite>();
            }
            obj = GameObject.Find("sp_fs1");
            if (obj)
            {
                m_spFS1 = obj.GetComponent <UISprite>();
            }

            obj = GameObject.Find("sp_zs0");
            if (obj)
            {
                m_spZS0 = obj.GetComponent <UISprite>();
            }
            obj = GameObject.Find("sp_zs1");
            if (obj)
            {
                m_spZS1 = obj.GetComponent <UISprite>();
            }
            obj = GameObject.Find("sp_zs2");
            if (obj)
            {
                m_spZS2 = obj.GetComponent <UISprite>();
            }

            obj = GameObject.Find("sp_ms0");
            if (obj)
            {
                m_spMS0 = obj.GetComponent <UISprite>();
            }
            obj = GameObject.Find("sp_ms1");
            if (obj)
            {
                m_spMS1 = obj.GetComponent <UISprite>();
            }
            obj = GameObject.Find("sp_ms2");
            if (obj)
            {
                m_spMS2 = obj.GetComponent <UISprite>();
            }

            obj = GameObject.Find("sp_yx0");
            if (obj)
            {
                m_spYX0 = obj.GetComponent <UISprite>();
            }
            obj = GameObject.Find("sp_yx1");
            if (obj)
            {
                m_spYX1 = obj.GetComponent <UISprite>();
            }
            obj = GameObject.Find("sp_yx2");
            if (obj)
            {
                m_spYX2 = obj.GetComponent <UISprite>();
            }
        }

        StartCoroutine(UpdateProcess());
    }