IEnumerator TutorialPart2() { generator.ClearWords(); GameLogger.Clear(); GameManager.Instance.blockInput = true; GameLogger.Log("<color=yellow>Good job.</color>"); yield return(new WaitForSeconds(2)); GameLogger.Log("<color=yellow>As you see, this didn't do anything, it just ended your turn.</color>"); yield return(new WaitForSeconds(3)); GameLogger.Log("<color=yellow>However, it's more interesting when you can combine this letters into something new.</color>"); yield return(new WaitForSeconds(3)); GameLogger.Log("<color=yellow>From now on, this word will be in the bottom right corner, and it will fill up as you do other actions.</color>"); nothingWordContainer.transform.parent.gameObject.SetActive(true); GameManager.Instance.nothingWordContainer = nothingWordContainer.GetComponent <WordContainer>(); yield return(new WaitForSeconds(3)); GameLogger.Log("<color=yellow>Okay, now try defeating this training dummy...</color>"); yield return(new WaitForSeconds(3)); GameLogger.Log("<color=yellow>Remember, when you're done with the words you can fill up, end your turn by doing \"nothing\".</color>"); yield return(new WaitForSeconds(3)); GameLogger.Log("<color=yellow>Good luck!</color>"); yield return(new WaitForSeconds(4)); GameLogger.Clear(); GameManager.Instance.currentEnemyEntity.OnDeath += OnDummyDead; GameManager.Instance.TutNextTurn(); generator.GenerateWords(); GameManager.Instance.blockInput = false; }
void Divine() { foreach (var agent in AliveAgentList.Where(a => RoleOf(a) == Role.SEER)) { var target = gameServer.RequestDivineTarget(agent); var targetRole = RoleOf(target); if (target == null || StatusOf(target) == Status.DEAD || targetRole == Role.UNC) { // Do nothing. } else { var divine = new Judge(Day, agent, target, targetRole.GetSpecies()); gameData.Divine = divine; if (targetRole == Role.FOX) { gameData.AddLastDeadAgent(target); gameData.CursedFox = target; } if (GameLogger != null) { GameLogger.Log($"{Day},divine,{agent.AgentIdx},{target.AgentIdx},{divine.Result}"); } } } }
public void DoAction(Entity source, Entity target) { GameLogger.Log("You knock <color=red>" + target.name + "</color> to the ground, gaining extra letters!"); source.Attack(target); GameManager.Instance.GiveRandomLetters(3, 1); SoundManager.Instance.PlayHitSound(); }
private void OnDestroy() { // gc lua VM m_state.Dispose(); GameLogger.Log("Lua Complete"); }
public void Update() { if (_currentQuest == null) { PickAQuest(); } if (_currentCommand == null) { _currentCommand = _currentQuest.GetCommand(this); } _currentCommand.invokeOn(this); if (_currentCommand.IsCompleted()) { _currentCommand = null; if (_currentQuest.IsCompleted()) { _currentQuest.Finalize(this); GameLogger.Log(name + " finished quest for " + _currentQuest.GetType().Name); _currentQuest = null; } } OnMouseDown(); }
// Use this for initialization void Start() { // Create the original team. Team team = new Team(); team.AddMember(new MemInfo("Anders", "Developer", 26)); team.AddMember(new MemInfo("Bill", "Developer", 46)); team.AddMember(new MemInfo("Steve", "CEO", 36)); Team clone = team.Clone() as Team; // Display the original team. GameLogger.Log("Original Team:"); GameLogger.Log(team.ToString()); // Display the cloned team. GameLogger.Log("Clone Team:"); GameLogger.Log(clone.ToString()); // Make changes. GameLogger.Log("*** Make a change to original team ***"); GameLogger.Log(Environment.NewLine); team.m_mems[0].m_nickname = "PM"; team.m_mems[0].m_age = 30; GameLogger.Log("modify team.m_mems[0] " + team.m_mems[0].ToString()); // Display the original team. GameLogger.Log("Original Team:"); GameLogger.Log(team.ToString()); // Display the cloned team. GameLogger.Log("Clone Team:"); GameLogger.Log(clone.ToString()); }
/// <summary> /// 初始化管理器 /// </summary> /// <param name="manager">目标管理器</param> public void InitManager(BaseManager manager) { if (!manager.Initialized) { try { if (!manager.InitManager()) { GameLogger.Error("GameManager", "InitManager 失败,管理器 {0}:{1} 初始化失败", manager.GetName(), manager.GetSubName()); GameErrorManager.LastError = GameError.InitializationFailed; } else { manager.initialized = true; manager.loadIndex = ++loadIndex; GameLogger.Log("GameManager", "{0}:{1} Inited ", manager.GetName(), manager.GetSubName()); CallManagerRedayCallback(manager, manager.GetNameWithSub()); if (GameManager.GameMediator != null) { GameManager.GameMediator.DispatchGlobalEvent(GameEventNames.EVENT_BASE_MANAGER_INIT_FINISHED, "*", manager.GetName(), manager.GetSubName()); } } } catch (Exception e) { GameLogger.Error("GameManager", (object)("管理器 " + manager.GetName() + ":" + manager.GetSubName() + " 初始化失败: " + e.Message + "\n" + e)); } } }
private void SetOriginPos(int gotoIndex) { var Value = 0; if (mTotalDataCount / 2 > gotoIndex) { Value = mTotalDataCount - gotoIndex + 1; } else { Value = mTotalDataCount - gotoIndex; } if (mScroll.vertical) { mScroll.normalizedPosition = new Vector2(mScroll.normalizedPosition.x, (Value / (float)mTotalDataCount)); GameLogger.Log(mScroll.normalizedPosition); } else if (mScroll.horizontal) { mScroll.normalizedPosition = new Vector2((Value / (float)mTotalDataCount), mScroll.normalizedPosition.y); } mStarIndex = GetStarIndex(mNormalValue); mEndIndex = mStarIndex - mMaxNum + 1; CURRENTINDEX = mStarIndex; UpdateView(mScroll.normalizedPosition); }
public override void Attack(Entity target) { string sourceName = ""; string targetName = ""; if (CompareTag("Player")) { sourceName = "The player"; } else { sourceName = "<color=red>" + name + "</color>"; } if (target.CompareTag("Player")) { targetName = "you"; } else { targetName = "<color=red>" + target.name + "</color>"; } GameLogger.Log(string.Format("{0} attacks {1}!", sourceName, targetName)); target.TakePhysicalDamage(stats.BaseDamage, this); }
IEnumerator Run() { yield return(new WaitForSeconds(1f)); if (GameManager.Mode != GameMode.MinimumDebug) { yield break; } GameLogger.Log(TAG, "Run Start"); yield return(new WaitUntil(GameManager.IsGameBaseInitFinished)); GameManager.CloseGameManagerAlert(); GameManager.GameMediator.RegisterEventHandler(GameEventNames.EVENT_GLOBAL_ALERT_CLOSE, "Debug", (evtName, param) => { if ((int)param[0] == dialogQuitId) { if ((bool)param[1]) { GameManager.QuitGame(); } } return(false); }); DebugLinearLayout(); //DebugPageGlobal(); GameManager.UIManager.MaskBlackSet(false); GameLogger.Log(TAG, "Run End"); }
public void Log(string text) { if (Logger != null) { Logger.Log(text); } }
void Guard() { foreach (var agent in AliveAgentList.Where(a => RoleOf(a) == Role.BODYGUARD)) { if (agent == gameData.Executed) { continue; } var target = gameServer.RequestGuardTarget(agent); if (target == null || agent == target) { // Do nothing. } else { var guard = new Guard(Day, agent, target); gameData.Guard = guard; if (GameLogger != null) { GameLogger.Log($"{Day},guard,{agent.AgentIdx},{target.AgentIdx},{RoleOf(target)}"); } } } }
IEnumerator WaitForExit() { GameLogger.Clear(); GameLogger.Log("<color=yellow>Thanks for playing Word Wielding! I hope you had fun and remember to rate the game!</color>"); yield return(new WaitForSeconds(5)); Application.Quit(); }
void TestToLua2() { string filename = "TestToLuaC2"; m_state.DoFile(filename); //这里获取不到 GameLogger.Log("Get Lua Local Value : " + m_state["local_num"]); //可以读取到全局的变量 GameLogger.Log("Get Lua Value : " + m_state["global_num"]); m_state["global_num"] = 10; GameLogger.Log("Set Lua Value : " + m_state["global_num"]); //调用lua方法 LuaFunction luaFunc = m_state.GetFunction("Count"); luaFunc.Call(); GameLogger.Log("Get Lua Value : " + m_state["global_num"]); //也可以直接 m_state.Call("Count", false); GameLogger.Log("Get Lua Value : " + m_state["global_num"]); //方法传入参数 LuaFunction valueFunc = m_state.GetFunction("InputValue"); valueFunc.BeginPCall(); valueFunc.Push("-- 这是CSharp中的参数----"); valueFunc.PCall(); valueFunc.EndPCall(); valueFunc.Call("--这是CSharp中直接调用传入参数-----"); // Get Table LuaTable table = m_state.GetTable("mytable"); table.Call("tableFunc"); LuaFunction tableFunc = table.GetLuaFunction("tableFunc"); GameLogger.Log("Lua Table Function"); tableFunc.Call(); //这里访问的时table的变量,不是local或者全局变量 GameLogger.Log("Get Table Value local_num : " + table["local_num"]); GameLogger.Log("Get Table Value global_num : " + table["global_num"]); GameLogger.Log("Get Table Value table_num : " + table["table_num"]); for (int i = 0; i < table.Length; ++i) { GameLogger.Log("table " + i.ToString() + " : " + table[i + 1]); } LuaDictTable dicTable = table.ToDictTable(); foreach (var item in dicTable) { GameLogger.LogFormat("dicTable {0} -- {1}", item.Key, item.Value); } }
private void InitSettings() { DebugManager.RegisterCommand("resetsettings", (string keyword, string fullCmd, string[] args) => { GameSettingsManager.ResetDefaultSettings(); GameLogger.Log(TAG, "设置已还原默认"); return(true); }, 0, "[还原默认设置]"); }
private void OnEntityDead() { GameManager.Instance.OnEntityDead(this); if (!CompareTag("Player")) { GameLogger.Log("You killed <color=red>" + name + "</color>"); Destroy(this.gameObject); } }
//加载GameInit模块 private IEnumerator GameInitPackages(string GameInitTable) { StringSpliter sp = new StringSpliter(GameInitTable, '\n'); if (sp.Count >= 1) { int loadedCount = 0; string[] args; GameLogger.Log(TAG, "Gameinit table : {0}", sp.Count); foreach (string ar in sp.Result) { if (ar.StartsWith(":")) { continue; } bool required = false; string packageName = ""; GameModRunMask mask = GameModRunMask.GameBase; args = ar.Split(':'); if (args.Length >= 3) { required = args[2] == "Required"; packageName = args[0]; System.Enum.TryParse(args[1], out mask); } bool modNeedRun = (mask & currentLoadMask) != GameModRunMask.None; //状态 loadedCount++; GameInitSetUIProgressValue(loadedCount / (float)sp.Count * 0.6f); UIProgressText.text = "Loading " + packageName; //加载 GameMod mod = ModManager.LoadGameModByPackageName(packageName, modNeedRun); if (mod != null) { mod.IsModInitByGameinit = true; yield return(new WaitUntil(mod.IsLoadComplete)); } if ((mod == null || (modNeedRun && mod.LoadStatus != GameModStatus.InitializeSuccess)) && required) { GameErrorManager.ThrowGameError(GameError.GameInitPartLoadFailed, "加载模块 " + packageName + " 时发生错误"); } } } UIProgressText.text = "Loading"; GameInitSetUIProgressValue(0.6f); }
void DayStart() { foreach (var agent in OrderedAgentList) { gameServer.DayStart(agent); if (GameLogger != null) { GameLogger.Log($"{Day},status,{agent.AgentIdx},{RoleOf(agent)},{StatusOf(agent)},{agentNameMap[agent]}"); } } }
private bool OnCommandHelp(string keyword, string fullCmd, string[] args) { string helpText = "命令帮助:\n"; foreach (CmdItem cmdItem in commands) { helpText += cmdItem.Keyword + " <color=#adadad>" + cmdItem.HelpText + "</color>\n"; } GameLogger.Log(TAG, helpText); return(true); }
IEnumerator ActionCoroutine(Entity target) { GameManager.Instance.blockInput = true; GameLogger.Log("You throw a... <color=yellow>Thong</color>? to <color=red>" + target.name + "</color>."); yield return(new WaitForSeconds(2)); GameLogger.Log("<color=red>" + target.name + "</color> <color=yellow>looks weirdly at you, a bit confused by the situation.</color>"); yield return(new WaitForSeconds(2)); GameLogger.Log("<color=yellow>This thong belongs to</color> <color=red>" + target.name + "</color><color=yellow>'s mother!</color>"); GameManager.Instance.blockInput = false; }
IEnumerator TutorialPart3() { GameLogger.Log("<color=yellow>Great job! </color>"); yield return(new WaitForSeconds(2)); GameLogger.Log("<color=yellow>Now you're ready to keep adventuring in the dungeon, in the search for all the loot you can possibly imagine!</color>"); yield return(new WaitForSeconds(4)); GameManager.Instance.TutNextTurn(); generator.GenerateWords(); GameManager.Instance.blockInput = false; }
public void BuildTiles() { NavMeshBuildSettings buildSettings = NavMeshBuildSettings.Default(); NavAgentSettings agentSettings = NavAgentSettings.Default(); NavMeshBuilder builder = new NavMeshBuilder(buildSettings, agentSettings); NavMeshTestData data = NavMeshTestData.Load(); data.GetInputData(out float3[] vertices, out int[] indices); GameLogger.Log("BuildTiles Inputs Vertices:{0} Triangles{1}", vertices.Length, indices.Length); NavMeshInputBuilder input = new NavMeshInputBuilder(default);
private bool OnCommandLoadMod(string keyword, string fullCmd, string[] args) { GameMod mod = LoadGameMod(args[0], args.Length >= 2 ? args[1] == "true" : false); if (mod == null) { GameLogger.Warning(TAG, "模组 {0} 加载失败", args[0]); return(false); } GameLogger.Log(TAG, "模组已加载 {0} ({1})", mod.PackageName, mod.Uid); return(true); }
public void ChangeProperty(IProperty relativeChange) { if (relativeChange.GetName() == "Boredom") { _stateSheet.Boredom.Value += relativeChange.GetValue(); GameLogger.Log(relativeChange.GetName() + " level now is " + _stateSheet.Boredom.GetValue()); } if (relativeChange.GetName() == "Fatigue") { _stateSheet.Fatigue.Value += relativeChange.GetValue(); GameLogger.Log(relativeChange.GetName() + " level now is " + _stateSheet.Fatigue.GetValue()); } }
public void DoAction(Entity source, Entity target) { if (source.CompareTag("Player")) { GameLogger.Log("You receive <color=lime>" + AmountToHeal + " health points</color>!"); } else { string prettyPrint = "<color=red>" + source.name + "</color>"; GameLogger.Log(prettyPrint + " heals for <color=lime>" + AmountToHeal + " health points</color>!"); } source.Heal(AmountToHeal); SoundManager.Instance.PlayHealSound(); }
private IEnumerator LoadAssets() { // 加载UI面板 GameLogger.Log("Load UICanvas."); AssetReference canvasRef = new AssetReference("UIPanel/UICanvas"); var canvasHandle = canvasRef.LoadAssetAsync <GameObject>(); yield return(canvasHandle); // 实例化UI面板 GameObject uiRoot = canvasHandle.InstantiateObject; // 加载图集 { GameLogger.Log("Load UIAtlas."); AssetReference atlasRef = new AssetReference("UIAtlas/UIWordArt/UIWordArt", "CN"); var atlasHandle = atlasRef.LoadAssetAsync <SpriteAtlas>(); yield return(atlasHandle); // 从图集里设置按钮精灵 Image img = uiRoot.transform.BFSearch("Button").GetComponent <Image>(); SpriteAtlas spriteAtlas = atlasHandle.AssetObject as SpriteAtlas; img.sprite = spriteAtlas.GetSprite("login_title"); img.SetNativeSize(); } // 加载资源包 { GameLogger.Log("Load texture package"); AssetReference packRef = new AssetReference("UITexture/Foods"); var handle1 = packRef.LoadAssetAsync <Texture>("eggs"); yield return(handle1); var handle2 = packRef.LoadAssetAsync <Texture>("banana"); yield return(handle2); // 设置纹理图片1 RawImage img1 = uiRoot.transform.BFSearch("Image1").GetComponent <RawImage>(); Texture tex1 = handle1.AssetObject as Texture; img1.texture = tex1; img1.SetNativeSize(); // 设置纹理图片2 RawImage img2 = uiRoot.transform.BFSearch("Image2").GetComponent <RawImage>(); Texture tex2 = handle2.AssetObject as Texture; img2.texture = tex2; img2.SetNativeSize(); } }
private void SetNormalize() { if (mScroll.horizontal) { mNormalValue = mScroll.normalizedPosition.x; } else if (mScroll.vertical) { mNormalValue = mScroll.normalizedPosition.y; } if (mNormalValue == 1) { mNormalValue = 0; } GameLogger.Log("mNormalValue:" + mNormalValue); }
/// <summary> /// 预加载窗口 /// </summary> public UIWindow PreloadWindow(EWindowType type) { // 如果窗口已经存在 if (IsContains(type)) { return(null); } GameLogger.Log($"Preload window {type}"); UIWindow window = _creater.CreateInstance(type); Push(window); window.InternalClose(); window.InternalLoad(OnWindowPrepare); return(window); }
public void OnEntityDead(Entity deadEntity) { if (deadEntity == playerEntity) { GameOver(); return; } // This is a hacky way to implement a XP table for mobs, by using their current // XP as the XP to give to the player... GameLogger.Log("<color=yellow>You receive " + deadEntity.XP + " experience points!</color>"); playerEntity.Stats.XP += deadEntity.XP; playerInfo.XPChanged(); SetupNewEnemy(); }
/// <summary> /// 加载模组包 /// </summary> /// <param name="packagePath">模组包路径</param> /// <param name="initialize">是否立即初始化模组包</param> /// <returns>返回模组包UID</returns> public GameMod LoadGameMod(string packagePath, bool initialize = true) { GameMod mod = FindGameModByPath(packagePath); if (mod != null) { GameLogger.Warning(TAG, "Mod \"{0}\" already registered, skip", packagePath); return(mod); } //路径处理 if (StringUtils.IsUrl(packagePath)) { GameLogger.Error(TAG, "不支持从 URL 加载模组包 \"{0}\" ,请将其先下载至 streamingAssetsPath 后再加载。", packagePath); return(null); } //处理路径至mod文件夹路径 if (!File.Exists(packagePath) && !GamePathManager.IsAbsolutePath(packagePath)) { packagePath = GamePathManager.GetResRealPath("mod", packagePath); } if (!File.Exists(packagePath)) { GameLogger.Error(TAG, "Mod file \"{0}\" not exists", packagePath); return(null); } mod = new GameMod(packagePath, this); if (!mod.Init()) { return(null); } if (!gameMods.Contains(mod)) { gameMods.Add(mod); } GameManager.GameMediator.DispatchGlobalEvent(GameEventNames.EVENT_MOD_REGISTERED, "*", mod.PackageName, mod); GameLogger.Log(TAG, "Register mod \"{0}\"", packagePath); if (initialize) { mod.Load(this); } return(mod); }