/// <summary> /// Create a new instance of this device /// </summary> /// <param name="dfbSimulatorWrapper"></param> public CodeStoreModel(Wrapper dfbSimulatorWrapper) { string[] programLines = dfbSimulatorWrapper.Parameters.Code.Replace("\n", "").Split(new char[] { '\r' }, StringSplitOptions.None); programLineList = programLines.ToList(); var states = (Dictionary <int, DFB_v1_40.Asm.CyState>)PrivateValueAccessor.GetPrivateFieldValue(typeof(CyDfbAsm), "m_stateTable", Wrapper.DfbAsm); stateTable = states.OrderBy(x => x.Value.Line).Select(x => x.Value).ToList(); instructionList = new List <CyControlWord>(); var compactor = (CyDFBOptimizer)Wrapper.GetCyDfbAsmPrivateFieldCurr("m_compactor"); if (compactor != null) { instructionAList = Wrapper.DfbAsm.CommandsA.OrderBy(x => x.Line).ToList(); instructionBList = Wrapper.DfbAsm.CommandsB.OrderBy(x => x.Line).ToList(); instructionList.AddRange(Wrapper.DfbAsm.CommandsA); instructionList.AddRange(Wrapper.DfbAsm.CommandsB); } else { instructionAList = Wrapper.DfbAsm.Commands.OrderBy(x => x.Line).ToList(); instructionBList = Wrapper.DfbAsm.Commands.OrderBy(x => x.Line).ToList(); instructionList.AddRange(Wrapper.DfbAsm.Commands); } instructionList = instructionList.OrderBy(x => x.Line).ToList(); }
private static void OnGameFinish(Result <ExitStatus, TimeSpan, GClass_GameFinish> result) { GInterface22 backend = ClientAppUtils.GetBackendSession(); MainApplication mainApplication = MainAppUtils.GetMainApp(); if (backend?.Profile == null || mainApplication == null) { _gameCallBack(result); return; } ESideType?eSideType = PrivateValueAccessor.GetPrivateFieldValue(mainApplication.GetType(), "esideType_0", mainApplication) as ESideType?; Profile profile = backend.Profile; bool isPlayerScav = false; if (eSideType != null && eSideType.GetValueOrDefault() == ESideType.Savage) { profile = backend.ProfileOfPet; isPlayerScav = true; } try { CreatePlayerOwnerMonitor.Catched = false; ProfileSaveUtil.SaveProfileProgress(profile, result.Value0, backend.GetPhpSessionId(), isPlayerScav); } catch (Exception e) { Debug.LogError(e); } _gameCallBack(result); }
private static void OnGameFinish(Result <ExitStatus, TimeSpan, GameFinish> result) { MainApplication mainApplication = ClientAppUtils.GetMainApp(); ISession session = ClientAppUtils.GetBackendSession(); string backendUrl = ClientConfig.Config.BackendUrl; if (session?.Profile == null || mainApplication == null) { _gameCallBack(result); return; } ESideType?eSideType = PrivateValueAccessor.GetPrivateFieldValue(mainApplication.GetType(), "esideType_0", mainApplication) as ESideType?; Profile profile = session.Profile; bool isPlayerScav = false; if (eSideType != null && eSideType.GetValueOrDefault() == ESideType.Savage) { profile = session.ProfileOfPet; isPlayerScav = true; } try { SaveLootUtil.SaveProfileProgress(backendUrl, session.GetPhpSessionId(), result.Value0, profile, isPlayerScav); } catch (Exception e) { Debug.LogError(e); } _gameCallBack(result); }
static bool PatchPrefix(ref bool __result, object __instance) { EPlayerSide playerSide = (EPlayerSide)PrivateValueAccessor.GetPrivateFieldValue(__instance.GetType(), "side", __instance); if (playerSide == EPlayerSide.Savage) { __result = true; return(false); } return(true); }
static bool PatchPrefix(object __instance) { object weaponController = PrivateValueAccessor.GetPrivateFieldValue(PatcherConstants.FirearmControllerType, PatcherConstants.WeaponControllerFieldName, __instance); return((weaponController.GetType().GetField("RemoveFromChamberResult").GetValue(weaponController) == null) ? false : true); }
private static MenuController GetMenuController() { return(PrivateValueAccessor.GetPrivateFieldValue(typeof(MainApplication), kMainControllerFieldName, ClientAppUtils.GetMainApp()) as MenuController); }