//Coroutine ErrorMessageRoutine; //void Clicked(string BtnName) //{ // //foreach (var item in myCanvasMain.GetComponentsInChildren<RectTransform>()) // //{ // // switch (item.gameObject.name) // // { // // case "myScrollViewContent": // // foreach (Transform child in item.transform) // // { // // Destroy(child.gameObject); // // } // // break; // // default: // // break; // // } // //} // //return; // //foreach (ItemProto itemProto in LDB.items.dataArray) // //{ // // if (itemProto.ID == 2210) // // { // // itemProto.StackSize = 123; // // StorageComponent.itemStackCount[2210] = 123; // // } // //} // // SORT // foreach (var factoryItem in GameMain.data.factories) // { // try // { // foreach (StorageComponent item in factoryItem.factoryStorage.storagePool) // { // try // { // item.Sort(true); // Debug.LogError("SORTING"); // } // catch (Exception) // { // continue; // } // } // } // catch (Exception) // { // continue; // } // } // Debug.LogError("SORTING PLAYER INVERNTORY"); // GameMain.mainPlayer.package.Sort(true); // //UIRoot.instance.uiGame.inventory.OnSort(); // //SORT END // //foreach (StorageComponent item in GameMain.mainPlayer.factory.factoryStorage.storagePool) // //{ // // try // // { // // item.Sort(true); // // Debug.LogError("SORTING"); // // } // // catch (Exception) // // { // // //nothing // // } // //} // Debug.LogWarning($"Button \"{BtnName}\" pressed!"); // bool success = Int32.TryParse(myInputField.text, out int result); // ItemProto selectedItem = null; // if (success) // { // selectedItem = LDB.items.Select(result); // } // if (success && selectedItem != null) // { // //myHeaderText.enabled = false; // //if (ErrorMessageRoutine != null) // //{ // // StopCoroutine(ErrorMessageRoutine); // //} // //thumb.sprite = selectedItem._iconSprite; // } // else // { // ErrorMessageRoutine = StartCoroutine(ShowError(2f)); // } //} //IEnumerator ShowError(float delay) //{ // if (ErrorMessageRoutine != null) // { // StopCoroutine(ErrorMessageRoutine); // } // myHeaderText.enabled = true; // yield return new WaitForSeconds(delay); // myHeaderText.enabled = false; // ErrorMessageRoutine = null; //} private void Update() { bool keyDown = Input.GetKeyDown(KeyConfig.Value); //if (keyDown && GameMain.mainPlayer.factory != null && GameMain.mainPlayer.factory.factoryStorage != null && GameMain.mainPlayer.factory.factoryStorage.storagePool != null) if (keyDown && gameLoaded && GameMain.mainPlayer != null && (GameMain.mainPlayer.factory != null || (GameMain.data.mainPlayer.mecha != null && GameMain.data.mainPlayer.mecha.droneCount != 34))) { //Debug.LogError(GameMain.data.mainPlayer.mecha.droneCount); //Debug.LogWarning($"mainplayer is null? {(GameMain.mainPlayer.mecha == null)}"); UIGame uiGame = UIRoot.instance.uiGame; if (VFInput.inFullscreenGUI && !myCanvas.activeSelf) { return; } //if (!myCanvas.activeSelf) //{ // thumb.sprite = LDB.items.Select(2104)._iconSprite; //} myCanvas.SetActive(!myCanvas.activeSelf); VFInput.UpdateGameStates(); } else if (Input.GetKeyDown(KeyCode.Escape) && myCanvas.activeSelf) { myCanvas.SetActive(false); //VFInput.UpdateGameStates(); } }
public override void EscLogic() { YHDebug.LogFormat("bp create esc logic {0}", controller.cmd.mode); bool num = !VFInput._godModeMechaMove; bool flag = VFInput.rtsCancel.onDown || VFInput.escKey.onDown || VFInput.escape || VFInput._buildModeKey.onDown; bool flag2 = !VFInput.onGUI && VFInput.inScreen; if (num && flag && flag2) { VFInput.UseBuildKey(); VFInput.UseEscape(); VFInput.UseRtsCancel(); TrarckPlugin.Instance.isBPCreate = false; _Close(); } }
public override void EscLogic() { bool outsideGUI = !VFInput.onGUI && VFInput.inScreen && !VFInput.inputing; bool escape = VFInput.escKey.onDown || VFInput.escape; bool rtsCancel = !VFInput._godModeMechaMove && VFInput.rtsCancel.onDown && outsideGUI; bool exit = rtsCancel || escape; if (exit) { player.SetHandItems(0, 0); _Close(); actionBuild.Close(); } if (escape) { VFInput.UseEscape(); } if (rtsCancel) { VFInput.UseMouseRight(); } }
void CloseUI() { myCanvas.SetActive(false); VFInput.UpdateGameStates(); }
public void Operating() { if (waitingForPlayerInput) { return; } if (!isSelecting && VFInput.blueprintCopyOperate0.onDown && cursorValid) { isSelecting = true; startGroundPosSnapped = castGroundPosSnapped; lastGroundPosSnapped = startGroundPosSnapped; InitSelectGratBox(); VFInput.UseMouseLeft(); } bool point = (castGroundPosSnapped - startGroundPosSnapped).sqrMagnitude > 0.01f; bool onDown = VFInput.blueprintCopyOperate0.onDown || VFInput.blueprintCopyOperate1.onDown; if (isSelecting && (onDown && cursorValid || VFInput.blueprintCopyOperate0.onUp && castObjectId != 0 && !point)) { CheckDismantle(); if (waitingForPlayerInput) { return; } ResetBuildPreviews(); isSelecting = false; VFInput.UseMouseLeft(); VFInput.UseEnterConfirm(); } else if (isSelecting && VFInput.rtsCancel.onUp) { isSelecting = false; startGroundPosSnapped = castGroundPosSnapped; lastGroundPosSnapped = startGroundPosSnapped; ClearSelection(); ResetBuildPreviews(); } if (isSelecting) { DetermineSelectGratBox(); if (lastSelectGratBox != selectGratBox) { DetermineAddSelection(); lastSelectGratBox = selectGratBox; } } else { startGroundPosSnapped = castGroundPosSnapped; ReDeterminePreviews(); } if (point) { ReDeterminePreviews(); } }