private void ColorWindow(int id) { blockColor = ProceduralBlocks.ProceduralBlocksMod.ColorField(blockColor); if (GUILayout.Button("Close")) { module = null; } GUI.DragWindow(); }
private void Update() { if (Input.GetMouseButtonDown(1)) { win = new Rect(Input.mousePosition.x, Screen.height - Input.mousePosition.y - 200f, 200f, 200f); try { module = Singleton.Manager <ManPointer> .inst.targetVisible.block.GetComponent <ModuleColor>(); r = (byte)(module.Color.r * 255); g = (byte)(module.Color.g * 255); b = (byte)(module.Color.b * 255); } catch (Exception e) { //Console.WriteLine(e); module = null; } visible = module; } }
private void DoWindow(int id) { GUILayout.Label("Red : " + r); r = (byte)GUILayout.HorizontalSlider(r, 0f, 255f); //float.TryParse(GUILayout.TextField(x.ToString()),out x); GUILayout.Label("Green : " + g); g = (byte)GUILayout.HorizontalSlider(g, 0f, 255f); //float.TryParse(GUILayout.TextField(y.ToString()), out y); GUILayout.Label("Blue : " + b); b = (byte)GUILayout.HorizontalSlider(b, 0f, 255f); //float.TryParse(GUILayout.TextField(z.ToString()), out z); //GUILayout.Label(block.cachedLocalRotation.ToString()); if (GUILayout.Button("Close")) { visible = false; module = null; } GUI.DragWindow(); }
private void Update() { if (Input.GetKeyDown(ProceduralBlocks.ProceduralBlocksMod.colorToolsKeycode)) { toolsVisible = !toolsVisible; useGUILayout = toolsVisible; } if (!toolsVisible) { selectingColor = false; } if (Input.GetMouseButtonDown(0) || Input.GetKey(key)) { try { var block = Singleton.Manager <ManPointer> .inst.targetVisible.block; IntVector3 blockPosition = block.cachedLocalPosition; var mod = block.GetComponent <ModuleColor>(); if (selectingColor) { color = mod.Color; selectingColor = false; } else if (toolsVisible) { if (axis[selection] == "X") { IntVector3 start = blockPosition - new IntVector3(0, radius - 2, radius - 2); IntVector3 end = blockPosition + new IntVector3(0, radius - 1, radius - 1); for (int y = start.y; y < end.y; y++) { for (int z = start.z; z < end.z; z++) { var current = block.tank.blockman.GetBlockAtPosition(new IntVector3(blockPosition.x, y, z)); var modc = current?.GetComponent <ModuleColor>(); if (modc) { modc.Color = color; } } } } else if (axis[selection] == "Y") { IntVector3 start = blockPosition - new IntVector3(radius - 2, 0, radius - 2); IntVector3 end = blockPosition + new IntVector3(radius - 1, 0, radius - 1); for (int x = start.x; x < end.x; x++) { for (int z = start.z; z < end.z; z++) { var current = block.tank.blockman.GetBlockAtPosition(new IntVector3(x, blockPosition.y, z)); var modc = current?.GetComponent <ModuleColor>(); if (modc) { modc.Color = color; } } } } else if (axis[selection] == "Z") { IntVector3 start = blockPosition - new IntVector3(radius - 2, radius - 2, 0); IntVector3 end = blockPosition + new IntVector3(radius - 1, radius - 1, 0); for (int x = start.x; x < end.x; x++) { for (int y = start.y; y < end.y; y++) { var current = block.tank.blockman.GetBlockAtPosition(new IntVector3(x, y, blockPosition.z)); var modc = current?.GetComponent <ModuleColor>(); if (modc) { modc.Color = color; } } } } } } catch (Exception e) { } } if (!Singleton.Manager <ManPointer> .inst.DraggingItem) { if (Input.GetMouseButtonDown(1)) { win = new Rect(Input.mousePosition.x - 200f, Screen.height - Input.mousePosition.y - 200f, 200f, 200f); try { module = Singleton.Manager <ManPointer> .inst.targetVisible.block.GetComponent <ModuleColor>(); blockColor = module.Color; } catch (Exception e) { //Console.WriteLine(e); module = null; } } } }