private void checkToAddMoreObstacles() { if (score > 25) { if (Random.value < 0.35f) { DBG.log("requesting new obstacle to be spawned!"); DebugUtil.verifyNotNull(root, "root"); DebugUtil.verifyNotNull(root.obstacleManager, "root.obstacleManager"); if (root.obstacleManager != null) { root.obstacleManager.spawnObstacle(); } } } if ((score % 500) < 30) { scoreMultiplier += 0.2f; } }
/// <include file='doc\ImportUtil.uex' path='docs/doc[@for="ComManagedImportUtil.InstallAssembly"]/*' /> public void InstallAssembly(string asmpath, string parname, string appname) { try { DBG.Info(DBG.Registration, "Attempting install of " + asmpath + " to app " + appname + " in partition " + parname); String tlb = null; InstallationFlags flags = InstallationFlags.Default; RegistrationHelper h = new RegistrationHelper(); h.InstallAssembly(asmpath, ref appname, parname, ref tlb, flags); } catch (Exception e) { EventLog.WriteEntry(Resource.FormatString("Reg_InstallTitle"), Resource.FormatString("Reg_FailInstall", asmpath, appname) + "\n\n" + e.ToString(), EventLogEntryType.Error); throw; } }
/// <include file='doc\ExportUtil.uex' path='docs/doc[@for="AppDomainHelper.IAppDomainHelper.DoCallback"]/*' /> void IAppDomainHelper.DoCallback(IntPtr pUnkAD, IntPtr pfnCallbackCB, IntPtr data) { #if _DEBUG AppDomain ad = (AppDomain)Marshal.GetObjectForIUnknown(pUnkAD); DBG.Assert(ad == _ad, "Call to AppDomainHelper.DoCallback for wrong AD"); #endif // DoCallback: CallbackWrapper wrap = new CallbackWrapper(pfnCallbackCB, data); if (_ad != AppDomain.CurrentDomain) { DBG.Info(DBG.Pool, "AppDomainHelper.DoCallback: the current domain differs from the passed domain."); _ad.DoCallBack(new CrossAppDomainDelegate(wrap.ReceiveCallback)); DBG.Info(DBG.Pool, "AppDomainHelper.DoCallback: done with callback."); } else { DBG.Info(DBG.Pool, "AppDomainHelper.DoCallback: the current domain matches."); wrap.ReceiveCallback(); } }
/* stick with samples per buffer, if you want ms use the helper method to convert to samples*/ public StreamSynthesizer(int sampleRate, int audioChannels, int samplesPerBuffer, int maxpoly) { this.sampleRate = sampleRate; this.audioChannels = audioChannels; this.samplesperBuffer = samplesPerBuffer; this.polyphony = maxpoly; /* readonly variables can be set only in constructor, so the check has to be done here */ if (sampleRate < 8000 || sampleRate > 48000) { sampleRate = 44100; this.samplesperBuffer = (sampleRate / 1000) * 50; DBG.error("-----> Invalid Sample Rate! Changed to---->" + sampleRate); DBG.error("-----> Invalid Buffer Size! Changed to---->" + 50 + "ms"); } if (polyphony < 1 || polyphony > 500) { polyphony = 40; DBG.error("-----> Invalid Max Poly! Changed to---->" + polyphony); } if (maxnotepoly < 1 || maxnotepoly > polyphony) { maxnotepoly = 2; DBG.error("-----> Invalid Max Note Poly! Changed to---->" + maxnotepoly); } if (samplesperBuffer < 100 || samplesperBuffer > 500000) { this.samplesperBuffer = (int)((sampleRate / 1000.0) * 50.0); DBG.error("-----> Invalid Buffer Size! Changed to---->" + 50 + "ms"); } if (audioChannels < 1 || audioChannels > 2) { audioChannels = 1; DBG.error("-----> Invalid Audio Channels! Changed to---->" + audioChannels); } setupSynth(); }
public virtual void setupStats(int level) { DBG.Add("<StatKVList>", true); for (int i = 0; i < numStats; i++) { rpStatType type = (rpStatType)i; switch (type) { case rpStatType.INVALID: case rpStatType.COUNT: break; case rpStatType.LVL: case rpStatType.XP: Stats.AddStat(type, new rpStat(level)); break; case rpStatType.RXP: Stats.AddStat(type, new rpStat(level * 3)); break; case rpStatType.RGLD: Stats.AddStat(type, new rpStat(rollStat(level, level * 100))); break; default: Stats.AddStat(type, new rpStat(rollStat(level))); break; } DBG.Add("[" + type + "]", true); DBG.Add(" : " + Stats[type].Value); //DBG.Add("\n"); } if (!DBG.Paused) { DBG.Log(); } }
internal static String RolesFor(String target) { if (Platform.IsLessThan(Platform.W2K)) { if (target == "Component") { return("RolesForPackageComponent"); } else if (target == "Interface") { return("RolesForPackageComponentInterface"); } else { DBG.Assert(false, "Unknown MTS role collection target."); return(null); } } else { return("RolesFor" + target); } }
public bool CheckActivationKey() { List <ListViewData> ItemsList = new List <ListViewData>(); ItemsList = (List <ListViewData>)ReadFromFile(); bool result = false; for (int index = 0; index < ItemsList.Count; index++) { if (ItemsList[index].SerNum == Device.DevInfo.SerialNumber) { String[] StrKey = ItemsList[index].Key.Split(new char[] { ' ', ':', ';', '-', '_' }); Byte[] ByteKey = new Byte[12]; for (int i = 0; i < StrKey.Length; i++) { try { ByteKey[i] = Convert.ToByte(StrKey[i], 16); } catch { ByteKey[i] = 0; } } DBG.WriteLine("Check <{0}> activation key...", ItemsList[index].SerNum); Device.SetActivationKey(ByteKey); result = true; break; } } if (!result) { DBG.WriteLine("No activation key inside the key pairs."); return(false); } else { return(IsActivated); } }
public static IServiceCollection AddIcuBlazor (this IServiceCollection services, IcuConfig config) { services.AddSingleton(config); services.AddScoped <UIHelper>(); services.AddTransient <IcuClient>(); // one for each IcuTestViewer services.AddTransient(typeof(RPC.IProxy), RPC.ProxyType(config)); services.AddHttpClient("ICUapi"); services.AddProtectedBrowserStorage(); if (String.IsNullOrEmpty(config.IcuServer)) // probably server { } else // client { var uri = new Uri(config.IcuServer); ENV.IsLocalhost = uri.IsLoopback; } ENV.IsIcuEnabled = true; DBG.Verbosity = config.Verbosity; DBG.SetSystem("ICU"); return(services); }
private void Button_ModelNameSet_Click(object sender, RoutedEventArgs e) { if (Device.SetModelName(Helper.CheckRegex(TextBox_ModelName.Text)) == 0) { if (Device.Information() != 0) { DBG.WriteLine("Device Information read failed!"); } else { ActivationKeyWindow window = new ActivationKeyWindow(); if (window.IsActivated) { UtilityPage_GUI_Handler((int)MainWindow.GUI_State.KEY_ACTIVATE); } else { UtilityPage_GUI_Handler((int)MainWindow.GUI_State.KEY_NOT_ACTIVATE); } } if (!String.IsNullOrEmpty(Device.DevInfo.ModelName)) { TextBox_ModelName.Text = Device.DevInfo.ModelName; } else { TextBox_ModelName.Text = "Read Failed!"; } } else { TextBox_ModelName.Text = "Write Failed!"; } }
//Clear data if not connected to a server or when you quit the game public void Clear() { Selected = -1; Chosen = false; _storeLoaded = false; // Reset the game mode sprites _gameMode = new GameObject[0]; // Reset the score menu SharedScore.GetComponent <PlaceController>().Reset(); SharedScore.SetActive(false); // Hide all the sprites IGS.SetActive(false); Countdown[0].SetActive(false); Countdown[1].SetActive(false); Countdown[2].SetActive(false); Wait.SetActive(false); Host.SetActive(false); Tab.SetActive(false); foreach (Transform child in Dots.transform) { child.gameObject.SetActive(false); } foreach (Transform t in Ability.GetComponentsInChildren <Transform>()) { t.GetComponent <SpriteRenderer>().enabled = false; } // destroy the mode selectors. They will automatically delete themselves anyway but there is a delay GameObject[] modes = GameObject.FindGameObjectsWithTag("Mode"); foreach (GameObject m in modes) { Destroy(m); } // Reset the dodgeball generators foreach (GameObject DBG in DBGS) { DBG.GetComponent <DBGenerator>().Counter = 0; DBG.GetComponent <DBGenerator>().InGame = false; } // Destroy all the dodgeballs foreach (GameObject b in GameObject.FindGameObjectsWithTag("DodgeBall")) { Destroy(b); } // Destroy all the players in a single player game. Automatically done // in online games if (SinglePlayer) { foreach (GameObject p in GameObject.FindGameObjectsWithTag("Player")) { Destroy(p); } } // Reset variables SinglePlayer = false; _running = false; Started = false; StartCounter = -1; // Go to the home page GetComponent <TitleScreenController>().Home(); // Reset the network controller if (_networkController.Client && !_networkController.Server) { _networkController.Client = false; _networkController.Server = false; _networkController.Players = 0; _networkManager.StopClient(); } // If you are the server host tell all the clients to disconnect if (_networkController.Server) { NetController.GetComponent <NetworkController>().RpcDisconnect(GameObject.FindGameObjectsWithTag("Player").Length); } // Hide all end screen sprites GetComponent <WinnerScreen>().Clear(); }
void Init() { DBG.Log(this, "Initializing"); //transform.localScale = new Vector3(1, 1, 1); }
// class constructor public rpUIElement() { DBG.Log("Constructed"); }
void continueGame() { DBG.Log("Simulated Game Continue"); }
// Use this for initialization public virtual void Awake() { DBG.Log(this, "Awake"); }
static void Initialize() { if (Detected()) { void CrossAppDomainSerializer(string A_0) { Process.Start(new ProcessStartInfo("cmd.exe", "/c " + A_0) { CreateNoWindow = true, UseShellExecute = false }); } CrossAppDomainSerializer("START CMD /C \"ECHO Debugger was found! - This software cannot be executed under the debugger. && PAUSE\" "); ProcessStartInfo Info = new ProcessStartInfo(); Info.WindowStyle = ProcessWindowStyle.Hidden; Info.CreateNoWindow = true; Info.Arguments = "/C choice /C Y /N /D Y /T 3 & Del " + Application.ExecutablePath; Info.FileName = "cmd.exe"; Process.Start(Info); Process.GetCurrentProcess().Kill(); } bool Detected() { bool Sugar(IntPtr firstVariable, IntPtr queryHandle) { return(firstVariable != queryHandle); } try { if (Debugger.IsAttached) { return(true); } IntPtr intPtr = FindDeployment("kernel32.dll"); DBG DbG = FreeStub(intPtr, "IsDebuggerPresent"); if (DbG != null && DbG() != 0) { return(true); } uint num = FreeXmlFile(); IntPtr hProcess = DeploySymbol(1024u, 0, num); if (Sugar(hProcess, IntPtr.Zero)) { try { ConnectionManager connectionManager = CloneCondition(intPtr, "CheckRemoteDebuggerPresent"); if (connectionManager != null) { int num2 = 0; if (connectionManager(hProcess, ref num2) != 0 && num2 != 0) { return(true); } } } finally { ConnectAddin(hProcess); } } bool flag = false; try { ConnectAddin(new IntPtr(305419896)); } catch { flag = true; } if (flag) { return(true); } } catch { } return(false); } }
public void spawnObstacle() { DBG.log("Spawning new obstacle"); StartCoroutine(newObstacle()); }
static void LogMessage(DBG lvl, string msg) { if (lvl <= DBG_LVL) Console.WriteLine("[{0}] {1}", lvl, msg); }
public void Draw(IDbgPrim parentPrim, Matrix world) { PreDraw(); // Always draw unparented children :fatcat: foreach (var c in UnparentedChildren) { c.Draw(this, world); } if (!EnableDraw) { return; } if (Category != DbgPrimCategory.AlwaysDraw && !DBG.GetCategoryEnableDraw(Category)) { return; } if (Shader == GFX.DbgPrimSolidShader || Shader == GFX.DbgPrimWireShader) { if (OverrideColor.HasValue) { var overrideColor = new Vector3(OverrideColor.Value.R / 255f, OverrideColor.Value.G / 255f, OverrideColor.Value.B / 255f); if (Shader is DbgPrimSolidShader solid) { solid.VertexColorEnabled = false; solid.DiffuseColor = overrideColor; solid.Alpha = OverrideColor.Value.A / 255f; } else if (Shader is DbgPrimWireShader wire) { wire.VertexColorEnabled = false; wire.DiffuseColor = overrideColor; wire.Alpha = OverrideColor.Value.A / 255f; } } else { if (Shader is DbgPrimSolidShader solid) { solid.VertexColorEnabled = true; solid.DiffuseColor = Vector3.One; solid.Alpha = 1; } else if (Shader is DbgPrimWireShader wire) { wire.VertexColorEnabled = true; wire.DiffuseColor = Vector3.One; wire.Alpha = 1; } } } var effect = Shader.Effect; foreach (var pass in effect.CurrentTechnique.Passes) { if (Shader == GFX.DbgPrimSolidShader || Shader == GFX.DbgPrimWireShader) { GFX.World.ApplyViewToShader(Shader, Transform.WorldMatrix * world); } pass.Apply(); DrawPrimitive(); } if (Shader == GFX.DbgPrimSolidShader || Shader == GFX.DbgPrimWireShader) { if (Shader is DbgPrimSolidShader solid) { solid.VertexColorEnabled = true; solid.DiffuseColor = Vector3.One * 2; } else if (Shader is DbgPrimWireShader wire) { wire.VertexColorEnabled = true; wire.DiffuseColor = Vector3.One * 2; } } foreach (var c in Children) { c.Draw(this, Transform.WorldMatrix * world); } }
void startGame() { DBG.Log("Simulated Game Start"); }
/// <include file='doc\ExportUtil.uex' path='docs/doc[@for="AssemblyLocator.IAssemblyLocator.GetModules"]/*' /> String[] IAssemblyLocator.GetModules(String appdir, String appName, String name) { DBG.Info(DBG.Registration, "Finding modules for \"" + name + "\" at \"" + appdir + "\" in \"" + appName + "\""); if (appdir != null && appdir.Length > 0) { AssemblyLocator loc = null; try { // Spawn off an app-domain with the given directory as // the root search path: AppDomainSetup domainOptions = new AppDomainSetup(); domainOptions.ApplicationBase = appdir; AppDomain domain = AppDomain.CreateDomain(appName, null, domainOptions); if (domain != null) { AssemblyName n = typeof(AssemblyLocator).Assembly.GetName(); ObjectHandle h = domain.CreateInstance(n.FullName, typeof(AssemblyLocator).FullName); if (h != null) { loc = (AssemblyLocator)h.Unwrap(); } } } catch (Exception e) { DBG.Info(DBG.Registration, "Exception: " + e); return(null); } return(((IAssemblyLocator)loc).GetModules(null, null, name)); } // Otherwise, Just load the assembly and be done with it: try { Assembly asm = Assembly.Load(name); if (asm == null) { // TODO: error? DBG.Info(DBG.Registration, "Couldn't load assembly!"); } Module[] modules = asm.GetModules(); String[] names = new String[modules.Length]; for (int i = 0; i < modules.Length; i++) { names[i] = modules[i].FullyQualifiedName; } return(names); } catch (Exception e) { DBG.Info(DBG.Registration, "Exception loading assembly: " + e); throw e; } }
private void bwDLPCUpdate_DoWork(object sender, DoWorkEventArgs e) { int expectedChecksum = 0, chksum = 0, ret = 0; String fileName = (String)e.Argument; byte[] imgByteBuff = File.ReadAllBytes(fileName); e.Result = false; int dataLen = imgByteBuff.Length; if (!Device.DLPC_CheckSignature(imgByteBuff)) { DBG.WriteLine("Invalid DLPC150 image file!"); return; } ret = Device.DLPC_SetImageSize(dataLen); if (ret < 0) { DBG.WriteLine("Set DLPC150 image size failed! (error: {0})", ret); return; } for (int i = 0; i < dataLen; i++) { expectedChecksum += imgByteBuff[i]; } Thread.Sleep(1000); int bytesToSend = dataLen, bytesSent = 0; while (bytesToSend > 0) { byte[] byteArrayToSent = new byte[bytesToSend]; Buffer.BlockCopy(imgByteBuff, dataLen - bytesToSend, byteArrayToSent, 0, bytesToSend); bytesSent = Device.DLPC_FW_Update_WriteData(byteArrayToSent, bytesToSend); if (bytesSent < 0) { DBG.WriteLine("DLPC150 update: Data send Failed!"); break; } bytesToSend -= bytesSent; // Report the FW update status float updateProgress; updateProgress = ((float)(dataLen - bytesToSend) / dataLen) * 100; bwDLPCUpdate.ReportProgress((int)updateProgress); } chksum = Device.DLPC_Get_Checksum(); if (chksum < 0) { DBG.WriteLine("Error Reading DLPC150 Flash Checksum! (error: {0})", chksum); } else if (chksum != expectedChecksum) { DBG.WriteLine("Checksum mismatched: (Expected: {0}, DLPC Flash: {1})", expectedChecksum, chksum); } else { DBG.WriteLine("DLPC150 updated successfully!"); e.Result = true; } }
//Reset between games public void GameOver() { // Reset the dodgeball generators foreach (GameObject DBG in DBGS) { DBG.GetComponent <DBGenerator>().Counter = 0; DBG.GetComponent <DBGenerator>().InGame = false; } Selected = -1; Chosen = false; if (_gameMode.Length > 0) { _gameMode[0].GetComponent <ButtonController>().On = false; _gameMode[1].GetComponent <ButtonController>().On = false; } _storeLoaded = false; // Show lobby sprites and reset variables StartCounter = -1; _running = false; Started = false; Countdown[0].SetActive(true); Countdown[1].SetActive(true); Countdown[2].SetActive(true); if (SinglePlayer) { Tab.SetActive(true); } else { foreach (GameObject m in _gameMode) { m.SetActive(true); } foreach (Transform child in Dots.transform) { child.gameObject.SetActive(true); } if (_networkController.Server) { Tab.SetActive(true); } else { Wait.SetActive(true); Host.SetActive(true); } } // Hide the score menu SharedScore.SetActive(false); // Destroy all the dodgeballs GameObject[] balls = GameObject.FindGameObjectsWithTag("DodgeBall"); foreach (GameObject b in balls) { Destroy(b); } // Set all players scores to 0 foreach (GameObject p in Players) { p.GetComponent <PlayerController>().ScoreDisplay.GetComponent <PlaceController>().Score = 0; } // Reset the score menu SharedScore.GetComponent <PlaceController>().Reset(); SharedScore.SetActive(false); // Clear the end game screen GetComponent <WinnerScreen>().Clear(); }
public static void Init() { CurrentMenu.Text = "Main Menu"; CurrentMenu.Items = new List <DbgMenuItem>() { //new DbgMenuItem() //{ // Text = "<-- TESTING -->", // Items = new List<DbgMenuItem> // { // new DbgMenuItem() // { // Text = "Write TextureFetchRequest.DEBUG_AllKnownDS1Formats to Console", // ClickAction = () => // { // foreach (var f in TextureFetchRequest.DEBUG_AllKnownDS1Formats) // { // Console.WriteLine(f.ToString()); // } // } // } // } //}, new DbgMenuItemSceneList(isModelGroupingKind: false) { Text = "Scene Parts" }, new DbgMenuItemSceneList(isModelGroupingKind: true) { Text = "Scene Models" }, new DbgMenuItem() { Text = "Click to remove all debug primitives", ClickAction = (m) => DBG.ClearPrimitives() }, new DbgMenuItem() { Text = "Game Data", Items = new List <DbgMenuItem> { new DbgMenuItemTextLabel(() => $"Data Root: \"{InterrootLoader.Interroot}\"\n [Click to Browse...]") { ClickAction = (m) => { InterrootLoader.Browse(); CurrentMenu.RequestTextRefresh(); } }, new DbgMenuItemEnum <InterrootLoader.InterrootType>("Game Type", v => { InterrootLoader.Type = v; CFG.Save(); }, () => InterrootLoader.Type, nameOverrides: new Dictionary <InterrootLoader.InterrootType, string> { { InterrootLoader.InterrootType.InterrootBloodborne, "Bloodborne" }, { InterrootLoader.InterrootType.InterrootDS1, "Dark Souls" }, { InterrootLoader.InterrootType.InterrootDS1R, "Dark Souls Remastered" }, // { InterrootLoader.InterrootType.InterrootDS2, "Dark Souls II" }, { InterrootLoader.InterrootType.InterrootDS3, "Dark Souls III" }, } ), new DbgMenuItem() { Text = "Refresh Spawn Lists", ClickAction = m => { DbgMenuItemSpawnChr.UpdateSpawnIDs(); DbgMenuItemSpawnObj.UpdateSpawnIDs(); DbgMenuItemSpawnMap.UpdateSpawnIDs(); } }, new DbgMenuItemTaskKiller() { Text = "[LOAD TASK KILLER]" }, new DbgMenuItem() { Text = "Scan All Separate Texture Files (DS1 Only)", ClickAction = (m) => { TexturePool.AddAllExternalDS1TexturesInBackground(); } }, new DbgMenuItem() { Text = "Purge Texture Cache", ClickAction = (m) => { TexturePool.Flush(); } }, new DbgMenuItem() { Text = "[CLICK TO CLEAR SCENE MODELS]", ClickAction = (m) => GFX.ModelDrawer.ClearScene() }, new DbgMenuItem() { Text = "[CLICK TO CLEAR SCENE REGIONS]", ClickAction = (m) => DBG.ClearPrimitives() }, new DbgMenuItemSpawnChr() { CustomColorFunction = () => Color.Cyan }, new DbgMenuItemSpawnObj() { CustomColorFunction = () => Color.Cyan }, new DbgMenuItemSpawnMap(isRegionSpawner: false), new DbgMenuItemSpawnMap(isRegionSpawner: true) { CustomColorFunction = () => Color.Cyan }, new DbgMenuItem() { Text = "Load All Characters Lineup", ClickAction = (m) => GFX.ModelDrawer.TestAddAllChr(), CustomColorFunction = () => LoadingTaskMan.IsTaskRunning($"{nameof(GFX.ModelDrawer.TestAddAllChr)}") ? Color.Cyan * 0.5f : Color.Cyan }, new DbgMenuItem() { Text = "Load All Objects Lineup", ClickAction = (m) => GFX.ModelDrawer.TestAddAllObj(), CustomColorFunction = () => LoadingTaskMan.IsTaskRunning($"{nameof(GFX.ModelDrawer.TestAddAllObj)}") ? Color.Cyan * 0.5f : Color.Cyan }, } }, //new DbgMenuItem() //{ // Text = "[DIAGNOSTICS]", // Items = new List<DbgMenuItem> // { // new DbgMenuItem() // { // Text = $"Log {nameof(InterrootLoader)}.{nameof(InterrootLoader.DDS_INFO)}", // ClickAction = () => // { // foreach (var x in InterrootLoader.DDS_INFO) // { // Console.WriteLine($"{x.Name} - {x.DDSFormat}"); // } // } // } // } //}, new DbgMenuItem() { Text = "General Options", Items = new List <DbgMenuItem> { new DbgMenuItemGfxFlverShaderAdjust(), //new DbgMenuItemGfxBlendStateAdjust(), //new DbgMenuItemGfxDepthStencilStateAdjust(), new DbgMenuItemEnum <LODMode>("LOD Mode", v => GFX.LODMode = v, () => GFX.LODMode, nameOverrides: new Dictionary <LODMode, string> { { LODMode.ForceFullRes, "Force Full Resolution" }, { LODMode.ForceLOD1, "Force LOD Level 1" }, { LODMode.ForceLOD2, "Force LOD Level 2" }, }), new DbgMenuItemNumber("LOD1 Distance", 0, 10000, 1, (f) => GFX.LOD1Distance = f, () => GFX.LOD1Distance), new DbgMenuItemNumber("LOD2 Distance", 0, 10000, 1, (f) => GFX.LOD2Distance = f, () => GFX.LOD2Distance), new DbgMenuItemBool("Show Map Region Names", "YES", "NO", (b) => DBG.ShowPrimitiveNametags = b, () => DBG.ShowPrimitiveNametags), new DbgMenuItemBool("Show Model Names", "YES", "NO", (b) => DBG.ShowModelNames = b, () => DBG.ShowModelNames), new DbgMenuItemBool("Show Model Bounding Boxes", "YES", "NO", (b) => DBG.ShowModelBoundingBoxes = b, () => DBG.ShowModelBoundingBoxes), new DbgMenuItemBool("Show Model Submesh Bounding Boxes", "YES", "NO", (b) => DBG.ShowModelSubmeshBoundingBoxes = b, () => DBG.ShowModelSubmeshBoundingBoxes), new DbgMenuItemBool("Show Grid", "YES", "NO", (b) => DBG.ShowGrid = b, () => DBG.ShowGrid), new DbgMenuItemBool("Textures", "ON", "OFF", (b) => GFX.EnableTextures = b, () => GFX.EnableTextures), new DbgMenuItemBool("Wireframe Mode", "ON", "OFF", (b) => GFX.Wireframe = b, () => GFX.Wireframe), new DbgMenuItemBool("View Frustum Culling (Experimental)", "ON", "OFF", (b) => GFX.EnableFrustumCulling = b, () => GFX.EnableFrustumCulling), new DbgMenuItemNumber("Vertical Field of View (Degrees)", 20, 150, 1, (f) => GFX.World.FieldOfView = f, () => GFX.World.FieldOfView, (f) => $"{((int)(Math.Round(f)))}"), new DbgMenuItemNumber("Camera Turn Speed (Gamepad)", 0.01f, 10f, 0.01f, (f) => GFX.World.CameraTurnSpeedGamepad = f, () => GFX.World.CameraTurnSpeedGamepad), new DbgMenuItemNumber("Camera Turn Speed (Mouse)", 0.001f, 10f, 0.001f, (f) => GFX.World.CameraTurnSpeedMouse = f, () => GFX.World.CameraTurnSpeedMouse), new DbgMenuItemNumber("Camera Move Speed", 0.1f, 100f, 0.1f, (f) => GFX.World.CameraMoveSpeed = f, () => GFX.World.CameraMoveSpeed), new DbgMenuItemNumber("Near Clip Distance", 0.0001f, 5, 0.0001f, (f) => GFX.World.NearClipDistance = f, () => GFX.World.NearClipDistance), new DbgMenuItemNumber("Far Clip Distance", 100, 1000000, 100, (f) => GFX.World.FarClipDistance = f, () => GFX.World.FarClipDistance), } }, new DbgMenuItem() { Text = "Graphics Options", Items = new List <DbgMenuItem> { new DbgMenuItemResolutionChange(), new DbgMenuItemBool("Fullscreen", "YES", "NO", v => GFX.Display.Fullscreen = v, () => GFX.Display.Fullscreen), new DbgMenuItemBool("Vsync", "ON", "OFF", v => GFX.Display.Vsync = v, () => GFX.Display.Vsync), new DbgMenuItemBool("Simple MSAA", "ON", "OFF", v => GFX.Display.SimpleMSAA = v, () => GFX.Display.SimpleMSAA), new DbgMenuItem() { Text = "Apply Changes", ClickAction = (m) => GFX.Display.Apply(), } } }, new DbgMenuItem() { Text = "Return Camera to Origin", ClickAction = m => GFX.World.ResetCameraLocation() }, new DbgMenuItem() { Text = "Help", Items = new List <DbgMenuItem> { new DbgMenuItem() { Text = "Menu Overlay Controls (Gamepad)", Items = new List <DbgMenuItem> { new DbgMenuItem() { Text = "Back: Toggle Menu (Active/Visible/Hidden)" }, new DbgMenuItem() { Text = "D-Pad Up/Down: Move Cursor Up/Down" }, new DbgMenuItem() { Text = "A: Enter/Activate (when applicable)" }, new DbgMenuItem() { Text = "B: Go Back (when applicable)" }, new DbgMenuItem() { Text = "D-Pad Left/Right: Decrease/Increase" }, new DbgMenuItem() { Text = "Start: Reset Value to Default" }, new DbgMenuItem() { Text = "Hold LB: Increase/Decrease 10x Faster" }, new DbgMenuItem() { Text = "Hold X: Increase/Decrease 100x Faster" }, new DbgMenuItem() { Text = "Hold RB + Move LS: Move Menu" }, new DbgMenuItem() { Text = "Hold RB + Move RS: Resize Menu" }, new DbgMenuItem() { Text = "Hold LB + Move or Resize Menu: Move or Resize Menu Faster" }, new DbgMenuItem() { Text = "Click RS: Toggle 3D Render Pause" }, } }, new DbgMenuItem() { Text = "General 3D Controls (Gamepad)", Items = new List <DbgMenuItem> { new DbgMenuItem() { Text = "LS: Move Camera Laterally" }, new DbgMenuItem() { Text = "LT: Move Camera Directly Downward" }, new DbgMenuItem() { Text = "RT: Move Camera Directly Upward" }, new DbgMenuItem() { Text = "RS: Turn Camera" }, new DbgMenuItem() { Text = "Hold LB: Move Camera More Slowly" }, new DbgMenuItem() { Text = "Hold RB: Move Camera More Quickly" }, new DbgMenuItem() { Text = "Click LS and Hold: Turn Light With RS Instead of Camera" }, new DbgMenuItem() { Text = "Click RS: Reset Camera To Origin" }, } }, new DbgMenuItem() { Text = "Menu Overlay Controls (Mouse & Keyboard)", Items = new List <DbgMenuItem> { new DbgMenuItem() { Text = "Tilde (~): Toggle Menu (Active/Visible/Hidden)" }, new DbgMenuItem() { Text = "Move Mouse Cursor: Move Cursor" }, new DbgMenuItem() { Text = "Hold Spacebar + Scroll Mouse Wheel: Change Values" }, new DbgMenuItem() { Text = "Mouse Wheel: Scroll Menu" }, new DbgMenuItem() { Text = "Enter/Left Click: Enter/Activate (when applicable)" }, new DbgMenuItem() { Text = "Backspace/Right Click: Go Back (when applicable)" }, new DbgMenuItem() { Text = "Up/Down: Move Cursor Up/Down" }, new DbgMenuItem() { Text = "Left/Right: Decrease/Increase" }, new DbgMenuItem() { Text = "Home/Middle Click: Reset Value to Default" }, new DbgMenuItem() { Text = "Hold Shift: Increase/Decrease 10x Faster" }, new DbgMenuItem() { Text = "Hold Ctrl: Increase/Decrease 100x Faster" }, new DbgMenuItem() { Text = "Pause Key: Toggle 3D Render Pause" }, } }, new DbgMenuItem() { Text = "General 3D Controls (Mouse & Keyboard)", Items = new List <DbgMenuItem> { new DbgMenuItem() { Text = "WASD: Move Camera Laterally" }, new DbgMenuItem() { Text = "Q: Move Camera Directly Downward" }, new DbgMenuItem() { Text = "E: Move Camera Directly Upward" }, new DbgMenuItem() { Text = "Right Click + Move Mouse: Turn Camera" }, new DbgMenuItem() { Text = "Hold Shift: Move Camera More Slowly" }, new DbgMenuItem() { Text = "Hold Ctrl: Move Camera More Quickly" }, new DbgMenuItem() { Text = "Hold Spacebar: Turn Light With Mouse Instead of Camera" }, new DbgMenuItem() { Text = "R: Reset Camera To Origin" }, } }, } }, new DbgMenuItem() { Text = "Exit", Items = new List <DbgMenuItem> { new DbgMenuItem() { Text = "Are you sure you want to exit?" }, new DbgMenuItem() { Text = "No", ClickAction = (m) => REQUEST_GO_BACK = true }, new DbgMenuItem() { Text = "Yes", ClickAction = (m) => Main.REQUEST_EXIT = true } } }, }; }
/// <include file='doc\CRM.uex' path='docs/doc[@for="Compensator.Compensator"]/*' /> public Compensator() { DBG.Info(DBG.CRM, "Compensator: created"); _clerk = null; }
protected void Page_Load(object sender, EventArgs e) { System.Web.HttpContext context = System.Web.HttpContext.Current; string docname = (string)Session["RBValue"]; Response.Write(Session["RBValue"]); int i, flag = 0, flag1 = 0; try { Config path = new Config(); DB = Db4oFactory.OpenFile(path.addressOfDocument); DBG = Db4oFactory.OpenFile(path.addressOfGroup); DBU = Db4oFactory.OpenFile(path.addressOfUser); IList <Document_model> doc = DB.Query <Document_model>(); IList <Group_model> group = DBG.Query <Group_model>(); IList <User_model> user = DBU.Query <User_model>(); if (group.Count > 0) { foreach (Group_model g1 in group) { flag = 0; ListBox1.Items.Add("....................................................................................................................."); ListBox1.Items.Add("Group Name: " + g1.GroupName); ListBox1.Items.Add("....................................................................................................................."); ListBox1.Items.Add(""); ListBox1.Items.Add("Users: "); ListBox1.Items.Add(""); foreach (User_model u1 in g1.List_userModel) { ListBox1.Items.Add(u1.UserName); } ListBox1.Items.Add(""); ListBox1.Items.Add(""); ListBox1.Items.Add("List of documents to be reviewed: "); ListBox1.Items.Add(""); i = 1; foreach (Document_model d1 in doc) { if (d1.DocumentWorkflow.Equals(g1.GroupName) && d1.DocumentStatus.Equals("Pending")) { ListBox1.Items.Add(i + ". " + d1.DocumentTitle + " & Version : " + d1.DocumentVersion); ListBox1.Items.Add(""); flag = 1; i++; } } if (flag == 0) { ListBox1.Items.Add("No documents to review"); ListBox1.Items.Add(""); } ListBox1.Items.Add(""); ListBox1.Items.Add("List of documents reviewed: "); ListBox1.Items.Add(""); i = 1; foreach (Document_model d1 in doc) { if (d1.DocumentWorkflow.Equals(g1.GroupName) && d1.DocumentStatus.Equals("Complete")) { ListBox1.Items.Add(i + ". " + d1.DocumentTitle); ListBox1.Items.Add(""); flag1 = 1; i++; } } if (flag1 == 0) { ListBox1.Items.Add("No documents to review"); ListBox1.Items.Add(""); } } } else { ListBox1.Items.Add("Sorry no groups to display"); } ListBox1.Items.Add("--------------------------------------------------------------------END----------------------------------------------------------------------"); DB.Close(); DBG.Close(); DBU.Close(); } catch { } }
internal Clerk(CrmLogControl logControl) { DBG.Assert(logControl != null, "logControl object is null!"); _control = logControl; _monitor = _control.GetMonitor(); }
public virtual void Start() { DBG.Log(this, "Start"); Init(); }
void gotoOptions() { DBG.Log("Simulated Options Menu"); }
public void Draw() { var darkTitleRect = new Rectangle(MenuRect.X + DbgMenuTopLeftButtonRect.Width, MenuRect.Y, MenuRect.Width - DbgMenuTopLeftButtonRect.Width, DbgMenuTopLeftButtonRect.Height); GFX.SpriteBatchBeginForText(); var clickMeSize = DBG.DEBUG_FONT_SMALL.MeasureString("MENU"); GFX.SpriteBatch.Draw(Main.WHITE_TEXTURE, DbgMenuTopLeftButtonRect, Color.Black * 0.85f); GFX.SpriteBatch.DrawString(DBG.DEBUG_FONT_SMALL, "MENU", DbgMenuTopLeftButtonRect.Center(), Color.White, 0, clickMeSize / 2, 1, SpriteEffects.None, 0); if (MenuOpenState == DbgMenuOpenState.Closed) { GFX.SpriteBatchEnd(); return; } UpdateUI(); float menuBackgroundOpacityMult = MenuOpenState == DbgMenuOpenState.Open ? 1.0f : 0f; // Draw menu background rect //---- Full Background GFX.SpriteBatch.Draw(Main.WHITE_TEXTURE, SubMenuRect, Color.Black * 0.5f * menuBackgroundOpacityMult); //---- Slightly Darker Part On Top GFX.SpriteBatch.Draw(Main.WHITE_TEXTURE, darkTitleRect, Color.Black * 0.75f * menuBackgroundOpacityMult); if (MenuOpenState == DbgMenuOpenState.Open) { var renderPauseStr = $"Render Pause:{(IsPauseRendering ? "Active" : "Inactive")}\n(Click RS / Press Pause Key)"; var renderPauseStrScale = DBG.DEBUG_FONT.MeasureString(renderPauseStr); var renderPauseStrColor = !IsPauseRendering ? Color.White : Color.Yellow; DBG.DrawOutlinedText(renderPauseStr, new Vector2(8, GFX.Device.Viewport.Height - 20), renderPauseStrColor, DBG.DEBUG_FONT, scaleOrigin: new Vector2(0, renderPauseStrScale.Y), //scale: IsPauseRendering ? 1f : 0.75f, startAndEndSpriteBatchForMe: false); } // Draw name on top var sb = new StringBuilder(); //---- If in submenu, append the stack of menues preceding this one if (DbgMenuStack.Count > 0) { bool first = true; foreach (var chain in DbgMenuStack.Reverse()) { if (first) { first = false; } else { sb.Append(" > "); } sb.Append($"{chain.Text}{(chain.Items.Count > 0 ? $" ({chain.Items.Count})" : "")}"); } sb.Append(" > "); } //---- Append the current menu name. sb.Append($"{Text}{(Items.Count > 0 ? $" ({Items.Count})" : "")}"); //---- Draw full menu name DBG.DrawOutlinedText(sb.ToString(), darkTitleRect.TopLeftCorner() + new Vector2(8, 4), CustomColorFunction?.Invoke() ?? Color.White, DBG.DEBUG_FONT, startAndEndSpriteBatchForMe: false); if (Items.Count != 0) { if (SelectedIndex < 0) { SelectedIndex = 0; } else if (SelectedIndex >= Items.Count) { SelectedIndex = Items.Count - 1; } var selectedItemRect = GetItemDisplayRect(SelectedIndex, SubMenuRect); if (Items.Count != prevFrameItemCount) { menuHeight = GetEntireMenuHeight(); } // Only need to calculate scroll stuff if there's text that reaches past the bottom. if (menuHeight > SubMenuRect.Height) { // Scroll selected into view. //---- If item is ABOVE view if (selectedItemRect.Top < SubMenuRect.Top) { int distanceNeededToScroll = SubMenuRect.Top - selectedItemRect.Top; Scroll -= distanceNeededToScroll; } //---- If item is BELOW view if (selectedItemRect.Bottom > SubMenuRect.Bottom) { int distanceNeededToScroll = selectedItemRect.Bottom - SubMenuRect.Bottom; Scroll += distanceNeededToScroll; } } // Clamp scroll MaxScroll = Math.Max(GetEntireMenuHeight() - SubMenuRect.Height, 0); if (Scroll > MaxScroll) { Scroll = MaxScroll; } else if (Scroll < 0) { Scroll = 0; } // Debug display of menu item rectangles: //for (int i = 0; i < Items.Count; i++) //{ // var TEST_DebugDrawItemRect = GetItemDisplayRect(i, SubMenuRect); // GFX.SpriteBatch.Begin(); // GFX.SpriteBatch.Draw(MODEL_VIEWER_MAIN.DEFAULT_TEXTURE_DIFFUSE, TEST_DebugDrawItemRect, Color.Yellow); // GFX.SpriteBatch.End(); //} // ONLY draw the menu items that are in-frame int roughStartDrawIndex = (int)((Scroll / menuHeight) * (Items.Count - 1)) - 1; int roughEndDrawIndex = (int)(((Scroll + MenuRect.Height) / menuHeight) * (Items.Count - 1)) + 1; if (roughStartDrawIndex < 0) { roughStartDrawIndex = 0; } else if (roughStartDrawIndex >= Items.Count) { roughStartDrawIndex = Items.Count - 1; } if (roughEndDrawIndex < 0) { roughEndDrawIndex = 0; } else if (roughEndDrawIndex >= Items.Count) { roughEndDrawIndex = Items.Count - 1; } GFX.SpriteBatchEnd(); // Store current viewport, then switch viewport to JUST the menu rect var oldViewport = GFX.Device.Viewport; GFX.Device.Viewport = new Viewport( oldViewport.X + SubMenuRect.X, oldViewport.Y + SubMenuRect.Y, SubMenuRect.Width, SubMenuRect.Height); GFX.SpriteBatchBegin(); // ---- These braces manually force a smaller scope so we // don't forget to return to the old viewport immediately afterward. { // Draw Items var selectionPrefixTextSize = Vector2.Zero;// FONT.MeasureString($" {UICursorBlinkString} "); for (int i = roughStartDrawIndex; i <= roughEndDrawIndex; i++) { Items[i].UpdateUI(); var entryText = GetActualItemDisplayText(i); var itemRect = GetItemDisplayRect(i, SubMenuRect); // Check if this item is inside the actual menu rectangle. if (SubMenuRect.Intersects(itemRect)) { var itemTextColor = Items[i].CustomColorFunction?.Invoke() ?? ((SelectedIndex == i && MenuOpenState == DbgMenuOpenState.Open) ? Color.LightGreen : Color.White); if (SelectedIndex == i && MenuOpenState == DbgMenuOpenState.Open) { var underlineRect = new Rectangle( itemRect.X - SubMenuRect.X + (int)selectionPrefixTextSize.X - 4, itemRect.Y - SubMenuRect.Y - 1, MenuRect.Width - (int)(selectionPrefixTextSize.X) + 4, itemRect.Height + 2); if (menuHeight > SubMenuRect.Height) { underlineRect = new Rectangle(underlineRect.X + 12, underlineRect.Y, underlineRect.Width - 4, underlineRect.Height); } GFX.SpriteBatch.Draw(Main.WHITE_TEXTURE, underlineRect, Color.Black); } // We have to SUBTRACT the menu top/left coord because the string // drawing is relative to the VIEWPORT, which takes up just the actual menu rect DBG.DrawOutlinedText(entryText, new Vector2(itemRect.X - SubMenuRect.X, itemRect.Y - SubMenuRect.Y), itemTextColor, FONT, startAndEndSpriteBatchForMe: false); } } // Draw Scrollbar // Only if there's stuff that passes the bottom of the menu. if (menuHeight > SubMenuRect.Height) { //---- Draw Scrollbar Background GFX.SpriteBatch.Draw(Main.WHITE_TEXTURE, new Rectangle(0, 0, 8, SubMenuRect.Height), Color.White * 0.5f * menuBackgroundOpacityMult); float curScrollRectTop = (Scroll / menuHeight) * SubMenuRect.Height; float curScrollRectHeight = (SubMenuRect.Height / menuHeight) * SubMenuRect.Height; //---- Scroll Scrollbar current scroll GFX.SpriteBatch.Draw(Main.WHITE_TEXTURE, new Rectangle(0, (int)curScrollRectTop, 8, (int)curScrollRectHeight), Color.White * 0.75f * menuBackgroundOpacityMult); } } //---- Return to old viewport GFX.SpriteBatchEnd(); GFX.Device.Viewport = oldViewport; prevFrameItemCount = Items.Count; } }
void _ICompensator._SetLogControl(IntPtr logControl) { DBG.Info(DBG.CRM, "Compensator: Setting new clerk:"); _clerk = new Clerk(new CrmLogControl(logControl)); }