Merge branch 'master' of http://mobile.173on.com:10010/r/snxxz_scripts
| | |
| | | SnxxzGame.Instance.gameObject.name = "__SnxxzGame__";
|
| | | Screen.sleepTimeout = SleepTimeout.NeverSleep;
|
| | | SDKUtility.Instance.Init();
|
| | | Language.InitDefaultLanguage();
|
| | |
|
| | | var builtInAssetCopyTask = new BuiltInAssetCopyTask();
|
| | | var initSettingTask = new InitSettingTask();
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 计算总的预期时间
|
| | | /// </summary>
|
| | | void CalculateExpectTotalTime()
|
| | | {
|
| | | surplusTime = 0f;
|
| | |
| | |
|
| | | public class InitSettingTask : LaunchTask
|
| | | {
|
| | | public override float expectTime {
|
| | | public override float expectTime
|
| | | {
|
| | | get { return LocalSave.GetFloat("InitSettingTask_ExpectTime", 1f); }
|
| | | protected set { LocalSave.SetFloat("InitSettingTask_ExpectTime", value); }
|
| | | }
|
| | |
| | | {
|
| | | SnxxzGame.Instance.gameObject.AddComponent<PocoManager>();
|
| | | }
|
| | |
|
| | | done = true;
|
| | | }
|
| | |
|
| | |
| | |
|
| | | public class SDKInitedTask : LaunchTask
|
| | | {
|
| | | public override float expectTime {
|
| | | public override float expectTime
|
| | | {
|
| | | get { return LocalSave.GetFloat("SDKInitedTask_ExpectTime", 1f); }
|
| | | protected set { LocalSave.SetFloat("SDKInitedTask_ExpectTime", value); }
|
| | | }
|
| | |
| | | int totalCount = -1;
|
| | | List<FileInfo> copyTasks = new List<FileInfo>();
|
| | |
|
| | | public override float expectTime {
|
| | | public override float expectTime
|
| | | {
|
| | | get { return LocalSave.GetFloat("AssetCopyTask_ExpectTime", 70f); }
|
| | | protected set { LocalSave.SetFloat("AssetCopyTask_ExpectTime", value); }
|
| | | }
|
| | |
| | |
|
| | | public class AssetDecompressTask : LaunchTask
|
| | | {
|
| | | public override float expectTime {
|
| | | public override float expectTime
|
| | | {
|
| | | get { return LocalSave.GetFloat("AssetDecompressTask_ExpectTime", 5f); }
|
| | | protected set { LocalSave.SetFloat("AssetDecompressTask_ExpectTime", value); }
|
| | | }
|
| | |
| | |
|
| | | public class GetVersionInfoTask : LaunchTask
|
| | | {
|
| | | public override float expectTime {
|
| | | public override float expectTime
|
| | | {
|
| | | get { return LocalSave.GetFloat("GetVersionInfoTask_ExpectTime", 1f); }
|
| | | protected set { LocalSave.SetFloat("GetVersionInfoTask_ExpectTime", value); }
|
| | | }
|
| | |
| | |
|
| | | public class CheckAssetValidTask : LaunchTask
|
| | | {
|
| | | public override float expectTime {
|
| | | public override float expectTime
|
| | | {
|
| | | get { return LocalSave.GetFloat("CheckAssetValidTask_ExpectTime", 3f); }
|
| | | protected set { LocalSave.SetFloat("CheckAssetValidTask_ExpectTime", value); }
|
| | | }
|
| | |
| | |
|
| | | public class DownLoadAssetTask : LaunchTask
|
| | | {
|
| | | public override float expectTime {
|
| | | public override float expectTime
|
| | | {
|
| | | get { return LocalSave.GetFloat("DownLoadAssetTask_ExpectTime", 3f); }
|
| | | protected set { LocalSave.SetFloat("DownLoadAssetTask_ExpectTime", value); }
|
| | | }
|
| | |
| | |
|
| | | public class AssetBundleInitTask : LaunchTask
|
| | | {
|
| | | public override float expectTime {
|
| | | public override float expectTime
|
| | | {
|
| | | get { return LocalSave.GetFloat("AssetBundleInitTask_ExpectTime", 1f); }
|
| | | protected set { LocalSave.SetFloat("AssetBundleInitTask_ExpectTime", value); }
|
| | | }
|
| | |
| | |
|
| | | public class ConfigInitTask : LaunchTask
|
| | | {
|
| | | public override float expectTime {
|
| | | public override float expectTime
|
| | | {
|
| | | get { return LocalSave.GetFloat("ConfigInitTask_ExpectTime", 10f); }
|
| | | protected set { LocalSave.SetFloat("ConfigInitTask_ExpectTime", value); }
|
| | | }
|
| | |
| | |
|
| | | public class LaunchFadeOutTask : LaunchTask
|
| | | {
|
| | | public override float expectTime {
|
| | | public override float expectTime
|
| | | {
|
| | | get { return LocalSave.GetFloat("LaunchFadeOutTask_ExpectTime", 1f); }
|
| | | protected set { LocalSave.SetFloat("LaunchFadeOutTask_ExpectTime", value); }
|
| | | }
|
| | |
| | | }
|
| | | timer += Time.deltaTime;
|
| | |
|
| | | if (timer >=0.5f)
|
| | | if (timer >= 0.5f)
|
| | | {
|
| | | done = true;
|
| | | }
|
| | |
| | | if (check && VersionUtility.Instance.NeedDownAsset())
|
| | | {
|
| | | checkAssetVersionTimer += Time.time + 10f;
|
| | | var assetVersionUrl = StringUtility.Contact(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), "/", "AssetsVersion.txt");
|
| | | var assetVersionUrl = StringUtility.Contact(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), "/",Language.Id, "/AssetsVersion.txt");
|
| | | HttpRequest.Instance.RequestHttpGet(assetVersionUrl, HttpRequest.defaultHttpContentType, 3, OnGetAssetVersionFile);
|
| | | }
|
| | | }
|
| | |
| | | {
|
| | | checkAssetCompleted = false;
|
| | | Debug.LogFormat("开始获取资源版本文件:时间 {0}", DateTime.Now);
|
| | | var assetVersionUrl = StringUtility.Contact(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), "/", "AssetsVersion.txt");
|
| | | var assetVersionUrl = StringUtility.Contact(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), "/", Language.Id,"/AssetsVersion.txt");
|
| | | HttpRequest.Instance.RequestHttpGet(assetVersionUrl, HttpRequest.defaultHttpContentType, 3, OnGetAssetVersionFile);
|
| | | }
|
| | |
|
| | |
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | public class DownLoadAndDiscompressTask : Singleton<DownLoadAndDiscompressTask>
|
| | | |
| | |
|
| | | {
|
| | | public const int BYTE_PER_KILOBYTE = 1024;
|
| | | public const int BYTE_PER_MILLIONBYTE = 1048576;
|
| | |
| | | {
|
| | | var assetVersion = tasks[i];
|
| | |
|
| | | var remoteURL = StringUtility.Contact(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), "/", assetVersion.relativePath);
|
| | | var remoteURL = StringUtility.Contact(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), "/",Language.Id,"/", assetVersion.relativePath);
|
| | | var localURL = StringUtility.Contact(ResourcesPath.Instance.ExternalStorePath, assetVersion.relativePath);
|
| | |
|
| | | var remoteFile = new RemoteFile();
|
| | |
| | | else
|
| | | {
|
| | | ExceptionCatcher.ReportException("游戏启动阶段文件下载失败", "文件名:" + _assetVersion.relativePath);
|
| | | var remoteURL = StringUtility.Contact(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), "/", _assetVersion.relativePath);
|
| | | var remoteURL = StringUtility.Contact(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), "/",Language.Id,"/", _assetVersion.relativePath);
|
| | | var localURL = StringUtility.Contact(ResourcesPath.Instance.ExternalStorePath, _assetVersion.relativePath);
|
| | |
|
| | | var remoteFile = new RemoteFile();
|
| | |
| | | while (workingQueue.Count < maxWorkingTask && downLoadTasksQueues.Count > 0)
|
| | | {
|
| | | var assetVersion = downLoadTasksQueues.Dequeue();
|
| | | var remoteURL = StringUtility.Contact(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), "/", assetVersion.relativePath);
|
| | | var remoteURL = StringUtility.Contact(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), "/",Language.Id,"/",assetVersion.relativePath);
|
| | | var localURL = StringUtility.Contact(ResourcesPath.Instance.ExternalStorePath, assetVersion.relativePath);
|
| | |
|
| | | var remoteFile = new RemoteFile();
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | var remoteURL = StringUtility.Contact(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), "/", _assetVersion.relativePath);
|
| | | var remoteURL = StringUtility.Contact(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), "/",Language.Id,"/",_assetVersion.relativePath);
|
| | | var localURL = StringUtility.Contact(ResourcesPath.Instance.ExternalStorePath, _assetVersion.relativePath);
|
| | |
|
| | | var remoteFile = new RemoteFile();
|
| | |
| | |
|
| | | public string androidRoot { get { return StringUtility.Contact(SDKUtility.Instance.DeviceRootPath, "/", VersionConfig.Get().bundleIdentifier); } }
|
| | |
|
| | | public float progress {
|
| | | public float progress
|
| | | {
|
| | | get { return RemoteFile.TotalDownloadedSize / ((float)GetApkSize() * 1024); }
|
| | | }
|
| | |
|
| | |
| | | public bool completed { get { return step == Step.Completed; } }
|
| | |
|
| | | Step m_Step = Step.None;
|
| | | public Step step {
|
| | | public Step step
|
| | | {
|
| | | get { return m_Step; }
|
| | | private set {
|
| | | private set
|
| | | {
|
| | | if (m_Step != value)
|
| | | {
|
| | | m_Step = value;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 是否为ios审核时间内
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | public bool InIosAuditTime()
|
| | | {
|
| | | DateTime dateTime;
|
| | |
| | | [XLua.LuaCallCSharp]
|
| | | public static class Language
|
| | | {
|
| | | public static int languageNumber {
|
| | | public static int languageNumber
|
| | | {
|
| | | get;
|
| | | set;
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | //默认ID
|
| | | private static string defaultId
|
| | | {
|
| | | get { return PriorLanguageConfig.Get("36").Content; }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 根据系统语言自动设置默认语言
|
| | | /// </summary>
|
| | | public static void InitDefaultLanguage()
|
| | | {
|
| | | Debug.LogFormat("系统语言:{0}", Application.systemLanguage);
|
| | | var id = LocalSave.GetString("LANGUAGE_ID");
|
| | | if (!string.IsNullOrEmpty(id))
|
| | | return;
|
| | | switch (Application.systemLanguage)
|
| | | {
|
| | | case SystemLanguage.Chinese:
|
| | | case SystemLanguage.ChineseSimplified:
|
| | | {
|
| | | Id = "jt";
|
| | | break;
|
| | | }
|
| | | case SystemLanguage.ChineseTraditional:
|
| | | {
|
| | | Id = "ft";
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 语言的ID,用于区分下载资源
|
| | | /// </summary>
|
| | | /// <value></value>
|
| | | public static string Id
|
| | | {
|
| | | get
|
| | | {
|
| | | var id = LocalSave.GetString("LANGUAGE_ID");
|
| | | if (string.IsNullOrEmpty(id))
|
| | | id = defaultId;
|
| | | return id;
|
| | | }
|
| | | set
|
| | | {
|
| | | LocalSave.SetString("LANGUAGE_ID", value);
|
| | | }
|
| | | }
|
| | |
|
| | | public static string Get(string _id)
|
| | | {
|
| | | var languageInfo = LanguageConfig.Get(_id);
|
| | |
| | |
|
| | | [SerializeField] Text m_PlayerInfoText;
|
| | | [SerializeField] Button m_CopyBtn;
|
| | | [SerializeField] Button m_LanguageDropdown;
|
| | | [SerializeField] Text m_LDLabel;
|
| | | [SerializeField] Button m_LDTemplate;
|
| | | [SerializeField] GameObject m_LDListView;
|
| | |
|
| | | #endregion
|
| | |
|
| | |
| | | private string copyContent;
|
| | | LoginModel loginModel { get { return ModelCenter.Instance.GetModel<LoginModel>(); } }
|
| | |
|
| | |
|
| | | protected override void BindController()
|
| | | {
|
| | | }
|
| | |
|
| | | protected override void AddListeners()
|
| | | {
|
| | | isInited = false;
|
| | |
| | | m_LockScreenBtn.AddListener(ClickLockScreen);
|
| | | m_CopyBtn.AddListener(ClickCopyBtn);
|
| | | m_AntiAddition.AddListener(AntiAdditction);
|
| | |
|
| | | m_LanguageDropdown.onClick.AddListener(() =>
|
| | | {
|
| | | m_LDListView.SetActive(!m_LDListView.activeInHierarchy);
|
| | | });
|
| | | }
|
| | |
|
| | | protected override void OnPreOpen()
|
| | |
| | | SystemSetting.Instance.playerSyncCountChangeEvent -= OnPlayerSyncCountChange;
|
| | | SystemSetting.Instance.SetPlayerSyncCount(playerSyncCountRef);
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose()
|
| | | {
|
| | | m_LDListView.SetActive(true);
|
| | | }
|
| | |
|
| | | protected override void OnActived()
|
| | | {
|
| | | base.OnActived();
|
| | |
| | | UpdateToggleSkin(m_LowQuality);
|
| | | UpdateToggleSkin(m_OtherPlayer);
|
| | | UpdateToggleSkin(m_Monster);
|
| | |
|
| | | InitLanguageOptions();
|
| | |
|
| | | m_SixtyFrame.isOn = SystemSetting.Instance.GetGameFps() == GameFps.Full;
|
| | |
|
| | |
| | | isInited = true;
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化语言选项
|
| | | /// /// </summary>
|
| | | private void InitLanguageOptions()
|
| | | {
|
| | | var json = LitJson.JsonMapper.ToObject(FuncConfigConfig.Get("LanguageOptions").Numerical1);
|
| | | m_LDListView.transform.ClearAllChilds();
|
| | | m_LDLabel.text = "未知";
|
| | | m_LDListView.SetActive(false);
|
| | | foreach (var key in json.Keys)
|
| | | {
|
| | | var label = (string)json[key];
|
| | | if (key == Language.Id)
|
| | | m_LDLabel.text = label;
|
| | | var item = GameObject.Instantiate(m_LDTemplate, m_LDListView.transform);
|
| | | item.SetActive(true);
|
| | | (item.FindComponent("Text", "Text") as Text).text = label;
|
| | | var lgId = key;
|
| | | item.onClick.AddListener(() =>
|
| | | {
|
| | | OnDropdownChanged(lgId, label);
|
| | | });
|
| | | }
|
| | | }
|
| | |
|
| | | public void OnDropdownChanged(string lgId, string label)
|
| | | {
|
| | | m_LDListView.SetActive(false);
|
| | | Language.Id = lgId;
|
| | | m_LDLabel.text = label;
|
| | | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("language_tip_info"), (yes) =>
|
| | | {
|
| | | Debug.LogFormat("退出!:{0}", yes);
|
| | | if (yes)
|
| | | {
|
| | |
|
| | | #if UNITY_EDITOR
|
| | | UnityEditor.EditorApplication.isPlaying = false;
|
| | | #else
|
| | | Application.Quit();
|
| | | #endif
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | private void ClickCopyBtn()
|
| | | {
|
| | | SDKUtility.Instance.CopyContent(copyContent);
|
| | |
| | | public static class TransformExtension |
| | | { |
| | | |
| | | |
| | | [XLua.LuaCallCSharp] |
| | | public static void ClearAllChilds(this Transform transform) |
| | | { |
| | | var count = transform.childCount; |
| | | for (var i = 0; i < count; i++) |
| | | { |
| | | GameObject.Destroy(transform.GetChild(i).gameObject); |
| | | } |
| | | } |
| | | |
| | | [XLua.LuaCallCSharp] |
| | | public static void SetParentEx(this Transform transform, Transform parent, Vector3 localPosition, Quaternion rotation, Vector3 scale) |
| | | { |