public void SetSidebar(string mode) { SidebarCommand sidebar = new SidebarCommand { mode = (ui_sidebar_mode)Enum.Parse(typeof(ui_sidebar_mode), mode) }; DFConnection.Instance.EnqueueSidebarSet(sidebar); }
public void CancelButton() { diggingTool.digMode = DiggingTool.DigMode.None; SidebarCommand sidebar = new SidebarCommand { action = MenuAction.MenuCancel }; DFConnection.Instance.EnqueueSidebarSet(sidebar); }
public void EnqueueSidebarSet(SidebarCommand sidebar) { if (setSideMenuCall == null) { return; } if (!netSidebarSets.Full) { netSidebarSets.Enqueue(sidebar); } }
public void BuildButton(string index) { SidebarCommand sidebar = new SidebarCommand { mode = ui_sidebar_mode.Build, menu_index = int.Parse(index), action = MenuAction.MenuSelect }; DFConnection.Instance.EnqueueSidebarSet(sidebar); }
private void DrawBuildLocation(BuildSelector prevBuildSelector) { if (!(prevBuildSelector.stage == BuildSelectorStage.StagePlace || prevBuildSelector.stage == BuildSelectorStage.StageItemSelect)) { return; } var mouseCenter = GetMouseCenterDF(); if (prevBuildSelector.stage == BuildSelectorStage.StageItemSelect) { mouseCenter = prevBuildSelector.cursor; } for (int y = mouseCenter.y - prevBuildSelector.radius_y_low; y <= mouseCenter.y + prevBuildSelector.radius_y_high; y++) { for (int x = mouseCenter.x - prevBuildSelector.radius_x_low; x <= mouseCenter.x + prevBuildSelector.radius_x_high; x++) { int x_local = x + prevBuildSelector.radius_x_low - mouseCenter.x; int y_local = y + prevBuildSelector.radius_y_low - mouseCenter.y; int tile = prevBuildSelector.tiles[x_local + (y_local * (prevBuildSelector.radius_x_low + prevBuildSelector.radius_x_high + 1))]; var drawCenter = GameMap.DFtoUnityCoord(x, y, mouseCenter.z); switch (tile) { case 0: if (prevBuildSelector.errors.Count == 0) { Graphics.DrawMesh(previewLow, Matrix4x4.TRS(drawCenter, Quaternion.identity, Vector3.one), previewLight, 0); } else { Graphics.DrawMesh(previewLow, Matrix4x4.TRS(drawCenter, Quaternion.identity, Vector3.one), previewPurpleLight, 0); } break; case 1: if (prevBuildSelector.errors.Count == 0) { Graphics.DrawMesh(previewHigh, Matrix4x4.TRS(drawCenter, Quaternion.identity, Vector3.one), previewDark, 0); } else { Graphics.DrawMesh(previewHigh, Matrix4x4.TRS(drawCenter, Quaternion.identity, Vector3.one), previewPurpleDark, 0); } break; case 6: //Blocked case 7: //Hidden case 14: //Too close to edge default: Graphics.DrawMesh(previewHigh, Matrix4x4.TRS(drawCenter, Quaternion.identity, Vector3.one), previewRed, 0); break; } } } if (EventSystem.current.IsPointerOverGameObject()) { return; } SidebarCommand sidebarCommand = new SidebarCommand { selection_coord = mouseCenter }; if (Input.GetMouseButtonDown(0) && prevBuildSelector.stage == BuildSelectorStage.StagePlace) { sidebarCommand.action = MenuAction.MenuSelect; } DFConnection.Instance.EnqueueSidebarSet(sidebarCommand); }