Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
| | |
| | | EditorGUILayout.EndHorizontal();
|
| | |
|
| | | EditorGUILayout.Space();
|
| | |
|
| | | EditorGUILayout.Space();
|
| | | EditorGUILayout.Space();
|
| | | #if UNITY_ANDROID
|
| | | GUILayout.BeginHorizontal();
|
| | | EditorGUILayout.TextField("Apk Output Path", ApkOutputPath);
|
| | |
| | |
|
| | | EditorGUILayout.Space();
|
| | |
|
| | | ClientPackage.auditOutTime = EditorGUILayout.TextField("AppStore Review OutTime",ClientPackage.auditOutTime, GUILayout.Height(20));
|
| | | #if UNITY_IOS
|
| | | ClientPackage.auditOutTime = EditorGUILayout.TextField("AppStore OutTime", ClientPackage.auditOutTime, GUILayout.Height(20));
|
| | | EditorGUILayout.Space();
|
| | | #endif
|
| | | GUILayout.BeginHorizontal();
|
| | | ClientPackage.AssetPrior = EditorGUILayout.IntField("AssetPrior", ClientPackage.AssetPrior, GUILayout.Height(50), GUILayout.Width(250));
|
| | | publishers = EditorGUILayout.TextField("Publishers", publishers, GUILayout.Height(50));
|
| | | GUILayout.EndHorizontal();
|
| | |
|
| | | EditorGUILayout.Space();
|
| | | GUILayout.BeginHorizontal();
|
| | |
|
| | | ClientPackage.obfuscatorEnabled = EditorGUILayout.Toggle("obfuscator enable ", ClientPackage.obfuscatorEnabled);
|
| | | ClientPackage.obfuscatorEnabled = EditorGUILayout.Toggle("Obfuscator Enable ", ClientPackage.obfuscatorEnabled, GUILayout.Width(250));
|
| | |
|
| | | #if UNITY_ANDROID
|
| | | if (GUILayout.Button("APK"))
|
| | |
| | | #if UNITY_ANDROID && !UNITY_EDITOR
|
| | | if (!SDKUtility.builtinAssetCopyFinished)
|
| | | {
|
| | | SDKUtility.Instance.CopyOneAsset("builtin_assetbundle");
|
| | | SDKUtility.Instance.CopyOneAsset("builtin_assetbundle.manifest");
|
| | | SDKUtility.Instance.CopyOneAsset("builtin/music");
|
| | | SDKUtility.Instance.CopyOneAsset("builtin/music.manifest");
|
| | | SDKUtility.Instance.CopyOneAsset("builtin/prefabs");
|
| | | SDKUtility.Instance.CopyOneAsset("builtin/prefabs.manifest");
|
| | | SDKUtility.Instance.CopyOneAsset("builtin/sprite");
|
| | | SDKUtility.Instance.CopyOneAsset("builtin/sprite.manifest");
|
| | | SDKUtility.Instance.CopyOneAsset("config/Contact.txt");
|
| | | SDKUtility.Instance.CopyOneAsset("config/HelpInfo.txt");
|
| | | SDKUtility.Instance.CopyOneAsset("config/PriorBundle.txt");
|
| | | SDKUtility.Instance.CopyOneAsset("config/PriorLanguage.txt");
|
| | | SDKUtility.Instance.CopyOneAsset("builtin_assetbundle.7z");
|
| | | SDKUtility.Instance.CopyOneAsset("builtin_assetbundle.manifest.7z");
|
| | | SDKUtility.Instance.CopyOneAsset("builtin/music.7z");
|
| | | SDKUtility.Instance.CopyOneAsset("builtin/music.manifest.7z");
|
| | | SDKUtility.Instance.CopyOneAsset("builtin/prefabs.7z");
|
| | | SDKUtility.Instance.CopyOneAsset("builtin/prefabs.manifest.7z");
|
| | | SDKUtility.Instance.CopyOneAsset("builtin/sprite.7z");
|
| | | SDKUtility.Instance.CopyOneAsset("builtin/sprite.manifest.7z");
|
| | | SDKUtility.Instance.CopyOneAsset("config/Contact.txt.7z");
|
| | | SDKUtility.Instance.CopyOneAsset("config/HelpInfo.txt.7z");
|
| | | SDKUtility.Instance.CopyOneAsset("config/PriorBundle.txt.7z");
|
| | | SDKUtility.Instance.CopyOneAsset("config/PriorLanguage.txt.7z");
|
| | |
|
| | | AssetDeCompressTask.Decompress(ResourcesPath.Instance.ExternalStorePath);
|
| | | LocalSave.SetString("BuiltInAssetCopyCompleted_Android", VersionConfig.Get().version);
|
| | | }
|
| | | #endif
|
| | |
| | | progress = Mathf.Clamp(progressBuf + timer / duration * 0.3f, progressBuf, progressBuf + 0.3f);
|
| | | yield return null;
|
| | | }
|
| | |
|
| | | progressBuf = progress;
|
| | | var decompressProgress = AssetDeCompressTask.DecompressAync(ResourcesPath.Instance.ExternalStorePath);
|
| | | while (!decompressProgress.done)
|
| | | {
|
| | | progress = progressBuf + decompressProgress.progress * 0.1f;
|
| | | yield return null;
|
| | | }
|
| | | }
|
| | | break;
|
| | | case InstalledAsset.NullAsset:
|
| | |
| | | DirtyNameConfig.Init();
|
| | | NewBieCenter.Instance.Init();
|
| | |
|
| | | if (Application.isMobilePlatform)
|
| | | {
|
| | | AssetDeCompressTask.Delete7zFiles(ResourcesPath.Instance.ExternalStorePath);
|
| | | }
|
| | |
|
| | | DebugEx.LogFormat("解析配置表耗时:{0}", Time.time - startTime);
|
| | | }
|
| | | catch (Exception ex)
|
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Wednesday, July 25, 2018 |
| | | //-------------------------------------------------------- |
| | | |
| | | using UnityEngine; |
| | | using System; |
| | | |
| | | namespace TableConfig { |
| | | |
| | | |
| | | //--------------------------------------------------------
|
| | | // [Author]: 第二世界
|
| | | // [ Date ]: Thursday, November 01, 2018
|
| | | //--------------------------------------------------------
|
| | |
|
| | | using UnityEngine;
|
| | | using System;
|
| | |
|
| | | namespace TableConfig {
|
| | |
|
| | | |
| | | public partial class PriorBundleConfig : ConfigBase {
|
| | |
|
| | | public int id { get ; private set ; }
|
| | | public string AssetABName { get ; private set; }
|
| | | public int AssetType { get ; private set ; }
|
| | | |
| | | public int Prior { get ; private set ; }
|
| | |
|
| | | public override string getKey()
|
| | | {
|
| | | return id.ToString();
|
| | | } |
| | | |
| | | public override void Parse() { |
| | | }
|
| | |
|
| | | public override void Parse() {
|
| | | try
|
| | | {
|
| | | id=IsNumeric(rawContents[0]) ? int.Parse(rawContents[0]):0;
|
| | |
| | | AssetABName = rawContents[1].Trim();
|
| | |
|
| | | AssetType=IsNumeric(rawContents[2]) ? int.Parse(rawContents[2]):0;
|
| | | |
| | | Prior=IsNumeric(rawContents[3]) ? int.Parse(rawContents[3]):0; |
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | DebugEx.Log(ex);
|
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | }
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
| | | fileFormatVersion: 2 |
| | | guid: 949b242ddea04fe418ea4647b082dcb7 |
| | | timeCreated: 1532484855 |
| | | timeCreated: 1541037151 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | |
| | | {
|
| | | public partial class PriorBundleConfig : ConfigBase
|
| | | {
|
| | | static List<string> m_Audios;
|
| | | public static List<string> audios {
|
| | | get {
|
| | | if (!inited)
|
| | | {
|
| | | Init();
|
| | | }
|
| | | return m_Audios;
|
| | | }
|
| | | }
|
| | |
|
| | | static List<string> m_Effects;
|
| | | public static List<string> effects {
|
| | | get {
|
| | | if (!inited)
|
| | | {
|
| | | Init();
|
| | | }
|
| | | return m_Effects;
|
| | | }
|
| | | }
|
| | |
|
| | | static List<string> m_Scenes;
|
| | | public static List<string> scenes {
|
| | | get {
|
| | | if (!inited)
|
| | | {
|
| | | Init();
|
| | | }
|
| | | return m_Scenes;
|
| | | }
|
| | | }
|
| | |
|
| | | static List<string> m_Mobs;
|
| | | public static List<string> mobs {
|
| | | get {
|
| | | if (!inited)
|
| | | {
|
| | | Init();
|
| | | }
|
| | | return m_Mobs;
|
| | | }
|
| | | }
|
| | | static Dictionary<string, PriorBundleConfig> m_Audios = new Dictionary<string, PriorBundleConfig>();
|
| | | static Dictionary<string, PriorBundleConfig> m_Effects = new Dictionary<string, PriorBundleConfig>();
|
| | | static Dictionary<string, PriorBundleConfig> m_Scenes = new Dictionary<string, PriorBundleConfig>();
|
| | | static Dictionary<string, PriorBundleConfig> m_Mobs = new Dictionary<string, PriorBundleConfig>();
|
| | |
|
| | | static bool inited = false;
|
| | |
|
| | | static void Init()
|
| | | {
|
| | | var values = Config.Instance.GetAllValues<PriorBundleConfig>();
|
| | | m_Audios = new List<string>();
|
| | | m_Effects = new List<string>();
|
| | | m_Scenes = new List<string>();
|
| | | m_Mobs = new List<string>();
|
| | |
|
| | | foreach (var value in values)
|
| | | {
|
| | | switch (value.AssetType)
|
| | | {
|
| | | case 1:
|
| | | m_Scenes.Add(value.AssetABName.ToLower());
|
| | | m_Scenes[value.AssetABName.ToLower()] = value;
|
| | | break;
|
| | | case 2:
|
| | | m_Mobs.Add(value.AssetABName.ToLower());
|
| | | m_Mobs[value.AssetABName.ToLower()] = value;
|
| | | break;
|
| | | case 3:
|
| | | m_Audios.Add(value.AssetABName.ToLower());
|
| | | m_Audios[value.AssetABName.ToLower()] = value;
|
| | | break;
|
| | | case 4:
|
| | | m_Effects.Add(value.AssetABName.ToLower());
|
| | | m_Effects[value.AssetABName.ToLower()] = value;
|
| | | break;
|
| | | }
|
| | | }
|
| | |
| | | inited = true;
|
| | | }
|
| | |
|
| | | public static int GetAssetPrior(AssetVersion.AssetCategory category, string fileName)
|
| | | {
|
| | | if (!inited) |
| | | { |
| | | Init(); |
| | | }
|
| | | fileName = fileName.ToLower();
|
| | | switch (category) |
| | | {
|
| | | case AssetVersion.AssetCategory.Scene:
|
| | | return m_Scenes.ContainsKey(fileName) ? m_Scenes[fileName].Prior : 100; |
| | | case AssetVersion.AssetCategory.Mob:
|
| | | return m_Mobs.ContainsKey(fileName) ? m_Mobs[fileName].Prior : 101;
|
| | | case AssetVersion.AssetCategory.Effect:
|
| | | return m_Effects.ContainsKey(fileName) ? m_Effects[fileName].Prior : 102;
|
| | | case AssetVersion.AssetCategory.Audio:
|
| | | return m_Audios.ContainsKey(fileName) ? m_Audios[fileName].Prior : 103;
|
| | | case AssetVersion.AssetCategory.UI:
|
| | | if (fileName == "loadingbg") |
| | | { |
| | | return 3; |
| | | }
|
| | | else
|
| | | {
|
| | | return 0;
|
| | | }
|
| | | default:
|
| | | return 0;
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | } |
| | |
| | |
|
| | | public static bool Send_WorldTransfer(int mapId, Vector3 position, MapTransferType type, byte lineID = 255, int _npcId = 0)
|
| | | {
|
| | | if (!AssetSource.sceneFromEditor && !AssetVersionUtility.IsUnpriorAssetDownLoadOk())
|
| | | if (!AssetSource.sceneFromEditor)
|
| | | {
|
| | | var mapResConfig = DTCA127_tagMCStartChangeMap.GetMapResourcesConfig(mapId, 0);
|
| | | var assetVersion = AssetVersionUtility.GetAssetVersion(StringUtility.Contact("maps/", mapResConfig.MapResources.ToLower()));
|
| | |
|
| | | if (assetVersion != null && !assetVersion.IsPriorAsset())
|
| | | var assetValid = AssetVersionUtility.IsAssetValid(StringUtility.Contact("maps/", mapResConfig.MapResources.ToLower()));
|
| | | if (!assetValid)
|
| | | {
|
| | | InGameDownLoad.Instance.TryDownLoad(InGameDownLoad.Dominant.Whole);
|
| | | return false;
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | var assetVersion = AssetVersionUtility.GetAssetVersion(StringUtility.Contact("maps/", mapResConfig.MapResources.ToLower()));
|
| | | if (assetVersion != null && assetVersion.IsPriorAsset())
|
| | | var assetValid = AssetVersionUtility.IsAssetValid(StringUtility.Contact("maps/", mapResConfig.MapResources.ToLower()));
|
| | | if (assetValid)
|
| | | {
|
| | | SnxxzGame.Instance.StartCoroutine(LoadCoroutine<T>(stageId, mapResConfig.ID, mapResConfig.MapResources, true));
|
| | | }
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | switch (GetAssetCategory())
|
| | | {
|
| | | case AssetCategory.Scene:
|
| | | return PriorBundleConfig.scenes.Contains(m_FileName);
|
| | | case AssetCategory.Mob:
|
| | | return PriorBundleConfig.mobs.Contains(m_FileName);
|
| | | case AssetCategory.Audio:
|
| | | return PriorBundleConfig.audios.Contains(m_FileName);
|
| | | case AssetCategory.Effect:
|
| | | return PriorBundleConfig.effects.Contains(m_FileName);
|
| | | default:
|
| | | return true;
|
| | | }
|
| | | var category = GetAssetCategory();
|
| | | var prior = PriorBundleConfig.GetAssetPrior(category, m_FileName);
|
| | | return prior <= 1;
|
| | | }
|
| | | }
|
| | | else
|
| | |
| | | return assetVersions;
|
| | | } |
| | | |
| | | public static AssetVersion GetAssetVersion(string _assetBundleName)
|
| | | public static AssetVersion GetAssetVersion(string assetKey)
|
| | | {
|
| | | if (assetVersions.ContainsKey(_assetBundleName))
|
| | | if (assetVersions.ContainsKey(assetKey))
|
| | | {
|
| | | return assetVersions[_assetBundleName];
|
| | | return assetVersions[assetKey];
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | }
|
| | | } |
| | | |
| | | public static bool IsAssetValid(string assetKey)
|
| | | {
|
| | | if (assetVersions.ContainsKey(assetKey)) |
| | | { |
| | | return assetVersions[assetKey].localValid; |
| | | }
|
| | | else
|
| | | {
|
| | | if (VersionUtility.Instance.NeedDownAsset()) |
| | | { |
| | | return false; |
| | | }
|
| | | else
|
| | | {
|
| | | return true;
|
| | | }
|
| | | }
|
| | | } |
| | | |
| | | public static string GetAssetFilePath(string _assetKey)
|
| | | {
|
| | | var path = string.Empty;
|
| | |
| | |
|
| | | public bool inGameDownLoadAllow = false;
|
| | |
|
| | | public float progress
|
| | | {
|
| | | get
|
| | | {
|
| | | public float progress {
|
| | | get {
|
| | | return Mathf.Clamp01((float)showDownLoadedSize / showTotalSize);
|
| | | }
|
| | | }
|
| | |
| | | int totalCount = 0;
|
| | |
|
| | | int m_OkCount = 0;
|
| | | int okCount
|
| | | {
|
| | | int okCount {
|
| | | get { return m_OkCount; }
|
| | | set
|
| | | {
|
| | | set {
|
| | | m_OkCount = value;
|
| | | }
|
| | | }
|
| | |
| | | Action onDownLoadOk;
|
| | |
|
| | | Dominant m_DominantState = Dominant.None;
|
| | | public Dominant dominantState
|
| | | {
|
| | | public Dominant dominantState {
|
| | | get { return m_DominantState; }
|
| | | private set
|
| | | {
|
| | | private set {
|
| | | if (m_DominantState != value)
|
| | | {
|
| | | m_DominantState = value;
|
| | |
| | | }
|
| | |
|
| | | State m_State = State.None;
|
| | | public State state
|
| | | {
|
| | | public State state {
|
| | | get { return m_State; }
|
| | | set
|
| | | {
|
| | | set {
|
| | | if (m_State != value)
|
| | | {
|
| | | m_State = value;
|
| | |
| | |
|
| | | public List<Reward> rewards = new List<Reward>();
|
| | | public bool hasReward { get; private set; }
|
| | | public string completeDownLoadAccount
|
| | | {
|
| | | public string completeDownLoadAccount {
|
| | | get { return LocalSave.GetString("InGameDownLoadCompleteAccount"); }
|
| | | set { LocalSave.SetString("InGameDownLoadCompleteAccount", value); }
|
| | | }
|
| | |
| | | {
|
| | | inGameDownLoadAllow = false;
|
| | | tasks = _tasks;
|
| | | tasks.Sort(AssetDownLoadPriorCompare);
|
| | | onDownLoadOk = _onDownLoadOk;
|
| | |
|
| | | totalCount = tasks.Count;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | IEnumerator Co_StartDownLoad()
|
| | | {
|
| | | downLoadedSizeRecord += RemoteFile.TotalDownloadedSize;
|
| | |
| | |
|
| | | Clock netSwitchClock;
|
| | | NetworkReachability m_NetworkReachability = NetworkReachability.NotReachable;
|
| | | NetworkReachability networkReachability
|
| | | {
|
| | | NetworkReachability networkReachability {
|
| | | get { return m_NetworkReachability; }
|
| | | set
|
| | | {
|
| | | set {
|
| | | if (m_NetworkReachability != value)
|
| | | {
|
| | | m_NetworkReachability = value;
|
| | |
| | |
|
| | |
|
| | | bool m_SimulateWifi = true;
|
| | | public bool simulateWifi
|
| | | {
|
| | | public bool simulateWifi {
|
| | | get { return m_SimulateWifi; }
|
| | | set
|
| | | {
|
| | | set {
|
| | | if (m_SimulateWifi != value)
|
| | | {
|
| | | m_SimulateWifi = value;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private int AssetDownLoadPriorCompare(AssetVersion lhs, AssetVersion rhs)
|
| | | {
|
| | | var categoryA = lhs.GetAssetCategory();
|
| | | var categoryB = rhs.GetAssetCategory();
|
| | | var priorA = PriorBundleConfig.GetAssetPrior(categoryA, lhs.fileName);
|
| | | var priorB = PriorBundleConfig.GetAssetPrior(categoryB, rhs.fileName);
|
| | |
|
| | | return priorA < priorB ? -1 : 1;
|
| | | }
|
| | |
|
| | | public struct Reward
|
| | | {
|
| | |
| | |
|
| | | private bool CheckIsAutoEquip(ItemModel itemModel)
|
| | | {
|
| | | if (itemModel == null) return false;
|
| | |
|
| | | int playerLv = PlayerDatas.Instance.baseData.LV;
|
| | | if (playerLv > autoEquipLvLimit) return false;
|
| | |
|
| | |
| | | {
|
| | | showEquipRefreshEvent();
|
| | | }
|
| | | var betterModel = playerPack.GetItemModelByGUID(_guid);
|
| | | if (CheckIsAutoEquip(betterModel))
|
| | | {
|
| | | KnapsackTimeCDMgr.Instance.Register(betterModel.itemInfo.ItemGUID, betterModel.itemId, autoEquipCoolTime);
|
| | | }
|
| | | }
|
| | |
|
| | | private void OnPackageRefresh(PackType _packType)
|
| | |
| | | {
|
| | | ParseConfig();
|
| | | SetDogzAndEquipPlaceRedKey();
|
| | | playerPack.RefreshPackAct += UpdateDogzEquipInfo;
|
| | | }
|
| | |
|
| | | public void OnBeforePlayerDataInitialize()
|
| | |
| | |
|
| | | public void OnPlayerLoginOk()
|
| | | {
|
| | | SetDogzEquipInfo(); |
| | | playerPack.RefreshItemCountAct += RefreshDogzEquipInfo;
|
| | | FuncOpen.Instance.OnFuncStateChangeEvent += UpdateDogzState;
|
| | | UpdateDogzAssistRed();
|
| | |
| | |
|
| | | public override void UnInit()
|
| | | {
|
| | |
|
| | | playerPack.RefreshPackAct -= UpdateDogzEquipInfo;
|
| | | }
|
| | |
|
| | | #region 配置
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | private void UpdateDogzEquipInfo(PackType type)
|
| | | {
|
| | | if (type != PackType.rptDogzEquip) return;
|
| | |
|
| | | SetDogzEquipInfo();
|
| | | }
|
| | |
|
| | | public int GetAssistItemCnt()
|
| | | {
|
| | | if(!IsAddMaxAssist())
|
| | |
| | | }
|
| | | if (Index > -1)
|
| | | {
|
| | | if (Index + 1 >=7)
|
| | | if (Index + 1 >= 7)
|
| | | {
|
| | | if(7-mainModel.WaHuangHighestFloor>=0)
|
| | | mainModel.LayerNumber = 7 - mainModel.WaHuangHighestFloor;
|
| | | if (7 - mainModel.WaHuangHighestFloor >= 0)
|
| | | mainModel.LayerNumber = 7 - mainModel.WaHuangHighestFloor;
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | |
|
| | | public void RequestChallangeDungeon(int _dataMapId, int _lineId)
|
| | | {
|
| | | if (!AssetSource.sceneFromEditor && !AssetVersionUtility.IsUnpriorAssetDownLoadOk())
|
| | | if (!AssetSource.sceneFromEditor)
|
| | | {
|
| | | var mapResConfig = DTCA127_tagMCStartChangeMap.GetMapResourcesConfig(_dataMapId, _lineId);
|
| | | var assetVersion = AssetVersionUtility.GetAssetVersion(StringUtility.Contact("maps/", mapResConfig.MapResources.ToLower()));
|
| | | var assetValid = AssetVersionUtility.IsAssetValid(StringUtility.Contact("maps/", mapResConfig.MapResources.ToLower()));
|
| | |
|
| | | if (assetVersion != null && !assetVersion.IsPriorAsset())
|
| | | if (!assetValid)
|
| | | {
|
| | | InGameDownLoad.Instance.TryDownLoad(InGameDownLoad.Dominant.Whole);
|
| | | return;
|
| New file |
| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using System.IO; |
| | | using System.Threading; |
| | | |
| | | public class AssetDeCompressTask |
| | | { |
| | | |
| | | public static void Decompress(string path) |
| | | { |
| | | var files = new List<FileInfo>(); |
| | | FileExtersion.GetAllDirectoryFileInfos(path, files); |
| | | foreach (var item in files) |
| | | { |
| | | var fullName = item.FullName; |
| | | if (fullName.EndsWith(".7z")) |
| | | { |
| | | SevenZipUtility.DeCompress(fullName, Path.GetDirectoryName(fullName)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static DecompressProgress DecompressAync(string path) |
| | | { |
| | | var progress = new DecompressProgress(); |
| | | var files = new List<FileInfo>(); |
| | | FileExtersion.GetAllDirectoryFileInfos(path, files); |
| | | |
| | | for (var i = files.Count - 1; i >= 0; i--) |
| | | { |
| | | var fullName = files[i].FullName; |
| | | if (!fullName.EndsWith(".7z")) |
| | | { |
| | | files.RemoveAt(i); |
| | | } |
| | | } |
| | | |
| | | var total = files.Count; |
| | | if (total == 0) |
| | | { |
| | | progress.progress = 1f; |
| | | progress.done = true; |
| | | return progress; |
| | | } |
| | | |
| | | ThreadPool.QueueUserWorkItem((object a) => |
| | | { |
| | | var index = 0; |
| | | foreach (var item in files) |
| | | { |
| | | var fullName = item.FullName; |
| | | if (fullName.EndsWith(".7z")) |
| | | { |
| | | SevenZipUtility.DeCompress(fullName, Path.GetDirectoryName(fullName)); |
| | | index++; |
| | | progress.progress = index / (float)total; |
| | | } |
| | | } |
| | | |
| | | progress.done = true; |
| | | }); |
| | | |
| | | return progress; |
| | | } |
| | | |
| | | public static void Delete7zFiles(string path) |
| | | { |
| | | var files = new List<FileInfo>(); |
| | | FileExtersion.GetAllDirectoryFileInfos(path, files); |
| | | |
| | | for (var i = files.Count - 1; i >= 0; i--) |
| | | { |
| | | var fullName = files[i].FullName; |
| | | if (fullName.EndsWith(".7z")) |
| | | { |
| | | files[i].Delete(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public class DecompressProgress |
| | | { |
| | | object progressLock = new object(); |
| | | float m_Progress = 0f; |
| | | public float progress { |
| | | get { |
| | | return m_Progress; |
| | | } |
| | | set { |
| | | lock (progressLock) |
| | | { |
| | | m_Progress = value; |
| | | } |
| | | } |
| | | } |
| | | |
| | | object doneLock = new object(); |
| | | bool m_Done = false; |
| | | public bool done { |
| | | get { |
| | | return m_Done; |
| | | } |
| | | set { |
| | | lock (doneLock) |
| | | { |
| | | m_Done = value; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 2ca4a4bf756f36248be9ddbbf60e835a |
| | | timeCreated: 1541123413 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | |
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | var mapResConfig = Config.Instance.Get<MapResourcesConfig>(targetMapResId);
|
| | | if (mapResConfig != null && mapResConfig.LoadingBG.Length > 0)
|
| | | var useDefautBackGround = false;
|
| | | if (!AssetSource.uiFromEditor)
|
| | | {
|
| | | var randomIndex = UnityEngine.Random.Range(0, mapResConfig.LoadingBG.Length > 1 ? mapResConfig.LoadingBG.Length + 1 : 1);
|
| | | if (randomIndex == mapResConfig.LoadingBG.Length)
|
| | | var assetValid = AssetVersionUtility.IsAssetValid("ui/sprite/loadingbg");
|
| | | useDefautBackGround = !assetValid;
|
| | | }
|
| | |
|
| | | if (useDefautBackGround)
|
| | | {
|
| | | var sprite = BuiltInLoader.LoadSprite("Launch");
|
| | | m_BackGround.overrideSprite = sprite;
|
| | | m_ContainerMapName.gameObject.SetActive(false);
|
| | | m_ContainerMapDescription.gameObject.SetActive(false);
|
| | | m_ContainerFunctions.gameObject.SetActive(false);
|
| | | }
|
| | | else
|
| | | {
|
| | | var mapResConfig = Config.Instance.Get<MapResourcesConfig>(targetMapResId);
|
| | | if (mapResConfig != null && mapResConfig.LoadingBG.Length > 0)
|
| | | {
|
| | | m_BackGround.SetSprite(GeneralDefine.LoadLV);
|
| | | m_ContainerFunctions.gameObject.SetActive(true);
|
| | | var functions = GetShowFunctions(PlayerDatas.Instance.baseData.LV == 0 ? PlayerDatas.Instance.loginInfo.LV : PlayerDatas.Instance.baseData.LV);
|
| | | for (int i = 0; i < m_FunctionShows.Length; i++)
|
| | | var randomIndex = UnityEngine.Random.Range(0, mapResConfig.LoadingBG.Length > 1 ? mapResConfig.LoadingBG.Length + 1 : 1);
|
| | | if (randomIndex == mapResConfig.LoadingBG.Length)
|
| | | {
|
| | | var show = m_FunctionShows[i];
|
| | | show.Display(functions[i]);
|
| | | m_BackGround.SetSprite(GeneralDefine.LoadLV);
|
| | | m_ContainerFunctions.gameObject.SetActive(true);
|
| | | var functions = GetShowFunctions(PlayerDatas.Instance.baseData.LV == 0 ? PlayerDatas.Instance.loginInfo.LV : PlayerDatas.Instance.baseData.LV);
|
| | | for (int i = 0; i < m_FunctionShows.Length; i++)
|
| | | {
|
| | | var show = m_FunctionShows[i];
|
| | | show.Display(functions[i]);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | m_BackGround.SetSprite(mapResConfig.LoadingBG[randomIndex]);
|
| | | m_ContainerFunctions.gameObject.SetActive(false);
|
| | | }
|
| | | }
|
| | |
|
| | | if (mapResConfig != null && !string.IsNullOrEmpty(mapResConfig.LoadName))
|
| | | {
|
| | | m_ContainerMapName.gameObject.SetActive(true);
|
| | | m_MapName.SetSprite(mapResConfig.LoadName);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_BackGround.SetSprite(mapResConfig.LoadingBG[randomIndex]);
|
| | | m_ContainerFunctions.gameObject.SetActive(false);
|
| | | m_ContainerMapName.gameObject.SetActive(false);
|
| | | }
|
| | | }
|
| | |
|
| | | if (mapResConfig != null && !string.IsNullOrEmpty(mapResConfig.LoadName))
|
| | | {
|
| | | m_ContainerMapName.gameObject.SetActive(true);
|
| | | m_MapName.SetSprite(mapResConfig.LoadName);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_ContainerMapName.gameObject.SetActive(false);
|
| | | }
|
| | |
|
| | | if (mapResConfig != null && !string.IsNullOrEmpty(mapResConfig.LoadDescription))
|
| | | {
|
| | | m_ContainerMapDescription.gameObject.SetActive(true);
|
| | | m_MapDescription.SetSprite(mapResConfig.LoadDescription);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_ContainerMapDescription.gameObject.SetActive(false);
|
| | | if (mapResConfig != null && !string.IsNullOrEmpty(mapResConfig.LoadDescription))
|
| | | {
|
| | | m_ContainerMapDescription.gameObject.SetActive(true);
|
| | | m_MapDescription.SetSprite(mapResConfig.LoadDescription);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_ContainerMapDescription.gameObject.SetActive(false);
|
| | | }
|
| | | }
|
| | |
|
| | | m_ProgressSlider.value = refProgress = 0f;
|
| | |
| | | {
|
| | | m_ProgressSlider.value = refProgress = Mathf.Max(_progress, refProgress);
|
| | | }
|
| | |
|
| | |
|
| | | private List<int> GetShowFunctions(int _level)
|
| | | {
|
| New file |
| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | | [DisallowMultipleComponent]
|
| | | [RequireComponent(typeof(Image))]
|
| | | public class FlipImage : BaseMeshEffect
|
| | | {
|
| | | [SerializeField] bool flipHorizontal = false;
|
| | | [SerializeField] bool flipVertical = false;
|
| | |
|
| | | public override void ModifyMesh(VertexHelper vh)
|
| | | {
|
| | | if (!IsActive() || vh.currentVertCount == 0)
|
| | | {
|
| | | return;
|
| | | }
|
| | | var vertexs = new List<UIVertex>();
|
| | | vh.GetUIVertexStream(vertexs);
|
| | | if (flipHorizontal || flipVertical)
|
| | | {
|
| | | Flip(vertexs);
|
| | | }
|
| | | vh.Clear();
|
| | | vh.AddUIVertexTriangleStream(vertexs);
|
| | | }
|
| | |
|
| | | void Flip(List<UIVertex> vertexs)
|
| | | {
|
| | | var rect = graphic.GetPixelAdjustedRect();
|
| | | var count = vertexs.Count;
|
| | | for (int i = 0; i < count; i++)
|
| | | {
|
| | | var vertex = vertexs[i];
|
| | | var position = vertex.position;
|
| | | if (flipHorizontal)
|
| | | {
|
| | | position.x = -position.x + rect.max.x + rect.min.x;
|
| | | }
|
| | | if (flipVertical)
|
| | | {
|
| | | position.y = -position.y + rect.max.y + rect.min.y;
|
| | | }
|
| | | vertex.position = position;
|
| | | vertexs[i] = vertex;
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: d01ab0c7706729e48ac25411506e3a18 |
| | | timeCreated: 1541129037 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using System.IO; |
| | | |
| | | public class SevenZipUtility |
| | | { |
| | | static string m_SevenZipToolPath = string.Empty; |
| | | static string sevenZipToolPath { |
| | | get { |
| | | if (string.IsNullOrEmpty(m_SevenZipToolPath)) |
| | | { |
| | | if (Directory.Exists("C:/Program Files/7-Zip")) |
| | | { |
| | | m_SevenZipToolPath = "C:/Program Files/7-Zip"; |
| | | } |
| | | else |
| | | { |
| | | m_SevenZipToolPath = "C:/Program Files (x86)/7-Zip"; |
| | | } |
| | | } |
| | | |
| | | return m_SevenZipToolPath; |
| | | } |
| | | } |
| | | |
| | | public static void Compress(string from, string to) |
| | | { |
| | | if (File.Exists(to)) |
| | | { |
| | | File.Delete(to); |
| | | } |
| | | |
| | | var cmd = string.Format("\"{0}\\7z\" a {1} {2} -mx9", sevenZipToolPath, to, from); |
| | | SystemCMD.RunCmd(cmd); |
| | | } |
| | | |
| | | public static void DeCompress(string from, string to) |
| | | { |
| | | lzma.doDecompress7zip(from, to, false, true); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f144847788b6f254083b077d968bc6f4 |
| | | timeCreated: 1541055675 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | |
| | | public class SystemCMD |
| | | { |
| | | /// <summary> |
| | | /// 调用终端执行命令 |
| | | /// </summary> |
| | | /// <param name="command"></param> |
| | | /// <returns></returns> |
| | | public static string RunCmd(string command) |
| | | { |
| | | System.Diagnostics.Process p = new System.Diagnostics.Process(); |
| | | p.StartInfo.FileName = "cmd.exe"; //确定程序名 |
| | | p.StartInfo.Arguments = "/c " + command; //确定程式命令行 |
| | | p.StartInfo.UseShellExecute = false; //Shell的使用 |
| | | p.StartInfo.RedirectStandardInput = true; //重定向输入 |
| | | p.StartInfo.RedirectStandardOutput = true; //重定向输出 |
| | | p.StartInfo.RedirectStandardError = true; //重定向输出错误 |
| | | p.StartInfo.CreateNoWindow = true; //设置置不显示示窗口 |
| | | p.Start(); |
| | | p.WaitForExit(); |
| | | string err = p.StandardError.ReadToEnd(); |
| | | string standoutput = p.StandardOutput.ReadToEnd(); |
| | | if (string.IsNullOrEmpty(err)) |
| | | { |
| | | return standoutput; |
| | | } |
| | | else |
| | | { |
| | | return err; //输出出流取得命令行结果果 |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 6de2d4b13bfadaf419c682196b36e001 |
| | | timeCreated: 1541043601 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |