private void ReadProduceActivateIdFile() { byte[] data = UniGameResources.ReadFile(FTLibrary.Text.IStringPath.ConnectPath(UniGameResources.PersistentDataPath, UniGameResourcesDefine.ProduceActivateIdFileName)); if (data != null) { BinaryReader reader = new BinaryReader(new MemoryStream(data)); produceActivateId = new HelperInterface.ProduceActivateId(); produceActivateId.activateId = reader.ReadString(); produceActivateId.activateDate = DateTime.Parse(reader.ReadString()); reader.Close(); } else { produceActivateId = new HelperInterface.ProduceActivateId(); produceActivateId.activateId = Guid.NewGuid().ToString(); produceActivateId.activateDate = DateTime.Now; MemoryStream s = new MemoryStream(256); BinaryWriter writer = new BinaryWriter(s); writer.Seek(0, SeekOrigin.Begin); writer.Write(produceActivateId.activateId); writer.Write(produceActivateId.activateDate.ToString()); writer.Flush(); data = s.ToArray(); writer.Close(); UniGameResources.WriteFile(FTLibrary.Text.IStringPath.ConnectPath(UniGameResources.PersistentDataPath, UniGameResourcesDefine.ProduceActivateIdFileName), data); } }
public UniResourcesLuaScriptLoader() : base() { LUA_ROOT = UniGameResources.ConnectPath(Application.dataPath, "\\", UniGameResourcesDefine.DefineAssetBundleName_LuaScript, "\\LuaRoot\\"); }
public bool Open(string fileName, bool issecuritydatafile = true) { byte[] data = UniGameResources.ReadSafeFile(UniGameResources.ConnectPath(UniGameResources.PersistentDataPath, fileName)); if (data == null) { return(false); } if (issecuritydatafile) { try { data = UniDataFileWriter.Decrypt(data); if (data == null) { return(false); } } catch (System.Exception ex) { return(false); } } reader = new BinaryReader(new MemoryStream(data)); return(true); }
public void setPlayerParam(string paramName, string sParam) { #if !UNITY_EDITOR && !LOCALARCHIVES && UNITY_ANDROID using (AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) { using (AndroidJavaObject jo = jc.GetStatic <AndroidJavaObject>("currentActivity")) { jo.Call("setPlayerParam", paramName, sParam); } } #else //为了适应之前的系统,这里,非加密档案,更换新的存储文件 //using (UniDataFileWriter writer = new UniDataFileWriter()) //{ // writer.Open(UniGameResources.ConnectPath("gamecenter_", // paramName, ".txt")); // writer.writer.Write(sParam); // writer.Close(); //} using (UniDataFileWriter writer = new UniDataFileWriter()) { writer.Open(UniGameResources.ConnectPath("new_gamecenter_", paramName, ".txt"), false); writer.writer.Write(sParam); writer.Close(); } #endif //UNITY_ANDROID }
//初始化函数 public override void Initialization() { //进行一次内存释放 //Debug.Log("进行一次内存释放"); UniGameResources.UnloadUnusedAssets(); base.Initialization(); //#if _IgnoreVerify //#else // //进入待机画面做一次完全安全验证 // //如果验证失败了游戏就会被挂起 // //做校验 // GameRoot.CheckCipherText(StandbyProcess.VerifyEnvironmentKey_LogoVideo); //#endif//_IgnoreVerify //GameRoot.uiOrthographicCamera.LoadResource_UIPrefabs("FadeScreen.prefab", GameRoot.gameResource).GetComponent<GuiPlaneAnimationPlayer>().DelegateOnPlayEndEvent = InitUI; m_InningGameStandByMaxTime = ((RaceSceneControl)GameRoot.CurrentSceneControl).sceneDefineList[((RaceSceneControl)GameRoot.CurrentSceneControl).currentSelectSceneId].gameTime; m_Reset = false; InitUI(); //激活为当前监听源 MusicPlayer.activeMyListener = true; //开始音乐播放 MusicPlayer.Stop(true); MusicPlayer.workMode = MusicPlayer.MusicPlayerWorkMode.Mode_Standby; MusicPlayer.Play("game.ogg", true); }
//初始化函数 public override void Initialization() { base.Initialization(); //#if _IgnoreVerify //#else //进入待机画面做一次完全安全验证 //如果验证失败了游戏就会被挂起 GameRoot.CompleteVerify_Current_Environment(); ////申请一次验证KEY //VerifyEnvironmentKey_LogoVideo = GameRoot.AllocVerifyEnvironmentKey(Guid.NewGuid().ToString()); //#endif//_IgnoreVerify //为了防止加载场景和IO卡线程冲突,这里暂时锁定,不释放资源 UniGameResources.LockUnloadUnusedAssets(); //加载游戏场景 //如果是调试模式就不需要加载场景了 if (ConsoleCenter.CurrentSceneWorkMode != SceneWorkMode.SCENEWORKMODE_Debug) { Application.LoadLevel(SystemCommand.FirstSceneName); } //加载完成后进行其他初始化 //投币代理 InputDevice.delegateInsertNewCoins = playerInsertCoins; }
public bool LoadResource_IsHaveLuaScript(string filePath) { if (UniGameResources.gameResourcesWorkMode == GameResourcesWorkMode.Mode_AloneSecurity) { try { #if _Develop return(File.Exists(UniGameResources.ConnectPath(UniGameResources.DataPath, UniGameResourcesDefine.DefineAssetBundleName_LuaScript, "/", filePath))); #else MemoryStream s = luaScriptReaderSecurity.Load(filePath); bool ret = (s != null); s.Close(); return(ret); #endif//_Develop } catch (System.Exception ex) { Debug.LogError(ex.ToString()); return(false); } } else if (UniGameResources.gameResourcesWorkMode == GameResourcesWorkMode.Mode_Mobile) { if (luaScriptPackage == null) { throw new Exception("cant find lua script package!"); } luaScriptPackage.LockPackage(); bool ret = luaScriptPackage.currentAssetBundle.Contains(filePath); luaScriptPackage.UnLockPackage(); return(ret); } return(false); }
public IEnumerator DownloadPackageWithList(List <string> list) { if (needDownloadPackageList.Count != 0 || overDownloadPackageList.Count != 0) { Debug.LogError("Is Have Loader Package!"); yield break; } if (list.Count == 0) { Debug.LogError("Download What?!"); yield break; } List <UniGameResourcesPackage> packageList = new List <UniGameResourcesPackage>(8); for (int i = 0; i < list.Count; i++) { UniGameResourcesPackage package = UniGameResources.FindSystemResourcesPackageTable(list[i]); if (package == null) { Debug.LogError(string.Format("not find package:{0}", list[i])); yield break; } packageList.Add(package); } yield return(StartCoroutine(DownloadPackageWithList(packageList))); }
//初始化函数 public override void Initialization() { //进行一次内存释放 //Debug.Log("进行一次内存释放"); UniGameResources.UnloadUnusedAssets(); base.Initialization(); }
public MemoryStream LoadResource_LuaScript(string filePath) { if (UniGameResources.gameResourcesWorkMode == GameResourcesWorkMode.Mode_AloneSecurity) { try { #if _Develop FileStream file = new FileStream(UniGameResources.ConnectPath(UniGameResources.DataPath, UniGameResourcesDefine.DefineAssetBundleName_LuaScript, "/", filePath), FileMode.Open, FileAccess.Read, FileShare.Read); file.Seek(0, SeekOrigin.Begin); byte[] buffer = new byte[file.Length]; file.Read(buffer, 0, buffer.Length); file.Close(); return(new MemoryStream(buffer)); #else return(luaScriptReaderSecurity.Load(filePath)); #endif//_Develop } catch (System.Exception ex) { Debug.LogError(ex.ToString()); return(null); } } else if (UniGameResources.gameResourcesWorkMode == GameResourcesWorkMode.Mode_Mobile) { if (luaScriptPackage == null) { throw new Exception("cant find lua script package!"); } luaScriptPackage.LockPackage(); #if UNITY_4_3 || UNITY_4_6 TextAsset textAsset = luaScriptPackage.currentAssetBundle.Load(filePath, typeof(TextAsset)) as TextAsset; #else TextAsset textAsset = luaScriptPackage.currentAssetBundle.LoadAsset(filePath, typeof(TextAsset)) as TextAsset; #endif MemoryStream ret = null; try { byte[] luadata = textAsset.bytes; luadata = Convert.FromBase64String(Encoding.ASCII.GetString(luadata)); //解密数据 #if _SupportDeviceVerify luadata = luaScriptFileEncipher.FileDecrypt(luadata, true); #else luadata = luaScriptFileEncipher.FileDecrypt(luadata); #endif //_SupportDeviceVerify ret = new MemoryStream(luadata); } catch (System.Exception ex) { Debug.LogError(ex.ToString()); ret = null; } UniGameResources.ReleaseOneAssets(textAsset); luaScriptPackage.UnLockPackage(); return(ret); } return(null); }
public static void LoadGameOptionsDefaultInfo(string fileName, UniGameResources gameResources) { XmlDocument doc = gameResources.LoadResource_PublicXmlFile(fileName); XmlNode root = doc.SelectSingleNode("GameOptions"); XmlNode node = root.SelectSingleNode("GameDifficulty"); switch (node.Attribute("difficulty")) { case "Simpleness": defaultGameDifficulty = GameDifficulty.Difficulty_Simpleness; break; case "Normal": defaultGameDifficulty = GameDifficulty.Difficulty_Normal; break; case "Difficulty": defaultGameDifficulty = GameDifficulty.Difficulty_Difficulty; break; default: defaultGameDifficulty = GameDifficulty.Difficulty_Normal; break; } node = root.SelectSingleNode("Language"); if (!gameResources.FindLanguageDefine(UniGameResources.LanguageDefine.LanguageNameToLanguageId(node.Attribute("name")), out defaultGameLanguage)) { defaultGameLanguage = gameResources.GetDefineLanguage(); } node = root.SelectSingleNode("GameVolume"); defaultGameVolume = Convert.ToSingle(node.Attribute("volume")); defaultStandByMusicVolume = Convert.ToSingle(node.Attribute("standbymusicvolume")); node = root.SelectSingleNode("GameResolution"); if (node.Attribute("resolution") == GameResolution.Resolution_Default.ToString()) { defaultGameResolution = GameResolution.Resolution_Default; } else if (node.Attribute("resolution") == GameResolution.Resolution_16_9_1920_1080.ToString()) { defaultGameResolution = GameResolution.Resolution_16_9_1920_1080; } else if (node.Attribute("resolution") == GameResolution.Resolution_16_9_1600_900.ToString()) { defaultGameResolution = GameResolution.Resolution_16_9_1600_900; } else if (node.Attribute("resolution") == GameResolution.Resolution_16_9_1280_720.ToString()) { defaultGameResolution = GameResolution.Resolution_16_9_1280_720; } else { defaultGameResolution = GameResolution.Resolution_Default; } }
private XmlDocument LoadResource_PublicXmlDocument(ref GameResourcesNode data, Encoding code) { if (UniGameResources.gameResourcesWorkMode == GameResourcesWorkMode.Mode_AloneSecurity) { try { #if _Develop XmlDocument doc = new XmlDocument(); doc.Load(UniGameResources.ConnectPath(UniGameResources.DataPath, data.packageName, "/", data.path)); return(doc); #else return(xmlPublicReaderSecurity.LoadXml(UniGameResources.ConnectPath(UniGameResources.DataPath, data.packageName, "/", data.path))); #endif//_Develop } catch (System.Exception ex) { Debug.LogError(ex.ToString()); return(null); } } else if (UniGameResources.gameResourcesWorkMode == GameResourcesWorkMode.Mode_Mobile) { UniGameResourcesPackage package = (UniGameResourcesPackage)data.package; package.LockPackage(); #if UNITY_4_3 || UNITY_4_6 TextAsset textAsset = package.currentAssetBundle.Load(data.path, typeof(TextAsset)) as TextAsset; #else TextAsset textAsset = package.currentAssetBundle.LoadAsset(data.path, typeof(TextAsset)) as TextAsset; #endif XmlDocument doc = null; try { byte[] xmldata = textAsset.bytes; xmldata = Convert.FromBase64String(Encoding.ASCII.GetString(xmldata)); //解密数据 #if _SupportDeviceVerify xmldata = xmlFileEncipher.FileDecrypt(xmldata, true); #else xmldata = xmlFileEncipher.FileDecrypt(xmldata); #endif //_SupportDeviceVerify //MemoryStream s = new MemoryStream(xmldata); doc = new XmlDocument(); doc.LoadXml(code.GetString(xmldata)); //s.Close(); } catch (System.Exception ex) { Debug.LogError(ex.ToString()); doc = null; } UniGameResources.ReleaseOneAssets(textAsset); package.UnLockPackage(); return(doc); } return(null); }
public static UniGameResourcesPackage FindSystemResourcesPackageTable(string name) { uint packageId = UniGameResources.PackageNameToIdPackage(name); UniGameResourcesPackage ret; if (!systemResourcesPackageTable.TryGetValue(packageId, out ret)) { return(ret); } return(ret); }
static public void Loading(string name) { int id = (int)FTUID.StringGetHashCode(name); if (currentMusicData != null && currentMusicData.Id == id) { return; } currentMusicData = FindMusic(id); if (currentMusicData == null) { return; } if (musicPlayer == null) { return; } if (musicPlayer.audioSource == null) { return; } AudioClip sound = null; if (currentMusicData.sound != null) { sound = currentMusicData.sound; } else { sound = UniGameResources.currentUniGameResources.LoadResource_AudioClip(currentMusicData.resourceName); } if (sound == null) { return; } musicPlayer.audioSource.Stop(); if (musicPlayer.audioSource.clip != null) { //如果被标记为不卸载则不卸载了 if (!musicPlayer.IsCurrentAudioUnLoad) { UniGameResources.ReleaseOneAssets(musicPlayer.audioSource.clip); } musicPlayer.audioSource.clip = null; } musicPlayer.audioSource.clip = sound; musicPlayer.audioSource.volume = 0.0f; musicPlayer.audioSource.Play(); musicPlayer.audioSource.Stop(); //标记这个资源是否不卸载 musicPlayer.IsCurrentAudioUnLoad = currentMusicData.isunload; currentMusicData = null; }
public GameObject LoadLanguageResource_UIPrefabs(string name, UniGameResources gameResources) { if (!myCamera.enabled) { myCamera.enabled = true; enabled = true; } GameObject obj = gameResources.LoadLanguageResource_Prefabs(name); obj.transform.parent = myTransform; return(obj); }
public UniGameResourcesPackage(XmlNode node) : base() { packageName = node.Attribute("name"); packageId = UniGameResources.PackageNameToIdPackage(packageName); packagePath = node.Attribute("path"); packageLocalVersion = 0; packageRealVersion = Convert.ToInt32(node.Attribute("version")); packageLocalSize = 0; packageRealSize = Convert.ToInt64(node.Attribute("size")); existType = (ResourcesPackageExistType)Convert.ToInt32(node.Attribute("existtype")); assetBundleType = (AssetBundleType)Convert.ToInt32(node.Attribute("type")); inventoryFileName = node.Attribute("inventoryFileName"); }
//打开游戏启动画面 protected virtual IEnumerator OpenGameBootFace() { //检测是否有系统启动界面 if (UniGameResources.FindSystemResourcesPackageTable(UniGameResourcesDefine.DefineAssetBundleName_GameBoot) == null) { yield break; } uint guid = UniGameResources.resourcesDownLoadWorker.AllocLoadingAssetObjectGUID(); yield return(StartCoroutine(UniGameResources.resourcesDownLoadWorker.LoadingAssetObject(UniGameResourcesDefine.DefineAssetBundleName_GameBoot, UniGameResourcesDefine.GameBoot_AssetBundle_Path, guid, typeof(UnityEngine.GameObject), true))); UnityEngine.GameObject obj = UniGameResources.resourcesDownLoadWorker.PutoffAssetObject(guid) as UnityEngine.GameObject; SceneControl.gameBootFace = obj.GetComponent <UniGameBootFace>(); }
public UniGameRecordFileBase(string path, UniGameResources gameresources) { filePath = path; gameResources = gameresources; byte[] buffer = FTLibrary.Command.ISafeFile.ReadFile(filePath); if (buffer != null) { MemoryStream s = new MemoryStream(buffer); if (s.Length > 0) { BinaryReader reader = new BinaryReader(s); LoadRecord(reader); reader.Close(); } } }
public static void LoadGameOptionsDefault(UniGameResources gameResources) { try { //加载默认设置 UniGameOptionsFile.LoadGameOptionsDefaultInfo("GameOptions.xml", gameResources); UniInsertCoinsOptionsFile.LoadInsertCoinsOptionsDefaultInfo("InsertCoinsOptions.xml", gameResources); gameOptionsFile = new UniGameOptionsFile(FTLibrary.Text.IStringPath.ConnectPath(UniGameResources.PersistentDataPath, "GameOptions\\GameOptions.dat"), gameResources); insertCoinsOptionsFile = new UniInsertCoinsOptionsFile(FTLibrary.Text.IStringPath.ConnectPath(UniGameResources.PersistentDataPath, "GameOptions\\InsertCoinsOptions.dat"), gameResources); } catch (System.Exception ex) { UnityEngine.Debug.LogError(ex.ToString()); } }
public void Close() { if (writer == null) { return; } byte[] data = ((MemoryStream)writer.BaseStream).ToArray(); writer.Close(); writer = null; if (isSecurityDataFile) { data = UniDataFileWriter.Encrypt(data); } UniGameResources.WriteSafeFile(UniGameResources.ConnectPath(UniGameResources.PersistentDataPath, FileName), data); }
//从金币缓冲表中获取金币 public static UICoinsAnimControl GetCoinFromBuffer() { //从弹珠缓冲表中取弹珠, 如果没有取到弹珠则创建弹珠, 并加入到m_StaticPinballList里面 UICoinsAnimControl newCoins = null; if (m_EatCoinsBuffer.AllocObject("AnimControl", out newCoins)) //是否在缓存列表中 { } else { newCoins = UniGameResources.NormalizePrefabs(GameRoot.uiOrthographicCamera.LoadResource_UIPrefabs("Prompt_Coins.prefab", GameRoot.gameResource), null, typeof(UICoinsAnimControl)) as UICoinsAnimControl; //newCoins.m_GuiPlaneAnimationPlayer.DelegateOnPlayEndEvent = newCoins.fn; } newCoins.gameObject.SetActive(true); newCoins.m_GuiPlaneAnimationPlayer.DelegateOnPlayEndEvent = newCoins.TransToBuffer; return(newCoins); }
//初始化函数 public override void Initialization() { //进行一次内存释放 //Debug.Log("进行一次内存释放"); UniGameResources.UnloadUnusedAssets(); GameRoot.uiOrthographicCamera.LoadResource_UIPrefabs("FadeScreen.prefab", GameRoot.gameResource); InitUI(); m_GameOverTime = m_GameContinueControl.m_GameOverTime; //开始音乐播放 MusicPlayer.Stop(true); MusicPlayer.Play("continue.ogg", true); timeLocker.IsLocked = true; ResetIsEnterStart(); StandbyProcess.UpdateCoinsUI(IParkourPlayer_Xiong.PlayerIndex.Index_P1); StandbyProcess.UpdateCoinsUI(IParkourPlayer_Xiong.PlayerIndex.Index_P2); }
//初始化函数 public override void Initialization() { //进行一次内存释放 //Debug.Log("进行一次内存释放"); UniGameResources.UnloadUnusedAssets(); base.Initialization(); //Debug.Log("选择角色 初始化"); GameRoot.uiOrthographicCamera.LoadResource_UIPrefabs("FadeScreen.prefab", GameRoot.gameResource); InitUI(); IniAnimationPlayState(); ControlUI(); //开始音乐播放 MusicPlayer.Stop(true); MusicPlayer.workMode = MusicPlayer.MusicPlayerWorkMode.Mode_Normal; MusicPlayer.Play("select.ogg", true); }
/** 获取用户的档案*/ public string getPlayerParam(string paramName) { try { #if !UNITY_EDITOR && !LOCALARCHIVES && UNITY_ANDROID using (AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) { using (AndroidJavaObject jo = jc.GetStatic <AndroidJavaObject>("currentActivity")) { return(jo.Call <string>("getPlayerParam", paramName)); } } #else //由于取消加密系统,为了适应之前的旧系统 //首先,从新文件读取内容,如果未读取到,则从旧文件读取内容 //首先以加密的方式从旧文件读取内容,如果未读取到,则以未加密的 //方式从旧文件读取,如果都读取失败,则为失败 using (UniDataFileReader reader = new UniDataFileReader()) { if (!reader.Open(UniGameResources.ConnectPath("new_gamecenter_", paramName, ".txt"), false)) { if (!reader.Open(UniGameResources.ConnectPath("gamecenter_", paramName, ".txt"), true)) { if (!reader.Open(UniGameResources.ConnectPath("gamecenter_", paramName, ".txt"), false)) { return(""); } } } string ret = reader.reader.ReadString(); reader.Close(); return(ret); } #endif //UNITY_ANDROID } catch (System.Exception ex) { return(""); } }
public IEnumerator LoadingAssetObject(string packageName, string assetName, uint assetGuid, Type type, bool isInstantiate) { UniGameResourcesDownLoader loader = AllocResourcesDownLoader_DontDestroyOnLoad(); yield return(StartCoroutine(loader.DownloadPackage(packageName))); UniGameResourcesPackage package = UniGameResources.FindSystemResourcesPackageTable(packageName); if (package == null) { Debug.LogError(string.Format("not find package:{0}", packageName)); yield break; } UnityEngine.Object obj = null; package.LockPackage(); try { if (isInstantiate) { #if UNITY_4_3 || UNITY_4_6 obj = GameObject.Instantiate(package.currentAssetBundle.Load(assetName, type)); #else obj = GameObject.Instantiate(package.currentAssetBundle.LoadAsset(assetName, type)); #endif } else { #if UNITY_4_3 || UNITY_4_6 obj = package.currentAssetBundle.Load(assetName, type); #else obj = package.currentAssetBundle.LoadAsset(assetName, type); #endif } } catch (System.Exception ex) { Debug.LogError(ex.ToString()); } package.UnLockPackage(); loadingAssetTree.Add(assetGuid, obj); ReleaseResourcesDownLoader(loader); }
private byte[] LoadResource_ByteFile(ref GameResourcesNode data) { if (UniGameResources.gameResourcesWorkMode == GameResourcesWorkMode.Mode_AloneSecurity) { try { string path = UniGameResources.ConnectPath(UniGameResources.DataPath, data.packageName, "/", data.path); FileStream file = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 4096); byte[] buffer = new byte[file.Length]; file.Read(buffer, 0, buffer.Length); file.Close(); return(buffer); } catch (System.Exception ex) { Debug.LogError(ex.ToString()); return(null); } } else if (UniGameResources.gameResourcesWorkMode == GameResourcesWorkMode.Mode_Mobile) { UniGameResourcesPackage package = (UniGameResourcesPackage)data.package; package.LockPackage(); #if UNITY_4_3 || UNITY_4_6 TextAsset textAsset = package.currentAssetBundle.Load(data.path, typeof(TextAsset)) as TextAsset; #else TextAsset textAsset = package.currentAssetBundle.LoadAsset(data.path, typeof(TextAsset)) as TextAsset; #endif byte[] buffer = textAsset.bytes; buffer = Convert.FromBase64String(Encoding.ASCII.GetString(buffer)); //解密数据 #if _SupportDeviceVerify buffer = xmlFileEncipher.FileDecrypt(buffer, true); #else buffer = xmlFileEncipher.FileDecrypt(buffer); #endif //_SupportDeviceVerify UniGameResources.ReleaseOneAssets(textAsset); package.UnLockPackage(); return(buffer); } return(null); }
public static void LoadInsertCoinsOptionsDefaultInfo(string fileName, UniGameResources gameResources) { XmlDocument doc = gameResources.LoadResource_PublicXmlFile(fileName); XmlNode root = doc.SelectSingleNode("InsertCoinsOptions"); XmlNode node = root.SelectSingleNode("ChargeMode"); switch (node.Attribute("mode")) { case "Free": defaultChargeMode = GameChargeMode.Mode_Free; break; case "Charge": defaultChargeMode = GameChargeMode.Mode_Charge; break; } node = root.SelectSingleNode("ChargeData"); defaultCoins = Convert.ToInt32(node.Attribute("coins")); defaultTimes = Convert.ToSingle(node.Attribute("times")); node = root.SelectSingleNode("AwardMode"); switch (node.Attribute("mode")) { case "Games": defaultAwardMode = GameAwardMode.Mode_Games; break; case "Scores": defaultAwardMode = GameAwardMode.Mode_Scores; break; case "LossPerCent": defaultAwardMode = GameAwardMode.Mode_LossPerCent; break; } node = root.SelectSingleNode("AwardData"); defaultAwardCount = Convert.ToInt32(node.Attribute("count")); defaultAwardNeedScore = Convert.ToInt32(node.Attribute("score")); defaultLossPerCent = Convert.ToInt32(node.Attribute("losspercent")); }
//层管理 //public static ILayerManager layerManager = null; private static void GameEnvironmentInitialization() { if (isRunedGameEnvironmentInitialization) { return; } isRunedGameEnvironmentInitialization = true; //layerManager = new ILayerManager(); musicPlayer = UniGameResources.NormalizePrefabs(UniGameResources.currentUniGameResources.LoadResource_Prefabs("MusicPlayer.prefab"), null, typeof(MusicPlayer)) as MusicPlayer; soundEffectPlayer = UniGameResources.NormalizePrefabs(UniGameResources.currentUniGameResources.LoadResource_Prefabs("SoundEffectPlayer.prefab"), null, typeof(SoundEffectPlayer)) as SoundEffectPlayer; inputDevice = UniGameResources.NormalizePrefabs(UniGameResources.currentUniGameResources.LoadResource_Prefabs("InputDevice.prefab"), null, typeof(InputDevice)) as InputDevice; gameProcessControl = UniGameResources.NormalizePrefabs(UniGameResources.currentUniGameResources.LoadResource_Prefabs("GameProcessControl.prefab"), null, typeof(UniGameProcessControl)) as UniGameProcessControl; uiOrthographicCamera = UniGameResources.NormalizePrefabs(UniGameResources.currentUniGameResources.LoadResource_Prefabs("UICamera.prefab"), null, typeof(UniUIOrthographicCamera)) as UniUIOrthographicCamera; }
//释放函数 public override void Dispose() { if (CompanyLogobackground != null) { UnityEngine.Object.DestroyObject(CompanyLogobackground); CompanyLogobackground = null; } if (CompanyLogoPlayer != null) { UnityEngine.Object.DestroyObject(CompanyLogoPlayer.gameObject); CompanyLogoPlayer = null; } if (CompanyLogoTexture != null) { for (int i = 0; i < CompanyLogoTexture.Length; i++) { UniGameResources.ReleaseOneAssets(CompanyLogoTexture[i]); } CompanyLogoTexture = null; } }
public override void Initialization() { //进行一次内存释放 //Debug.Log("进行一次内存释放"); UniGameResources.UnloadUnusedAssets(); base.Initialization(); //Debug.Log("开始游戏了"); GameRoot.uiOrthographicCamera.LoadResource_UIPrefabs("FadeScreen.prefab", GameRoot.gameResource); m_GameMaxTime = ((RaceSceneControl)GameRoot.CurrentSceneControl).sceneDefineList[((RaceSceneControl)GameRoot.CurrentSceneControl).currentSelectSceneId].gameTime; //Debug.Log("游戏时间:::" + m_GameMaxTime); InitUI(); m_GameProcess = GameProcess.gaming; ((RaceSceneControl)GameRoot.CurrentSceneControl).SetPlayerIsEnterStart(); //开始音乐播放 MusicPlayer.Stop(true); MusicPlayer.Play("game.ogg", true); }