Пример #1
0
    public IEnumerator InitUI()
    {
        var root = GameObject.Find("UIRoot");

        if (null == root)
        {
            var prefabPath = "UI/UIRoot";
            var ret        = ResourceManager.PrepareResourceWithHolder <GameObject>(prefabPath);
            yield return(ret.Wait());

            root = Instantiate(ret.Resource) as GameObject;
        }

        //var rootLogic = root.AddComponent<UIRootLogic>();
        var camera = root.gameObject.transform.Find("Camera").gameObject;

        UIManager.Instance.ResetUIRoot(root, camera.GetComponent <Camera>());

        UIManager.Instance.GetController(UIConfig.MainUI).RefreshData(null);
        var co = StartCoroutine(UIManager.Instance.ShowUICoroutine(UIConfig.MainUI));

        yield return(co);


        //EventDispatcher.Instance.DispatchEvent(new Show_UI_Event(UIConfig.MianUI));
        //EventDispatcher.Instance.DispatchEvent(new Show_UI_Event(UIConfig.MissionTrackList));
        //InputManager.Instance.OnMoveDestination = MoveTo;
        //UIManager.Instance.JoyStick.GetComponent<JoyStickLogic>().OnMoveDirection = MoveDirection;
        //JoyStickLogic.Instance().OnMoveDirection = MoveDirection;
        //UIManager.Instance.SkillBar.GetComponent<SkillBarLogic>().OnClickEvent = OnClickEvent;

        DebugHelper.CreateDebugHelper();

        if (IsFristLogin)
        {
            //初始化推送
            EventDispatcher.Instance.DispatchEvent(new UIEvent_RefreshPush(-1, 0));

            if (PlayerDataManager.Instance.CheckCondition(40000) == 0)
            {
                UIManager.Instance.ShowUI(UIConfig.RewardFrame, new UIRewardFrameArguments
                {
                    Tab = 2
                });
                IsFristLogin = false;
            }

            //统计数据forkuaifa
            var characterId   = PlayerDataManager.Instance.GetGuid().ToString();
            var characterName = PlayerDataManager.Instance.PlayerDataModel.CharacterBase.Name;
            var level         = PlayerDataManager.Instance.GetLevel();
            var serverId      = PlayerDataManager.Instance.ServerId.ToString();
            var serverName    = PlayerDataManager.Instance.ServerName;
            var vipLevel      = PlayerDataManager.Instance.GetRes((int)eResourcesType.VipLevel);
            var battleName    = PlayerDataManager.Instance.BattleName;
            var ts            = PlayerDataManager.Instance.CharacterFoundTime - DateTime.Parse("1970-1-1");
            var time          = (int)ts.TotalSeconds;
            PlatformHelper.CollectionEnterGameDataForKuaifa(characterId, characterName, level, serverId, serverName, vipLevel, battleName, time.ToString());
        }
    }
Пример #2
0
    public IEnumerator InitUI()
    {
        //UIManager.Instance.CreatePrelayer();
        UIManager.Instance.GetController(UIConfig.MainUI).RefreshData(null);
        var showUiCoroutine = StartCoroutine(UIManager.Instance.ShowUICoroutine(UIConfig.MainUI));

        yield return(showUiCoroutine);

        UIManager.Instance.OnEnterScene();

        HeadBoardManager.Instance.Init();
        DamageBoardManager.Instance.Init();
        GainItemTipManager.Instance.Init();
        UIHintBoardManager.Instance.Init();

        DebugHelper.CreateDebugHelper();


        if (IsFristLogin)
        {
            //初始化推送
            EventDispatcher.Instance.DispatchEvent(new UIEvent_RefreshPush(-1, 0));



//             if (PlayerDataManager.Instance.CheckCondition(40000) == 0)
//             {
//                 UIManager.Instance.ShowUI(UIConfig.RewardFrame, new UIRewardFrameArguments
//                 {
//                     Tab = 2
//                 });
//                 IsFristLogin = false;
//             }

            //统计数据forkuaifa
            var characterId   = PlayerDataManager.Instance.GetGuid().ToString();
            var characterName = PlayerDataManager.Instance.PlayerDataModel.CharacterBase.Name;
            var level         = PlayerDataManager.Instance.GetLevel();
            var serverId      = PlayerDataManager.Instance.ServerId.ToString();
            var serverName    = PlayerDataManager.Instance.ServerName;
            var vipLevel      = PlayerDataManager.Instance.GetRes((int)eResourcesType.VipLevel);
            var battleName    = PlayerDataManager.Instance.BattleName;
            var ts            = PlayerDataManager.Instance.CharacterFoundTime - DateTime.Parse("1970-1-1");
            var time          = (int)ts.TotalSeconds;
            var diamond       = PlayerDataManager.Instance.GetRes((int)eResourcesType.DiamondRes);

            var timeLevel       = DateTime.Now - DateTime.Parse("1970-1-1");
            var timeLevelSecond = (int)timeLevel.TotalSeconds;
            var levelupTime     = PlayerPrefs.GetString(characterName + "timeLv", timeLevelSecond.ToString());

            PlatformHelper.CollectionEnterGameDataForKuaifa(characterId, characterName, level, serverId, serverName, vipLevel, battleName, time.ToString(), diamond.ToString(), levelupTime);
        }
    }