//更新catalogs async static ETTask <bool> UpdateCatalogs(this UIUpdateView self, string catalog) { //这里可能连不上,导致认为UpdateCatalogs成功 var res = await AddressablesManager.Instance.CheckForCatalogUpdates(); if (!string.IsNullOrEmpty(res)) { var updateRes = await AddressablesManager.Instance.UpdateCatalogs(catalog); if (updateRes) { return(true); } else { Log.Info("CoUpdateCatalogs Update Catalog handler retry"); return(await self.UpdateCatalogs(catalog)); } } else { Log.Info("CoUpdateCatalogs Update Catalog Failed"); var btnState = await self.ShowMsgBoxView("Update_Get_Fail", "Update_ReTry", self.force_update?"Btn_Exit" : "Update_Skip"); if (btnState == self.BTN_CONFIRM) { return(await self.UpdateCatalogs(catalog)); } else { if (self.force_update) { GameUtility.Quit(); } return(false); } } }
public static void BuildAndroid(string channelName, bool isTest) { BuildTarget buildTarget = BuildTarget.Android; PackageUtils.CopyAssetBundlesToStreamingAssets(buildTarget, channelName); if (!isTest) { CopyAndroidSDKResources(channelName); LaunchAssetBundleServer.ClearAssetBundleServerURL(); } else { LaunchAssetBundleServer.WriteAssetBundleServerURL(); } string buildFolder = Path.Combine(System.Environment.CurrentDirectory, ApkOutputPath); GameUtility.CheckDirAndCreateWhenNeeded(buildFolder); BaseChannel channel = ChannelManager.instance.CreateChannel(channelName); PlayerSettings.bundleIdentifier = channel.GetBundleID(); PlayerSettings.productName = channel.GetPackageName(); string savePath = null; if (channel.IsGooglePlay()) { savePath = Path.Combine(buildFolder, channelName); GameUtility.SafeDeleteDir(savePath); BuildPipeline.BuildPlayer(GetBuildScenes(), savePath, buildTarget, BuildOptions.AcceptExternalModificationsToPlayer); } else { savePath = Path.Combine(buildFolder, channel.GetPackageName() + ".apk"); BuildPipeline.BuildPlayer(GetBuildScenes(), savePath, buildTarget, BuildOptions.None); } Debug.Log(string.Format("Build android player for : {0} done! output :{1}", channelName, savePath)); }
public override void SetData(object[] src, System.Type type) { if ((long)GlobalVars.SelectedSupportUnitUniqueID > 0L) { List <UnitData> unitDataList = new List <UnitData>((IEnumerable <UnitData>)(src as UnitData[])); UnitData unitData1 = unitDataList.Find((Predicate <UnitData>)(x => x.UniqueID == (long)GlobalVars.SelectedSupportUnitUniqueID)); int index = 0; if (unitData1 == null) { UnitData unitData2 = this.mOwnUnits.Find((Predicate <UnitData>)(x => x.UniqueID == (long)GlobalVars.SelectedSupportUnitUniqueID)); if (unitData2 != null) { unitDataList.Add(unitData2); index = unitDataList.Count - 1; GameUtility.SortUnits(new List <UnitData>((IEnumerable <UnitData>)unitDataList), this.mUnitSortMode, false, out this.mSortValues, false); } } else { index = unitDataList.IndexOf(unitData1); } UnitData unitData3 = unitDataList[index]; unitDataList.RemoveAt(index); unitDataList.Insert(0, unitData3); if (this.mSortValues != null) { List <int> intList = new List <int>((IEnumerable <int>) this.mSortValues); int num = intList[index]; intList.RemoveAt(index); intList.Insert(0, num); this.mSortValues = intList.ToArray(); } src = (object[])unitDataList.ToArray(); } base.SetData(src, type); GameParameter.UpdateAll(((Component)this).get_gameObject()); this.mPage = 0; }
public static void BuildXCode(string channelName, bool isTest) { BuildTarget buildTarget = BuildTarget.iOS; PackageUtils.CopyAssetBundlesToStreamingAssets(buildTarget, channelName); if (!isTest) { LaunchAssetBundleServer.ClearAssetBundleServerURL(); } else { LaunchAssetBundleServer.WriteAssetBundleServerURL(); } string buildFolder = Path.Combine(System.Environment.CurrentDirectory, XCodeOutputPath); buildFolder = Path.Combine(buildFolder, channelName); GameUtility.CheckDirAndCreateWhenNeeded(buildFolder); string iconPath = "Assets/Editor/icon/ios/{0}/{1}.png"; string[] iconSizes = new string[] { "180", "167", "152", "144", "120", "114", "76", "72", "57" }; List <Texture2D> iconList = new List <Texture2D>(); for (int i = 0; i < iconSizes.Length; i++) { Texture2D texture = (Texture2D)AssetDatabase.LoadAssetAtPath(string.Format(iconPath, channelName, iconSizes[i]), typeof(Texture2D)); iconList.Add(texture); } PlayerSettings.SetIconsForTargetGroup(BuildTargetGroup.iOS, iconList.ToArray()); BaseChannel channel = ChannelManager.instance.CreateChannel(channelName); PlayerSettings.bundleIdentifier = channel.GetBundleID(); PlayerSettings.productName = channel.GetPackageName(); PackageUtils.CheckAndAddSymbolIfNeeded(buildTarget, channelName); BuildPipeline.BuildPlayer(GetBuildScenes(), buildFolder, buildTarget, BuildOptions.None); }
public void notifyGet(Character player, MAHJONG mah) { // 判断是否可胡或者可杠 CharacterData data = player.getCharacterData(); List <MahjongAction> actionList = new List <MahjongAction>(); // 是否可胡 if (GameUtility.canHu(data.mHandIn)) { List <HU_TYPE> huList = GameUtility.generateHuType(data.mHandIn, mah, data.mPengGangList, true, true); actionList.Add(new MahjongAction(ACTION_TYPE.AT_HU, player, player, mah, huList)); } // 是否可以杠 else if (GameUtility.canGang(data.mHandIn)) { actionList.Add(new MahjongAction(ACTION_TYPE.AT_GANG, player, player, mah)); } // 摸了一张自己碰的牌,可以开杠 else { int pengIndex = 0; if (player.hasPeng(mah, ref pengIndex)) { actionList.Add(new MahjongAction(ACTION_TYPE.AT_GANG, player, player, mah)); } } if (actionList.Count > 0) { // 如果有可以操作的行为,则还需要添加Pass行为 actionList.Add(new MahjongAction(ACTION_TYPE.AT_PASS, player, null, MAHJONG.M_MAX)); askPlayerAction(player, player, mah, actionList); } else { // 没有任何操作则通知玩家需要打一张牌出来 pushCommand <CommandCharacterAskDrop>(player); } }
public static void ToggleWindowState(GameObject go, bool open, bool keepActive) { bool activeInHierarchy = go.get_activeInHierarchy(); if (open && !activeInHierarchy) { go.SetActive(true); } Animator component = (Animator)go.GetComponent <Animator>(); if (!activeInHierarchy) { ((Behaviour)component).set_enabled(false); ((Behaviour)component).set_enabled(true); } if (GameUtility.ValidateAnimator(component)) { component.SetBool("close", !open); } if (keepActive) { return; } UIDeactivator uiDeactivator = (UIDeactivator)go.GetComponent <UIDeactivator>(); if (Object.op_Equality((Object)uiDeactivator, (Object)null)) { uiDeactivator = (UIDeactivator)go.AddComponent <UIDeactivator>(); } if (!open) { ((Behaviour)uiDeactivator).set_enabled(true); } else { ((Behaviour)uiDeactivator).set_enabled(false); } }
IEnumerator Runnable() { if (isWork) { yield break; } isWork = true; float soundTick = 2F; while (!isComplete && isWork) { if (isPause) { yield return(null); } soundTick += Time.deltaTime; if (soundTick >= 2F) { soundTick = 0F; Owner.Audio.play(LoadManager.Instance.GetSFXData(SFXType.Build).clip, 1F, 0F, 1F); } TimeSpan remainTime = realTime - GameUtility.Now( ); TimeSpan current = totalTime - remainTime; progressBar.fillAmount = (float)(current.TotalSeconds / totalTime.TotalSeconds); WorkTimeText.SetText(string.Format("{0}:{1:D2}", (int)remainTime.TotalMinutes, remainTime.Seconds)); if (progressBar.fillAmount >= 1f) { isComplete = true; } yield return(null); } Stop( ); }
public static void RunCheckAssetBundle() { var initGroups = new string[] { "static_effect", "static_lua", "static_models", "static_shaders", "static_ui", "static_fb", "static_luamap" }; var start = DateTime.Now; //更新assetmap List <AddressableAssetEntry> assets = new List <AddressableAssetEntry>(); AASUtility.GetSettings().GetAllAssets(assets, false, (g) => { return(g.name.Equals("static_lua")); }); string[] address = assets.Select(e => e.address).ToArray(); string assetFolder = Path.Combine(Application.dataPath, AddressableConfig.AssetsFolderName); var assetPathMap = Path.Combine(assetFolder, AddressableConfig.AssetsPathMapFileName); GameUtility.SafeWriteAllLines(assetPathMap, address); AssetDatabase.Refresh(); //初始化Groups foreach (var g in initGroups) { AASUtility.CreateGroup(g); } Debug.Log("Finished Update Asset Path Map... " + (DateTime.Now - start).TotalSeconds + "s"); }
static public IEnumerator Init() { //初始化 资源加载器 yield return(AssetLoadManager.Init()); //加载资源信息文件 yield return(GameUtility.LoadAssetsInfo()); //加载Bundle信息文件 if (Configs.clientConfig.isReleaseBundle) { yield return(GameUtility.LoadBundlesInfo()); } //加载所有配置文件 yield return(Configs.LoadAllConfigs()); //加载 热更策略文件 yield return(LoadAllPolicys()); //加载 所有后续需要处理的资源 yield return(DownloadAllAssets()); }
private static void PrepareUnitAnimation(CharacterDB.Job jobData, string animationName, bool addJobName, JobParam param = null) { StringBuilder stringBuilder = GameUtility.GetStringBuilder(); stringBuilder.Append("CHM/"); stringBuilder.Append(jobData.AssetPrefix); stringBuilder.Append('_'); if (addJobName) { if (param != null) { stringBuilder.Append(param.model); stringBuilder.Append('_'); } else { stringBuilder.Append(jobData.JobID); stringBuilder.Append('_'); } } stringBuilder.Append(animationName); AssetManager.PrepareAssets(stringBuilder.ToString()); }
public void InitAssetSkinLabelText(string text) { string[] lines = GameUtility.StringToArrary(text); Dictionary <string, Dictionary <string, bool> > dict = new Dictionary <string, Dictionary <string, bool> >(); //为了防止路径里面带有空格,这里区分不采用空格来划分而采用&& for (var i = 0; i < lines.Length; i++) { string[] splits = lines[i].Split(new string[] { "&&" }, StringSplitOptions.RemoveEmptyEntries); if (splits.Length > 0) { Dictionary <string, bool> labelMap = new Dictionary <string, bool>(); var address = splits[0]; for (var j = 1; j < splits.Length; j++) { var label = splits[j]; labelMap.Add(label, true); } dict.Add(address, labelMap); } } assetSkinLabelMap = dict; }
public override void execute() { Room room = mReceiver as Room; GameScene gameScene = mGameSceneManager.getCurScene(); if (gameScene.getSceneType() != GAME_SCENE_TYPE.GST_MAHJONG) { return; } // 重新计算客户端位置 CharacterData data = mCharacter.getCharacterData(); CharacterData myselfData = mCharacterManager.getMyself().getCharacterData(); data.mPosition = GameUtility.serverPositionToClientPosition(data.mServerPosition, myselfData.mServerPosition); // 通知房间有玩家加入本局麻将 room.notifyPlayerJoin(mCharacter); // 只能在麻将场景的等待流程才能通知加入 if (gameScene.atProcedure(PROCEDURE_TYPE.PT_MAHJONG_WAITING)) { ScriptAllCharacterInfo allInfo = mLayoutManager.getScript(LAYOUT_TYPE.LT_ALL_CHARACTER_INFO) as ScriptAllCharacterInfo; allInfo.notifyCharacterJoin(mCharacter); } }
public static void Encode4Editor() { string destination = Path.Combine(Application.dataPath, "LuaScriptsEncode"); string source = Path.Combine(Application.dataPath, XLuaManager.luaScriptsFolder); GameUtility.SafeDeleteDir(destination); FileUtil.CopyFileOrDirectoryFollowSymlinks(source, destination); var luaFiles = GameUtility.GetSpecifyFilesInFolder(destination, new string[] { ".lua" }, false); if (luaFiles != null && luaFiles.Length > 0) { for (int i = 0; i < luaFiles.Length; i++) { GameUtility.SafeDeleteFile(luaFiles[i]); EncodeLuaFile(luaFiles[i].Replace("LuaScriptsEncode", XLuaManager.luaScriptsFolder), luaFiles[i]); } } AssetDatabase.Refresh(); Debug.Log("Encode lua files over"); }
void SaveExistingPerk() { // Check that the given ID isn't already in the database. if (!RequirementsMet(perkID, selectedPerk)) { Debug.LogError("An item with that ID (" + perkID + ") already exists."); return; } selectedPerk.PerkName = perkName; selectedPerk.PerkID = perkID; selectedPerk.PerkDesc = perkDesc; selectedPerk.PerkAuras = perkAuras; // Set icon selectedPerk.SetIcon(perkIcon); // Find icon path perkIconPath = AssetDatabase.GetAssetPath(perkIcon); perkIconPath = GameUtility.CleanItemResourcePath(perkIconPath, "Assets/Resources/"); perkIconPath = GameUtility.CleanItemResourcePath(perkIconPath, ".png"); selectedPerk.PerkIconpath = perkIconPath; }
public void SetGroup(ConceptCardSkillDatailData data) { if (data.skill_data == null) { return; } this.SetText(this.mAbilityName, data.skill_data.Name); if (data.type == ConceptCardDetailAbility.ShowType.LockSkill) { if (data.learning_skill == null) { return; } this.SetText(this.mDescriptionText, LocalizedText.Get("sys.CONCEPT_CARD_SKILL_DESCRIPTION_LV", new object[1] { (object)data.learning_skill.locklv })); } else { this.SetText(this.mDescriptionText, GameUtility.GetExternalLocalizedText("skill", data.skill_data.SkillParam.iname, "CONCEPT_TXT")); } }
public static string[] ReadAppAndResVersionFile(BuildTarget buildTarget, ChannelType channelType) { // 从资源版本号文件(当前渠道AB输出目录中)加载资源版本号 string rootPath = GetAssetBundleOutputPath(buildTarget, channelType.ToString()); string app_path = rootPath + "/" + BuildUtils.AppVersionFileName; app_path = GameUtility.FormatToUnityPath(app_path); string resVersion = "0.0.0"; string content = GameUtility.SafeReadAllText(app_path); if (content != null) { var arr = content.Split('|'); if (arr.Length >= 3) { return(arr); } } Debug.LogError("找不到 appVersion.bytes 文件"); return(null); }
/// <summary> /// Initializes a new instance of the <see cref="Artoncode.Core.SwipeGamepad"/> class. /// </summary> /// <param name="scaleType">Scale type.</param> /// <param name="radius">Radius.</param> public SwipeGamepad(ScaleType scaleType, float radius) { switch (scaleType) { case ScaleType.Absolute: this.radius = radius; break; case ScaleType.RelativeToWidth: this.radius = radius * Screen.width; break; case ScaleType.RelativeToHeight: this.radius = radius * Screen.height; break; case ScaleType.Resolution: this.radius = GameUtility.inchToPixel(radius); break; } gestures = new List <Gesture> (); invertX = false; }
public void SetName(string inFirstName, string inLastName) { string oldName = name; mFirstName = inFirstName; if (inLastName.Length > 0) { mLastName = GameUtility.ChangeFirstCharToUpperCase(inLastName); } mShortName = mFirstName.Length <= 0 ? "." : firstName[0] + ". " + lastName; mThreeLetterName = ""; for (int index = 0; index < lastName.Length; ++index) { if (mThreeLetterName.Length < 3 && lastName[index].ToString() != " ") { mThreeLetterName += lastName[index]; } } name = inFirstName + " " + inLastName; Game.instance.mechanicManager.GetEntityList().ForEach(mechs => mechs.DriverRenamed(oldName, name)); }
private void ReloadPreviewModels() { if (this.mCurrentUnit == null || UnityEngine.Object.op_Equality((UnityEngine.Object) this.mPreviewParent, (UnityEngine.Object)null)) { return; } GameUtility.DestroyGameObjects <UnitPreview>(this.mPreviewControllers); this.mPreviewControllers.Clear(); this.mCurrentPreview = (UnitPreview)null; if (UnityEngine.Object.op_Implicit((UnityEngine.Object) this.mCurrentPreview)) { return; } GameObject gameObject = new GameObject("Preview", new System.Type[1] { typeof(UnitPreview) }); this.mCurrentPreview = (UnitPreview)gameObject.GetComponent <UnitPreview>(); this.mCurrentPreview.DefaultLayer = GameUtility.LayerHidden; this.mCurrentPreview.SetupUnit(this.mCurrentUnit, -1); gameObject.get_transform().SetParent(this.mPreviewParent, false); this.mPreviewControllers.Add(this.mCurrentPreview); }
public string AddHero(string id, double exp, int level, string uid = "") { if (HeroRecord == null) { HeroRecord = new Dictionary <string, HeroRecordData>(); } if (string.IsNullOrEmpty(uid)) { uid = GameUtility.GenerateOrderId(); } HeroRecordData hero = new HeroRecordData { UID = uid, ID = id, Exp = exp, Level = level }; HeroRecord.Add(uid, hero); return(uid); }
protected virtual void Awake() { ((UIBehaviour)this).Awake(); GameUtility.SetNeverSleep(); if (!Application.get_isPlaying()) { return; } MyCriManager.Setup(false); this.mMoviePlayer = (CriManaPlayer)((Component)this).GetComponent <CriManaPlayer>(); if (!Object.op_Inequality((Object)this.mMoviePlayer, (Object)null)) { return; } if (!GameUtility.Config_UseAssetBundles.Value) { this.mMoviePlayer.set_moviePath(AssetManager.GetLocalizedObjectName("StreamingAssets/" + MyCriManager.GetLoadFileName(this.mMoviePlayer.get_moviePath()), false).Replace("StreamingAssets/", string.Empty)); } else { this.mMoviePlayer.set_moviePath(MyCriManager.GetLoadFileName(AssetManager.GetLocalizedObjectName("StreamingAssets/" + this.mMoviePlayer.get_moviePath(), false).Replace("StreamingAssets/", string.Empty))); } }
public static void BuildAndroid(string channelName, bool isTest) { BuildTarget buildTarget = BuildTarget.Android; PackageUtils.CopyAssetBundlesToStreamingAssets(buildTarget, channelName); if (!isTest) { LaunchAssetBundleServer.ClearAssetBundleServerURL(); } else { LaunchAssetBundleServer.WriteAssetBundleServerURL(); } BaseChannel channel = ChannelManager.instance.CreateChannel(channelName); SetPlayerSetting(channel); string savePath = PackageUtils.GetChannelOutputPath(buildTarget, channelName); string appName = channel.GetProductName() + ".apk"; if (channel.IsGooglePlay()) { savePath = Path.Combine(savePath, "GooglePlay"); GameUtility.SafeDeleteDir(savePath); BuildPipeline.BuildPlayer(GetBuildScenes(), savePath, buildTarget, BuildOptions.AcceptExternalModificationsToPlayer); } else { savePath = Path.Combine(savePath, appName); BuildPipeline.BuildPlayer(GetBuildScenes(), savePath, buildTarget, BuildOptions.None); } string outputPath = Path.Combine(Application.persistentDataPath, AssetBundleConfig.AssetBundlesFolderName); GameUtility.SafeDeleteDir(outputPath); Debug.Log(string.Format("Build android player for : {0} done! output :{1}", channelName, savePath)); }
private void Refresh() { GameUtility.DestroyGameObjects(this.mItems); this.mItems.Clear(); LimitedShopData limitedShopData = MonoSingleton <GameManager> .Instance.Player.GetLimitedShopData(); if (limitedShopData == null || limitedShopData.items.Count <= 0) { return; } int shopBuyIndex = GlobalVars.ShopBuyIndex; if (!Object.op_Inequality((Object)this.ItemTemplate, (Object)null)) { return; } Transform transform = !Object.op_Inequality((Object)this.ItemParent, (Object)null) ? this.ItemTemplate.get_transform().get_parent() : this.ItemParent.get_transform(); LimitedShopItem limitedShopItem = limitedShopData.items[shopBuyIndex]; if (limitedShopItem.children != null && limitedShopItem.children.Length > 0) { foreach (Json_ShopItemDesc child in limitedShopItem.children) { ItemData data = new ItemData(); data.Setup(0L, child.iname, child.num); if (data != null) { GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.ItemTemplate); gameObject.get_transform().SetParent(transform, false); DataSource.Bind <ItemData>(gameObject, data); this.mItems.Add(gameObject); gameObject.SetActive(true); } } } GameParameter.UpdateAll(((Component)transform).get_gameObject()); }
public void CreateSkillPrefab(GameObject ability_detail_parent) { List <ConceptCardSkillDatailData> abilityDatailData = this.mConceptCardData.GetAbilityDatailData(); this.mAbilityDetailParent = ability_detail_parent; if (Object.op_Inequality((Object)this.m_ShowBaseToggle, (Object)null)) { this.m_ShowBaseToggle.set_interactable(false); } for (int index = 0; index < this.m_AbilityDeriveList.Count; ++index) { ((Component)this.m_AbilityDeriveList[index]).get_gameObject().SetActive(false); } for (int index = 0; index < abilityDatailData.Count; ++index) { ConceptCardSkillDatailData conceptCardSkillDatailData = abilityDatailData[index]; AbilityDeriveList abilityDeriveList; if (index < this.m_AbilityDeriveList.Count) { abilityDeriveList = this.m_AbilityDeriveList[index]; } else { abilityDeriveList = this.CreateAbilityListItem(); this.m_AbilityDeriveList.Add(abilityDeriveList); } abilityDeriveList.SetupWithConceptCard(conceptCardSkillDatailData, this.m_UnitData, new ConceptCardDetailAbility.ClickDetail(this.OnClickDetail)); if (Object.op_Inequality((Object)this.m_ShowBaseToggle, (Object)null)) { Selectable showBaseToggle = this.m_ShowBaseToggle; showBaseToggle.set_interactable(showBaseToggle.get_interactable() | abilityDeriveList.HasDerive); } GameUtility.SetGameObjectActive((Component)abilityDeriveList, true); } GameUtility.SetGameObjectActive(this.AbilityTemplate, false); this.AbilityTemplate.get_gameObject().SetActive(false); }
IEnumerator InitLocalVersion() { clientAppVersion = ChannelManager.instance.appVersion; var resVersionRequest = AssetBundleManager.Instance.RequestAssetFileAsync(BuildUtils.ResVersionFileName); yield return(resVersionRequest); var streamingResVersion = resVersionRequest.text; resVersionRequest.Dispose(); var persistentResVersion = GameUtility.SafeReadAllText(resVersionPath); if (string.IsNullOrEmpty(persistentResVersion)) { clientResVersion = streamingResVersion; } else { clientResVersion = BuildUtils.CheckIsNewVersion(streamingResVersion, persistentResVersion) ? persistentResVersion : streamingResVersion; } GameUtility.SafeWriteAllText(resVersionPath, clientResVersion); var persistentNoticeVersion = GameUtility.SafeReadAllText(noticeVersionPath); if (!string.IsNullOrEmpty(persistentNoticeVersion)) { ChannelManager.instance.noticeVersion = persistentNoticeVersion; } else { ChannelManager.instance.noticeVersion = "1.0.0"; } Logger.Log(string.Format("streamingResVersion = {0}, persistentResVersion = {1}, persistentNoticeVersion = {2}", streamingResVersion, persistentResVersion, persistentNoticeVersion)); yield break; }
void HandleChasing() { if (targetMoluvusha) { // Vector3 reverseTanNorm = -1.0f * bezierScript.GetTangentAt(0.05f).normalized; // Vector3 reverseTan = new Vector3(-2.0f * reverseTanNorm.x / reverseTanNorm.y,-2.0f,0.0f); // transform.position = startPoint.transform.position + reverseTan; targetPoint.transform.position = targetMoluvusha.transform.position; timeInterpolate = GameUtility.changeTowards(timeInterpolate, 1.0f, accelerationSpeed, Time.fixedDeltaTime); if (timeInterpolate >= 0.95f) { eatFlag = Time.time; currentState = LightEaterState.eating; targetMoluvusha.GetComponent <Moluvusha>().EatMoluvusha(timeToEat); if (ltMat) { ltMat.SetGlowIntensity(1.0f); } if (anim) { anim.SetTrigger(eatTrigger); } } } else { currentState = LightEaterState.retract; if (anim) { anim.SetTrigger(retractTrigger); } } }
public override void GoToEndState() { if (this.Mode == EventAction_FadeScreen.FadeModes.Screen) { if (this.FadeOut) { FadeController.Instance.FadeTo(this.FadeColor, 0.0f, 0); } else { GameUtility.FadeIn(0.0f); } } else { FadeController instance = FadeController.Instance; TacticsUnitController[] tacticsUnitControllerArray1 = (TacticsUnitController[])null; TacticsUnitController[] tacticsUnitControllerArray2 = (TacticsUnitController[])null; if (this.ExcludeUnits != null && this.ExcludeUnits.Length > 0) { tacticsUnitControllerArray2 = new TacticsUnitController[this.ExcludeUnits.Length]; for (int index = 0; index < tacticsUnitControllerArray2.Length; ++index) { tacticsUnitControllerArray2[index] = TacticsUnitController.FindByUniqueName(this.ExcludeUnits[index]); } } if (this.IncludeUnits != null && this.IncludeUnits.Length > 0) { tacticsUnitControllerArray1 = new TacticsUnitController[this.IncludeUnits.Length]; for (int index = 0; index < tacticsUnitControllerArray1.Length; ++index) { tacticsUnitControllerArray1[index] = TacticsUnitController.FindByUniqueName(this.IncludeUnits[index]); } } instance.BeginSceneFade(this.FadeColor, 0.0f, tacticsUnitControllerArray2 == null ? (TacticsUnitController[])null : tacticsUnitControllerArray2, tacticsUnitControllerArray1 == null ? (TacticsUnitController[])null : tacticsUnitControllerArray1); } }
public override void execute() { CharacterMyself myself = mCharacterManager.getMyself(); // 速度 if (myself != null && myself.getProcessExternalSpeed()) { CommandCharacterHardwareSpeed cmdSpeed = newCmd(out cmdSpeed, false); cmdSpeed.mDirectSpeed = false; cmdSpeed.mExternalSpeed = true; if (GameUtility.mReadRPM) { cmdSpeed.mSpeed = GameUtility.HWSToMS(mRPM); } else { cmdSpeed.mSpeed = GameUtility.HWSToMS(mPower); } pushCommand(cmdSpeed, mCharacterManager.getMyself()); } // 按键 KeyCode[] key = new KeyCode[] { KeyCode.A, KeyCode.B, KeyCode.X, KeyCode.Y }; int count = key.Length; for (int i = 0; i < count; ++i) { mGameInputManager.setKeyState(key[i], isKeyDown(i)); } // 转向 mGameInputManager.setStickAngle(mAngle); if (mScriptDebugInfo != null) { mScriptDebugInfo.setOrginStackAngle(mAngle); mScriptDebugInfo.setRPM(mRPM); mScriptDebugInfo.setPower(mPower); } }
void InitAppVersion() { string outputPath = Path.Combine(Application.persistentDataPath, "version.txt"); GameUtility.CheckFileAndCreateDirWhenNeeded(outputPath); var persistentAppVersion = GameUtility.SafeReadAllText(outputPath); if (persistentAppVersion == null) { GameUtility.SafeWriteAllText(outputPath, Application.version); return; } Debug.Log(string.Format("app_ver = {0}, persistentAppVersion = {1}", Application.version, persistentAppVersion)); // 如果persistent目录版本app版本低,说明是大版本覆盖安装,清理过时的缓存 if (!string.IsNullOrEmpty(persistentAppVersion) && VersionCompare.Compare(persistentAppVersion, Application.version) < 0) { var path = AssetBundleUtility.GetPersistentDataPath(); GameUtility.SafeDeleteDir(path); var path1 = AssetBundleUtility.GetCatalogDataPath(); GameUtility.SafeDeleteDir(path1); } GameUtility.SafeWriteAllText(outputPath, Application.version); }
public static byte[] CustomLoader(ref string filepath) { string scriptPath = string.Empty; filepath = filepath.Replace(".", "/") + ".lua"; #if UNITY_EDITOR if (AssetBundleConfig.IsEditorMode) { #if Encode4Editor scriptPath = Path.Combine(Application.dataPath, "LuaScriptsEncode"); #else scriptPath = Path.Combine(Application.dataPath, luaScriptsFolder); #endif scriptPath = Path.Combine(scriptPath, filepath); // Logger.Log("Load lua script : " + scriptPath); return(GameUtility.SafeReadAllBytes(scriptPath)); } #endif scriptPath = string.Format("{0}/{1}.bytes", luaAssetbundleAssetName, filepath); string assetbundleName = null; string assetName = null; bool status = AssetBundleManager.Instance.MapAssetPath(scriptPath, out assetbundleName, out assetName); if (!status) { Logger.LogError("MapAssetPath failed : " + scriptPath); return(null); } var asset = AssetBundleManager.Instance.GetLuaCache(assetName) as TextAsset; if (asset != null) { //Logger.Log("Load lua script : " + scriptPath); return(asset.bytes); } Logger.LogError("Load lua script failed : " + scriptPath + ", You should preload lua assetbundle first!!!"); return(null); }