static void Postfix(CheatMenu __instance) { AchievementManager am = G.Sys.Achievements_; EAchievements achievement = EAchievements.Rampage; string cheatname = "THE MIGHTY LAMP"; string cheatlocked = string.Format("{0} Complete: {1}", "To Unlock:".Colorize(Colors.tomato), am.GetAchievement(achievement).name_); string cheatunlocked = string.Format("{0}: Enlighten your way through the Array", "Visual".Colorize(Colors.yellowGreen)); if (!am.HasAchieved(achievement)) { __instance.TweakAction(GUtils.GetLockedText(cheatname).Colorize(Colors.gray), null, cheatlocked); } else { __instance.TweakBool(cheatname, Entry.GetKey("lamp.cheat", false), (value) => { Entry.SetKey("lamp.cheat", value); foreach (Scripts.LampController controller in UnityEngine.Object.FindObjectsOfType <Scripts.LampController>()) { controller.lamp.SetActive(Entry.GetKey("lamp.cheat", false)); } }, cheatunlocked); } }
static void Postfix(TriggerCooldownLogic __instance, ref Collider other) { if (!GUtils.IsRelevantLocalCar(other)) { return; } Global.ColorFlag = !Global.ColorFlag; Global.HUDAnimate = Stopwatch.StartNew(); }
void OnTriggerEnter(Collider other) { if (!triggered) { var playerData = GUtils.IsRelevantLocalCar(other); if (playerData != null) { AbilityBatteryChange[] abilityBatteryChanges = new AbilityBatteryChange[4]; if (enableBoosting) { playerData.EnableOrDisableBoost(true, true); abilityBatteryChanges[0] = AbilityBatteryChange.Enable; playerData.CarLogic_.Boost_.AbilityEnabled_ = true; } if (enableJumping) { playerData.EnableOrDisableJump(true, true); abilityBatteryChanges[1] = AbilityBatteryChange.Enable; playerData.CarLogic_.Jump_.AbilityEnabled_ = true; } if (enableFlying) { playerData.EnableOrDisableWings(true, true); abilityBatteryChanges[2] = AbilityBatteryChange.Enable; playerData.CarLogic_.Wings_.AbilityEnabled_ = true; } if (enableJetRotating) { playerData.EnableOrDisableJets(true, true); abilityBatteryChanges[3] = AbilityBatteryChange.Enable; playerData.CarLogic_.Jets_.AbilityEnabled_ = true; } if (showAbilityBattery) { var screen = playerData.CarScreenLogic_; if (screen) { screen.EnableAbilityBattery(abilityBatteryChanges, "downloading"); AudioManager.PostEvent("Play_SystemActivate", playerData.Car_); } } if (oneTimeTrigger) { triggered = true; } } } }
public void UpdateBar(FactionProgress fp, CellStruct[,] playerState, CellStruct[,] enemyState) { int boardCount = GUtils.Serialize(playerState).Count(cell => cell.bldg == this.displayBldg && !cell.destroyed && !cell.defected); //count all friendly spaces not taken over boardCount += GUtils.Serialize(enemyState).Count(cell => cell.bldg == this.displayBldg && !cell.destroyed && cell.defected); //count all enemy spaces taken over this.countText.text = boardCount.ToString(); //Fill the bar based on total progress int count = fp.GetProgress(this.faction); this.fill.fillAmount = (float)count / this.maxInterval; }
internal static bool Prefix(HostAGame __instance, int direction) { __instance.internalMaxPlayerCalc_ = GUtils.mod(__instance.internalMaxPlayerCalc_ + direction, Mod.Instance.Config.MaxPlayerCount); __instance.maxPlayersLabel_.text = __instance.MaxPlayers_.ToString(); if (direction != 0 && AudioManager.Valid()) { G.Sys.AudioManager_.PlaySound("ButtonSelect", "Menus", 1f); } return(false); }
public string textInfoOf(ModePlayerInfoBase playerInfo) { if (playerInfo is TimeBasedModePlayerInfo) { return(((int)((TimeBasedModePlayerInfo)playerInfo).distanceToFinish_).ToString() + "m"); } if (playerInfo is SoccerMode.SoccerModePlayerInfo) { return("Team " + ((SoccerMode.SoccerModePlayerInfo)playerInfo).team_.ID_ + " - score " + ((SoccerMode.SoccerModePlayerInfo)playerInfo).team_.points_); } if (G.Sys.GameManager_.ModeID_ == GameModeID.ReverseTag) { return(GUtils.GetFormattedTime((float)playerInfo.modeData_, true, 3)); } return(playerInfo.modeData_.ToString() + " eV"); }
public override void Run() { Transform OptionsTable = GameObject.Find(Root()).transform; Transform[] Widgets = (from child_object in OptionsTable.GetChildren() where !child_object.HasComponent <UIExBlueprint>() select child_object).ToArray(); void Translate(ECheat cheat, int index, string id) { if (G.Sys.CheatsManager_.IsUnlocked(cheat)) { if ((cheat == ECheat.CampaignPlus && !G.Sys.CheatsManager_.CampaignPlusRecognized_) || G.Sys.CheatsManager_.GetCheat(cheat).affectsGameplay&& !G.Sys.CheatsManager_.GameplayCheatsRecognized_) { Widgets[index].Find("NameLabel").GetComponent <UILabel>().text = Language.GetLine($"settings.cheats.{id}").UP().Colorize(Colors.tomato); Widgets[index].gameObject.GetComponent <SetMenuDescriptionOnHover>().SetText(Language.GetLine($"settings.cheats.{id}.description.unavailable")); } else { bool flag_needrestart = cheat == ECheat.CampaignPlus && G.Sys.GameManager_.IsCampaignMode_; Widgets[index].Find("NameLabel").GetComponent <UILabel>().text = (Language.GetLine($"settings.cheats.{id}") + ':').UP(); Widgets[index].gameObject.GetComponent <SetMenuDescriptionOnHover>().SetText(Language.GetLine($"settings.cheats.{id}.description.unlocked") + (flag_needrestart ? '\n' + Language.GetLine($"settings.cheats.{id}.description.needrestart") : "")); } } else { Widgets[index].Find("NameLabel").GetComponent <UILabel>().text = GUtils.GetLockedText(Language.GetLine($"settings.cheats.{id}")).Colorize(Color.gray); Widgets[index].gameObject.GetComponent <SetMenuDescriptionOnHover>().SetText(Language.GetLine($"settings.cheats.{id}.description.locked")); } } GameObject.Find($"{MenuTitleTemplate()}/UILabel - Title").GetComponent <UILabel>().text = Language.GetLine("settings.cheats.title"); Translate(ECheat.CampaignPlus, 0, "campaignplus"); Translate(ECheat.MotorcycleMode, 1, "motorcyclemode"); Translate(ECheat.MonsterTruck, 2, "monstertruck"); Translate(ECheat.SkyWalker, 3, "skywalker"); Translate(ECheat.FilmNoir, 4, "filmnoir"); Translate(ECheat.StylizedOutlines, 5, "stylizedoutlines"); Translate(ECheat.SuperBoost, 6, "superboost"); Translate(ECheat.MaxDamage, 7, "maxdamage"); Translate(ECheat.BubbleCar, 8, "bubblecar"); Translate(ECheat.DeathProof, 9, "deathproof"); Translate(ECheat.CrabFriend, 10, "crabfriend"); Translate(ECheat.CrownOfTheElders, 11, "crownoftheelders"); Translate(ECheat.PreservationalBoosterSloth, 12, "preservationalboostersloth"); Disable(); }
private void InitializeUtils() { Utils = new GUtils(this, "GodsOfDeceitUtils"); /// Order matters, these modules must get initialized before the rest Utils.BuildPlatform = new GBuildPlatform(Utils); Utils.Path = new GPath(Utils); Utils.Log = new GLog(Utils); Utils.BuildConfiguration = new GBuildConfiguration(Utils); Utils.BuildInfo = new GBuildInfo(Utils); Utils.Definitions = new GDefinitions(Utils); Utils.EngineModules = new GEngineModules(Utils); Utils.GameModules = new GGameModules(Utils); Utils.Plugins = new GPlugins(Utils); Utils.ThirdParty = new GThirdParty(Utils); }
protected override sealed void OnMarketData(MarketDataEventArgs e) { DateTime t; if (useMillisec) { _ComputeTimeOffset(e.Time); t = DateTime.Now.AddMilliseconds(_timeOffset); } else { t = e.Time; } if (!_initBidAsk) { _initBidAsk = (_ask > _bid); } if ((e.MarketDataType == MarketDataType.Last)) { _mktDataTimeTicks = e.Time.Ticks; if (_writeData && _writeOK && _writable && _initBidAsk) { _writeOK = _fm.RecordTick(t, _bid, _ask, e.Price, (int)e.Volume); _firstRec = true; } _UpdateBeginEndTime(); if (_disableTime || ((_mktDataTimeTicks >= _beginTimeTicks) && (_mktDataTimeTicks < _endTimeTicks))) { _tickQueue.Enqueue(new GMarketDataType(t, GUtils.GetIntTickType(_bid, _ask, e.Price), e.Price, (int)e.Volume)); } } else if (e.MarketDataType == MarketDataType.Ask) { _ask = e.Price; } else if (e.MarketDataType == MarketDataType.Bid) { _bid = e.Price; } }
private void UpdateTimerText() { GameManager gameManager = G.Sys.GameManager_; GameMode gamemode = gameManager.Mode_; if (!gamemode || !timer_) { return; } float time = Mathf.Max(0, (float)gamemode.GetDisplayTime(0)); StringBuilder result = new StringBuilder(); GUtils.GetFormattedTime(result, time, time >= 3600 ? 0 : 2, time > 3600); timer_.text = result.ToString(); }
//Called by logic core after eval actions //Called by pcobj on start public void ReportGridState(int p) { Debug.Log("Reporting Grid states to player '" + p + "'"); CellStruct[][,] state = this.PB.GetPlayerGameState(p, false); CellStruct[] pOwnGrid = GUtils.Serialize(state[0]); CellStruct[] pOtherGrid = GUtils.Serialize(state[1]); List <ActionAvail> aaList = this.PB.GetActionAvailable(p); int[] factionProgress = this.PB.GetFactionProgress(p).GetArray(); Vector2 [] capitolLocs = this.PB.capitolTowerLocs[p].ToArray(); int[] gridSize = new int[] { sizex, sizey }; bool hitSunk = this.PB.hitSunk[p]; // Player's last actions sunk one or more enemy ships ActionReq[] lastActions = this.PB.GetLastActions(p).ToArray(); GameBoardInfo gbi = new GameBoardInfo(pOwnGrid, pOtherGrid, gridSize, aaList.ToArray(), factionProgress, capitolLocs, hitSunk, lastActions); this.mnm.playerSlots[p].RpcUpdatePlayBoard(gbi); }
public void RpcUpdatePlayBoard(GameBoardInfo gbi) { if (!isLocalPlayer || !this.ReadyGuard()) // Ignore info if not local or Start not called yet { return; } Debug.Log("Player: " + this.playerId + " got Playboard update"); //Debug.Log("Ours: " + our.Length.ToString() + " :: Theirs: " + other.Length.ToString()); //Debug.Log("Got AA list: " + gbi.aaArray.Count().ToString()); this.latestCapitolLocs = gbi.capitolTowers.ToList(); UIController.instance.ActionSelectButtonGrpActionAvailUpdate(gbi.aaArray.ToList()); UIController.instance.ActionSelectGroupUpdateActionInfo(gbi.aaArray.ToList()); this.latestPlayerGrid = GUtils.Deserialize(gbi.ourGrid, gbi.gridSize[0], gbi.gridSize[1]); this.latestEnemyGrid = GUtils.Deserialize(gbi.theirGrid, gbi.gridSize[0], gbi.gridSize[1]); UIController.instance.ActionSelectGroupUpdateFactionProgress(new FactionProgress(gbi.factionProgress), this.latestPlayerGrid, this.latestEnemyGrid); if (gbi.hitSunk) { UIController.instance.HitSunkDisplayFlash(); } this.pb.UpdateBoardFancy(gbi.lastArs.ToList(), this.latestPlayerGrid, this.latestEnemyGrid); }
//Get list of actions that can be used based on the current game state List <pAction> CheckCostsMet(CellStruct[][,] gState) { Dictionary <Faction, int> curProg = new Dictionary <Faction, int>(); // Current progress based on this game state foreach (Faction f in factionBldgMap.Keys) { int count = GUtils.Serialize(gState[0]).Count(cell => cell.bldg == factionBldgMap[f] && !cell.destroyed && !cell.defected); count += GUtils.Serialize(gState[1]).Count(cell => cell.bldg == factionBldgMap[f] && !cell.destroyed && cell.defected); curProg.Add(f, count); } this.factionProgress.UpdateProgress(curProg); List <pAction> retList = new List <pAction>(); foreach (pAction action in actionParams.Keys) { ActionParam apm = actionParams[action]; if (apm.enabled && this.factionProgress.GetProgress(apm.faction) >= apm.factionCost) { retList.Add(action); } } return(retList); }
public GBuildInfo(GUtils Utils) { this.Utils = Utils; Company = "Seditious Games Studio"; Name = "Gods of Deceit"; InternalName = "GOD"; Description = "A first-person shooter game written and developed in C++ and Unreal Engine 4."; CopyrightHolder = "Seditious Games Studio and Mamadou Babaei"; CopyrightNotice = String.Format("(C) {0} {1}. All Rights Reserved.", DateTime.Now.Year.ToString(), CopyrightHolder); VersionMajor = 0; VersionMinor = 0; VersionPatch = 1; Branch = GetBranch(); ShortRevisionHash = GetShortRevisionHash(); Version = String.Format("{0}.{1}.{2}", VersionMajor, VersionMinor, VersionPatch); if (!string.IsNullOrEmpty(Branch) && !string.IsNullOrEmpty(ShortRevisionHash)) { Revision = String.Format("{0}-{1}", Branch, ShortRevisionHash); } else if (!string.IsNullOrEmpty(Branch)) { Revision = Branch; } else if (!string.IsNullOrEmpty(ShortRevisionHash)) { Revision = ShortRevisionHash; } else { Revision = String.Empty; } BuildHost = System.Net.Dns.GetHostName(); }
/// <summary> /// Read command from Json file /// </summary> /// <returns></returns> public T ReadCmdParaObj <T>() { ReadRestfulJson(); T paraDict = GConfig.LoadJson2Obj <T>(GConfig.GetCTXFilePath()); Print(String.Format("ele.Key={0}, ele.Value.ToString()={1}", paraDict, paraDict.GetType().Name)); GUtils.DisplayProperties <T>(paraDict, IndicatorProxy); // foreach(DateCtx ele in paraDict.MktCtxDaily) { // Print(String.Format("DateCtx.ele.Key={0}, ele.Value.ToString()={1}", ele.Date, ele.TimeCtxs)); // if(ele != null && ele.Date != null && ele.TimeCtxs != null) { // Print(String.Format("DateCtx.ele.Key={0}, ele.Value.ToString()={1}", ele.Date, ele.TimeCtxs)); // foreach(TimeCtx tctx in ele.TimeCtxs) { // Print(String.Format("ele.Date={0}, TimeCtx.tctx.Time={1}, tctx.ChannelType={2}, tctx.MinUp={3}, tctx.Support={4}", // ele.Date, tctx.Time, tctx.ChannelType, tctx.MinUp, tctx.Support)); // } // } // } // foreach(KeyValuePair<string, List<TimeCTX>> ele in paraDict.cmdMarketContext.ctx_daily.ctx) { // //paraMap.Add(ele.Key, ele.Value.ToString()); // Print(String.Format("ele.Key={0}, ele.Value.ToString()=", ele.Key)); // } return(paraDict); }
public GEngineModules(GUtils Utils) { this.Utils = Utils; }
public GDefinitions(GUtils Utils) { this.Utils = Utils; }
public GBuildPlatform(GUtils Utils) { this.Utils = Utils; }
public GBuildConfiguration(GUtils Utils) { this.Utils = Utils; }
public GPath(GUtils Utils) { bool bX64 = Utils.BuildPlatform.IsX64(); bool bX86 = Utils.BuildPlatform.IsX86(); bool bDebugBuild = Utils.BuildPlatform.IsDebugBuild(); bool bLinuxBuild = Utils.BuildPlatform.IsLinuxBuild(); bool bWindowsBuild = Utils.BuildPlatform.IsWindowsBuild(); ModulePath = Utils.Module.ModuleDirectory; ProjectPath = Directory.GetParent(ModulePath).ToString(); GitDirectoryPath = Path.GetFullPath(Path.Combine(ProjectPath, "..", ".git")); PluginsPath = Path.GetFullPath(Path.Combine(ModulePath, "..", "..", "Plugins")); ThirdPartyPath = Path.GetFullPath(Path.Combine(ModulePath, "..", "..", "ThirdParty")); ThirdPartyIncludePath = Path.GetFullPath(Path.Combine(ThirdPartyPath, "include")); LinuxThirdPartyDebugLibraryPath = Path.GetFullPath(Path.Combine(ThirdPartyPath, "lib", "linux", "debug")); LinuxThirdPartyReleaseLibraryPath = Path.GetFullPath(Path.Combine(ThirdPartyPath, "lib", "linux", "release")); Win32ThirdPartyDebugLibraryPath = Path.GetFullPath(Path.Combine(ThirdPartyPath, "lib", "win32", "debug")); Win32ThirdPartyReleaseLibraryPath = Path.GetFullPath(Path.Combine(ThirdPartyPath, "lib", "win32", "release")); Win64ThirdPartyDebugLibraryPath = Path.GetFullPath(Path.Combine(ThirdPartyPath, "lib", "win64", "debug")); Win64ThirdPartyReleaseLibraryPath = Path.GetFullPath(Path.Combine(ThirdPartyPath, "lib", "win64", "release")); if (bLinuxBuild) { if (bDebugBuild) { ThirdPartyLibraryLinkPath = LinuxThirdPartyDebugLibraryPath; } else { ThirdPartyLibraryLinkPath = LinuxThirdPartyReleaseLibraryPath; } } else if (bWindowsBuild) { if (bX64) { if (bDebugBuild) { ThirdPartyLibraryLinkPath = Win64ThirdPartyDebugLibraryPath; } else { ThirdPartyLibraryLinkPath = Win64ThirdPartyReleaseLibraryPath; } } else if (bX86) { if (bDebugBuild) { ThirdPartyLibraryLinkPath = Win32ThirdPartyDebugLibraryPath; } else { ThirdPartyLibraryLinkPath = Win32ThirdPartyReleaseLibraryPath; } } else { ThirdPartyLibraryLinkPath = string.Empty; } } else { ThirdPartyLibraryLinkPath = string.Empty; } }
public string LevelInfo() { GameManager game_manager = G.Sys.GameManager_; string level_path = game_manager.LevelPath_; LevelInfo level_info = G.Sys.LevelSets_.GetLevelInfo(level_path); ProfileProgress progress = G.Sys.ProfileManager_.CurrentProfile_.Progress_; GameMode mode = G.Sys.GameManager_.Mode_; string out_result = ""; int best = progress.GetTopResultWithRelativePath(level_info.relativePath_, mode.GameModeID_); string personal_best = Language.GetLine("levelinfo.personalbest.none"); if (best != -1) { if (mode.ResultsDisplayType_ == ResultsDisplayType.Time) { personal_best = GUtils.GetFormattedMS(best); } else { personal_best = $"{GUtils.GetFormattedPoints(best)} eV"; } } string out_personal_best = string.Format(Language.GetLine("levelinfo.personalbest"), personal_best); bool supports_medals = level_info.SupportsMedals(mode.GameModeID_); MedalStatus medal_status = MedalStatus.None; string medal = Language.GetLine($"medal.none"); if (mode.SupportsMedals_ && supports_medals && level_path != null) { medal_status = progress.GetMedalStatusWithRelativePath(level_info.relativePath_, mode.GameModeID_); medal = Language.GetLine($"medal.{medal_status.ToString().DOWN().Replace("_", "")}"); } string out_medal_earned = string.Format(Language.GetLine("levelinfo.medalearned"), medal); string out_difficulty = string.Format(Language.GetLine("levelinfo.difficulty"), Language.GetLine($"difficulty.{level_info.difficulty_.ToString().DOWN()}")); out_result = $"{out_personal_best}\n{out_medal_earned}\n{out_difficulty}"; if (level_info.levelType_ == LevelType.Workshop) { string rating, vote; rating = vote = ""; if (SteamworksManager.IsSteamBuild_ && G.Sys.SteamworksManager_.UGC_.TryGetWorkshopLevelData(level_info.relativePath_, out WorkshopLevelInfo level_data)) { rating = SteamworksUGC.GetWorkshopRatingText(level_data); vote = Language.GetLine("levelinfo.workshop.vote.none"); switch (level_data.workshopVote_) { case EWorkshopVote.k_EWorkshopVoteFor: vote = Language.GetLine("levelinfo.workshop.vote.for"); break; case EWorkshopVote.k_EWorkshopVoteAgainst: vote = Language.GetLine("levelinfo.workshop.vote.against"); break; } } else { rating = Language.GetLine("levelinfo.workshop.rating.unknown"); vote = Language.GetLine("levelinfo.workshop.vote.unknown"); } string out_rating = string.Format(Language.GetLine("levelinfo.workshop.rating"), rating); string out_vote = string.Format(Language.GetLine("levelinfo.workshop.vote"), vote); out_result = $"{out_result}\n{out_rating}\n{out_vote}"; } return(out_result); }
private void setServerName(string name) { G.Sys.NetworkingManager_.serverTitle_ = name; updateMaster(); MessageUtilities.sendMessage("The server is renamed to " + GUtils.TruncateWithEllipsis(name, 23)); }
public GGameModules(GUtils Utils) { this.Utils = Utils; }
public GLog(GUtils Utils) { this.Utils = Utils; }
public GPlugins(GUtils Utils) { this.Utils = Utils; }
public GThirdParty(GUtils Utils) { this.Utils = Utils; }
public override bool Run(ref UILabel instance) { switch (instance.gameObject.name.UP()) { case "UILABEL - ADDED": switch (CustomMusicState.state) { case CustomMusicState.ScanState.Started: case CustomMusicState.ScanState.Complete: instance.text = string.Format(Language.GetLine("settings.audio.custommusic.status.count"), CustomMusicState.fileCount, GUtils.GetFormattedPoints(CustomMusicState.fileCount)); break; case CustomMusicState.ScanState.Running: instance.text = string.Format(Language.GetLine("settings.audio.custommusic.status.scanning"), CustomMusicState.scanningFolder); break; } break; case "UILABEL - SEARCHING": instance.text = Language.GetLine("settings.audio.custommusic.status.searching"); break; } return(true); }