Beispiel #1
0
    protected override IEnumerator Task()
    {
        LogTool.Log($"{TaskName.Value}", LogEnum.TaskLog);
        yield return(new WaitForFixedUpdate());

        var info = new string[]
        {
            "设备模型 : " + SystemInfo.deviceModel,
            "设备名称 : " + SystemInfo.deviceName,
            "设备类型 : " + SystemInfo.deviceType,
            "系统内存大小MB(int) : " + SystemInfo.systemMemorySize,
            "操作系统(string) : " + SystemInfo.operatingSystem,
            "设备唯一标识符(string) : " + SystemInfo.deviceUniqueIdentifier,
            "显卡ID(int) : " + SystemInfo.graphicsDeviceID,
            "显卡名称(string) : " + SystemInfo.graphicsDeviceName,
            "显卡类型(enum) : " + SystemInfo.graphicsDeviceType,
            "显卡供应商(string) : " + SystemInfo.graphicsDeviceVendor,
            "显卡供应唯一ID(int) : " + SystemInfo.graphicsDeviceVendorID,
            "显卡版本号(int) : " + SystemInfo.graphicsDeviceVersion,
            "显存大小MB(int) : " + SystemInfo.graphicsMemorySize,
            "显卡是否支持多线程渲染(bool) : " + SystemInfo.graphicsMultiThreaded,
            "支持的渲染目标数量(int) : " + SystemInfo.supportedRenderTargetCount,
            "显示器分辨率:" + string.Format("{0} * {1}", Screen.width, Screen.height),
        };
        var sb = new StringBuilder();

        foreach (var data in info)
        {
            sb.Append(data + " || ");
        }

        LogTool.Log(sb.ToString(), LogEnum.TaskLog);
        //TODO 后面插件保存,暂时方案,以设备默认分辨率为1
        try
        {
            var with   = SaveDataMgr.Instance().GetSaveData <int>(SaveEnum.ResolutionWidth);
            var height = SaveDataMgr.Instance().GetSaveData <int>(SaveEnum.ResolutionHeight);
            var frame  = SaveDataMgr.Instance().GetSaveData <int>(SaveEnum.FrameRate);
            var full   = SaveDataMgr.Instance().GetSaveData <int>(SaveEnum.Fullscreen);
            //TODO 根据内置设置设定来
            if (false)
            {
                MachineUtil.Resolution(with, height, Convert.ToBoolean(full), frame);
            }
            else
            {
                MachineUtil.Resolution((int)MachineUtil.ScreenWH.x, (int)MachineUtil.ScreenWH.y, Convert.ToBoolean(full), frame);
            }
        }
        catch (Exception e)
        {
            Console.WriteLine(e);
            throw;
        }

        IsFinish = true;
    }
Beispiel #2
0
    private void Awake()
    {
        if (_inited)
        {
            return;
        }

        Instance = this;

#if !UNITY_EDITOR
        AssetBundleManager.Initialize();
#endif

        var spriteMgr = Resources.FindObjectsOfTypeAll <SpriteAtlasMgr>();
        if (spriteMgr.Length == 0)
        {
            gameObject.AddComponent <SpriteAtlasMgr>();
        }

        //读取存档
        SaveDataMgr.PreloadGameData();

        //初始化游戏设置
        GameSetting.InitSetting();

        //初始化sound模块
        SoundListenter.Init();

        //初始化资源管理器
        ResourceMgr.InitInstance();


        CoroutineStart = StartCoroutine;
        DefaultRes     = GetComponent <DefaultRes>();

        //初始化UI
        var uguiRoot = FindObjectOfType <UiRootScript>();
        uguiRoot.Init();
        UiManager.Init(uguiRoot);
        DontDestroyOnLoad(uguiRoot);
        DontDestroyOnLoad(gameObject);

        //清理缓存
        Caching.ClearCache();


        UnityEngine.Random.InitState(DateTime.Now.Second);

#if !UNITY_EDITOR && UNITY_ANDROID
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
#endif
        _inited = true;


        FirstStartGame();
    }
Beispiel #3
0
 void Update()
 {
     if (!_inited)
     {
         return;
     }
     TimeScaleManager.Update();
     SaveDataMgr.Update();
     UiManager.Update();
 }
Beispiel #4
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(this);
     }
     else
     {
         if (this != instance)
             Destroy(this.gameObject);
     }
 }