plantilla base para movimiento básico
This commit is contained in:
Robii Aragon
2026-02-05 05:07:55 -08:00
parent 195b696771
commit 779f2c8b20
14443 changed files with 23840465 additions and 452 deletions

View File

@@ -0,0 +1,229 @@
using System.Collections;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityEngine.Events;
using GKC.Localization;
public class GKCLoadingScreenSystem : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public int currentSceneIndexToLoad;
public bool activateLoadOnStart;
public string sceneToLoadAsyncPrefsName = "SceneToLoadAsync";
public float loadScreenProgressLerpSpeed = 10;
public bool useFakeLoadProgress;
public float fakeLoadSpeed;
[Space]
public string clickAnywhereMessage = "Click anywhere to start.";
public string loadingMessage = "Loading... ";
[Space]
[Header ("Other Settings")]
[Space]
public bool activateChangeOfSceneOnAnyKeyPressDownEnabled = true;
public bool ignoreKeyPressedActive;
public bool ignoreMousePressed;
public bool useCircleImageLoad = true;
public bool useSliderLoad = true;
public bool useTextLoad = true;
public bool useTextPercentageLoad = true;
[Space]
[Header ("Debug")]
[Space]
public bool sceneLoaded;
public bool showDebugPrint = true;
[Space]
[Header ("Events Settings")]
[Space]
public bool useEventOnLoadComplete;
public UnityEvent eventOnLoadComplete;
[Space]
[Header ("Components")]
[Space]
public Image fill;
public Slider mainSlider;
public Text mainLoadingText;
public Text percentegeText;
bool keyPressed = false;
float currentProgressPercentage;
void Start ()
{
bool canActivateLoadResult = false;
if (activateLoadOnStart) {
canActivateLoadResult = true;
} else {
if (PlayerPrefs.HasKey (sceneToLoadAsyncPrefsName)) {
currentSceneIndexToLoad = PlayerPrefs.GetInt (sceneToLoadAsyncPrefsName);
PlayerPrefs.DeleteKey (sceneToLoadAsyncPrefsName);
canActivateLoadResult = true;
}
}
if (currentSceneIndexToLoad > -1) {
if (canActivateLoadResult) {
activateSceneLoad ();
}
}
}
void Update ()
{
if (sceneLoaded) {
if (activateChangeOfSceneOnAnyKeyPressDownEnabled) {
if (!ignoreKeyPressedActive) {
if (Input.anyKeyDown) {
if (ignoreMousePressed) {
if (!Input.GetMouseButton (0) && !Input.GetMouseButton (1) && !Input.GetMouseButton (2)) {
keyPressed = true;
}
} else {
keyPressed = true;
}
}
}
} else {
keyPressed = true;
}
}
}
void activateSceneLoad ()
{
StartCoroutine (LoadAsync (currentSceneIndexToLoad));
}
IEnumerator LoadAsync (int sceneIndex)
{
sceneLoaded = false;
menuPause.setCursorVisibleState (true);
menuPause.setCursorLockState (false);
if (showDebugPrint) {
print ("Scene Index To Load Async " + sceneIndex);
}
AsyncOperation operation = SceneManager.LoadSceneAsync (sceneIndex, LoadSceneMode.Single);
operation.allowSceneActivation = false;
currentProgressPercentage = 0;
float fakeProgress = 0;
bool targetReached = false;
float progressValue = 0;
float progressToShowOnScreen = 0;
if (useTextLoad) {
string currentText = "";
if (gameLanguageSelector.isCheckLanguageActive ()) {
currentText = UIElementsLocalizationManager.GetLocalizedValue (loadingMessage);
} else {
currentText = loadingMessage;
}
mainLoadingText.text = currentText;
}
while (!targetReached) {
float currentProgress = operation.progress;
if (useFakeLoadProgress || currentProgress >= 0.9f) {
fakeProgress += Time.fixedDeltaTime * fakeLoadSpeed;
currentProgress += fakeProgress;
}
progressValue = Mathf.Clamp01 (currentProgress);
currentProgressPercentage = (progressValue * 100f);
progressToShowOnScreen = Mathf.MoveTowards (progressToShowOnScreen, currentProgressPercentage, Time.fixedDeltaTime * loadScreenProgressLerpSpeed);
if (useCircleImageLoad) {
fill.fillAmount = progressToShowOnScreen / 100;
}
if (useTextPercentageLoad) {
percentegeText.text = (int)progressToShowOnScreen + " %";
}
if (useSliderLoad) {
mainSlider.value = progressToShowOnScreen;
}
if (currentProgress >= 0.9f && progressValue >= 1 && progressToShowOnScreen >= 100) {
targetReached = true;
sceneLoaded = true;
}
yield return null;
}
if (useTextLoad) {
string currentText = "";
if (gameLanguageSelector.isCheckLanguageActive ()) {
currentText = UIElementsLocalizationManager.GetLocalizedValue (clickAnywhereMessage);
} else {
currentText = clickAnywhereMessage;
}
mainLoadingText.text = currentText;
}
if (useEventOnLoadComplete) {
eventOnLoadComplete.Invoke ();
}
while (!keyPressed) {
yield return null;
}
operation.allowSceneActivation = true;
}
public void setKeyPressedState (bool state)
{
keyPressed = state;
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 52b9ea3a00164df498f6212b0d4062ec
timeCreated: 1656057147
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Menu/GKCLoadingScreenSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class customActionOpenMenuSystem : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool customActionEnabled = true;
public virtual void openOrCloseMenu (bool state, GameObject currentPlayer)
{
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 57743ad52b94fa5418c6608e283e0b68
timeCreated: 1672295949
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Menu/customActionOpenMenuSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,47 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class customActionOpenMenuWeaponAttachment : customActionOpenMenuSystem
{
public override void openOrCloseMenu (bool state, GameObject currentPlayer)
{
if (!customActionEnabled) {
return;
}
playerComponentsManager currentPlayerComponentsManager = currentPlayer.GetComponent<playerComponentsManager> ();
if (currentPlayerComponentsManager != null) {
playerWeaponsManager currentPlayerWeaponsManager = currentPlayerComponentsManager.getPlayerWeaponsManager ();
usingDevicesSystem currentUsingDevicesSystem = currentPlayerComponentsManager.getUsingDevicesSystem ();
if (currentPlayerWeaponsManager != null) {
if (currentPlayerWeaponsManager.isPlayerCarringWeapon ()) {
if (state) {
currentPlayerWeaponsManager.setOpenWeaponAttachmentsMenuPausedState (true);
currentPlayerWeaponsManager.setIgnoreCheckUsingDevicesOnWeaponAttachmentsActiveState (true);
currentUsingDevicesSystem.setIgnoreIfPlayerMenuActiveState (true);
currentUsingDevicesSystem.setIgnoreIfUsingDeviceActiveState (true);
}
currentPlayerWeaponsManager.editWeaponAttachmentsByCheckingBusyState ();
if (!state) {
currentPlayerWeaponsManager.setOpenWeaponAttachmentsMenuPausedState (false);
currentPlayerWeaponsManager.setIgnoreCheckUsingDevicesOnWeaponAttachmentsActiveState (false);
currentUsingDevicesSystem.setIgnoreIfPlayerMenuActiveState (false);
currentUsingDevicesSystem.setIgnoreIfUsingDeviceActiveState (false);
}
}
}
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: fe65401e587032048a361497f1c805a6
timeCreated: 1672296578
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Menu/customActionOpenMenuWeaponAttachment.cs
uploadId: 814740

View File

@@ -0,0 +1,167 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.SceneManagement;
public class homeMenu : MonoBehaviour
{
[Space]
[Header ("Main Settings")]
[Space]
public bool useInitialUIElementSelected;
public GameObject initialUIElementSelected;
public string mainMenuName = "Main Menu";
[Space]
[Header ("Load Screen Settings")]
[Space]
public bool useLoadScreen;
public int loadScreenScene = 1;
public bool useLastSceneIndexAsLoadScreen = true;
public string sceneToLoadAsyncPrefsName = "SceneToLoadAsync";
public bool checkLoadingScreenSceneConfigured = true;
public string loadingScreenSceneName = "Loading Screen Scene";
[Space]
[Header ("Debug")]
[Space]
public bool subMenuActive;
[Space]
[Header ("Menu Settings")]
[Space]
public List<menuPause.submenuInfo> submenuInfoList = new List<menuPause.submenuInfo> ();
void Start ()
{
if (useInitialUIElementSelected) {
GKC_Utils.setSelectedGameObjectOnUI (false, true, initialUIElementSelected, false);
}
AudioListener.pause = false;
Time.timeScale = 1;
}
void Update ()
{
if (Input.GetKeyDown (KeyCode.Escape)) {
openOrClosePauseMenuByName (mainMenuName, true);
}
}
public void confirmExit ()
{
Application.Quit ();
}
public void loadScene (int sceneNumber)
{
GKC_Utils.loadScene (sceneNumber, useLoadScreen, loadScreenScene, sceneToLoadAsyncPrefsName,
useLastSceneIndexAsLoadScreen, checkLoadingScreenSceneConfigured, loadingScreenSceneName);
}
public void disableMenuList ()
{
for (int i = 0; i < submenuInfoList.Count; i++) {
if (submenuInfoList [i].menuGameObject != null && submenuInfoList [i].menuGameObject.activeSelf != false) {
submenuInfoList [i].menuGameObject.SetActive (false);
}
if (submenuInfoList [i].menuOpened) {
submenuInfoList [i].menuOpened = false;
if (submenuInfoList [i].useEventOnClose) {
if (submenuInfoList [i].eventOnClose.GetPersistentEventCount () > 0) {
submenuInfoList [i].eventOnClose.Invoke ();
}
}
}
}
}
public void openOrClosePauseMenuByName (string menuName, bool state)
{
int pauseMenuIndex = submenuInfoList.FindIndex (s => s.Name.Equals (menuName));
if (pauseMenuIndex > -1) {
if (state) {
for (int i = 0; i < submenuInfoList.Count; i++) {
if (pauseMenuIndex != i) {
if (submenuInfoList [i].menuGameObject != null && submenuInfoList [i].menuGameObject.activeSelf != false) {
submenuInfoList [i].menuGameObject.SetActive (false);
}
if (submenuInfoList [i].menuOpened) {
submenuInfoList [i].menuOpened = false;
if (submenuInfoList [i].useEventOnClose) {
if (submenuInfoList [i].eventOnClose.GetPersistentEventCount () > 0) {
submenuInfoList [i].eventOnClose.Invoke ();
}
}
if (submenuInfoList [i].isSubMenu) {
exitSubMenu ();
}
}
}
}
}
menuPause.submenuInfo currentSubmenuInfo = submenuInfoList [pauseMenuIndex];
if (state) {
currentSubmenuInfo.eventOnOpen.Invoke ();
} else {
currentSubmenuInfo.eventOnClose.Invoke ();
}
if (currentSubmenuInfo.menuGameObject != null && currentSubmenuInfo.menuGameObject.activeSelf != state) {
currentSubmenuInfo.menuGameObject.SetActive (state);
}
currentSubmenuInfo.menuOpened = state;
if (currentSubmenuInfo.isSubMenu) {
if (state) {
enterSubMenu ();
} else {
exitSubMenu ();
}
}
}
}
public void openPauseMenuByName (string menuName)
{
openOrClosePauseMenuByName (menuName, true);
}
public void closePauseMenuByName (string menuName)
{
openOrClosePauseMenuByName (menuName, false);
}
public void enterSubMenu ()
{
subMenuActive = true;
}
public void exitSubMenu ()
{
subMenuActive = false;
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 8614546b0c3a22f4495acbad3f1b687a
timeCreated: 1467306749
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Menu/homeMenu.cs
uploadId: 814740

View File

@@ -0,0 +1,409 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class ingameMenuPanel : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public string menuPanelName;
public bool closeMenuIfGamePaused = true;
public bool playerCanMoveStatePausedOnMenuOpened = true;
[Space]
[Header ("Canvas Settings")]
[Space]
public bool useBlurUIPanel;
public bool setSortOrderOnOpenCloseMenu;
public int sortOrderOnMenuOpened;
public int sortOrderOnMenuClosed;
public Canvas mainCanvas;
[Space]
[Header ("Move Panels")]
[Space]
public bool movePanelsEnabled;
public RectTransform mainPanelToMoveTransform;
[Space]
[Space]
public float screenLimitOffset = 20;
public bool useScreenLimitOffsets;
public float leftScreenLimitOffset;
public float rightScreenLimitOffset;
public float upScreenLimitOffset;
public float downScreenLimitOffset;
[Space]
[Header ("Enable/disable Panel Settings")]
[Space]
public bool enableDisablePanelsEnabled;
public List<menuPanelInfo> menuPanelInfoList = new List<menuPanelInfo> ();
[Space]
[Header ("Debug")]
[Space]
public bool menuPanelOpened;
public bool movingPanelActive;
public Vector2 newPosition;
public Vector2 screenLimit;
[Space]
[Header ("Components")]
[Space]
public GameObject menuPanelObject;
public menuPause pauseManager;
[Space]
[Header ("Events Settings")]
[Space]
public bool activateEventsOnOpenState;
public bool useEventsOnOpenClostMenu;
public UnityEvent eventOnOpenMenu;
public UnityEvent eventOnCloseMenu;
[HideInInspector] public bool touchPlatform;
[HideInInspector] public Touch currentTouch;
bool pauseManagerLocated;
Coroutine updateCoroutine;
Transform previousParent;
RectTransform currentPanelToMove;
Vector2 currentScreenLimitOffset;
bool mainCanvasLocated;
public virtual void closeMenuPanelIfOpened ()
{
if (menuPanelOpened) {
openOrCloseMenuPanel (false);
}
}
public virtual void openOrCloseMenuPanel (bool state)
{
menuPanelOpened = state;
pauseManagerLocated = pauseManager != null;
menuPanelObject.SetActive (menuPanelOpened);
if (pauseManagerLocated) {
pauseManager.openOrClosePlayerMenu (menuPanelOpened, menuPanelObject.transform, useBlurUIPanel);
pauseManager.setIngameMenuOpenedState (menuPanelName, menuPanelOpened, activateEventsOnOpenState);
pauseManager.enableOrDisablePlayerMenu (menuPanelOpened, playerCanMoveStatePausedOnMenuOpened, false);
pauseManager.checkUpdateReticleActiveState (state);
}
if (menuPanelOpened) {
openMenuPanelState ();
} else {
closeMenuPanelState ();
}
checkEventsOnStateChange (menuPanelOpened);
if (!menuPanelOpened) {
if (movingPanelActive) {
disableMovePanel ();
}
}
if (setSortOrderOnOpenCloseMenu) {
if (!mainCanvasLocated) {
mainCanvasLocated = mainCanvas != null;
if (!mainCanvasLocated) {
mainCanvas = GetComponent<Canvas> ();
mainCanvasLocated = mainCanvas != null;
}
}
if (mainCanvasLocated) {
if (menuPanelOpened) {
mainCanvas.sortingOrder = sortOrderOnMenuOpened;
} else {
mainCanvas.sortingOrder = sortOrderOnMenuClosed;
}
}
}
}
public void openOrCloseMenuFromTouch ()
{
openOrCloseMenuPanel (!menuPanelOpened);
pauseManagerLocated = pauseManager != null;
if (pauseManagerLocated) {
pauseManager.setIngameMenuOpenedState (menuPanelName, menuPanelOpened, true);
}
}
public virtual void openOrCloseMenuFromTouchExternally ()
{
}
public virtual void openMenuPanelState ()
{
}
public virtual void closeMenuPanelState ()
{
}
public void setPauseManager (menuPause currentMenuPause)
{
pauseManager = currentMenuPause;
initializeMenuPanel ();
}
public virtual void initializeMenuPanel ()
{
}
public void openNextPlayerOpenMenu ()
{
pauseManagerLocated = pauseManager != null;
if (pauseManagerLocated) {
pauseManager.openNextPlayerOpenMenu ();
}
}
public void openPreviousPlayerOpenMenu ()
{
pauseManagerLocated = pauseManager != null;
if (pauseManagerLocated) {
pauseManager.openPreviousPlayerOpenMenu ();
}
}
public void closePlayerMenuByName (string menuName)
{
pauseManagerLocated = pauseManager != null;
if (pauseManagerLocated) {
pauseManager.closePlayerMenuByName (menuName);
}
}
public void checkEventsOnStateChange (bool state)
{
if (useEventsOnOpenClostMenu) {
if (state) {
eventOnOpenMenu.Invoke ();
} else {
eventOnCloseMenu.Invoke ();
}
}
}
public void stopUpdateCoroutine ()
{
if (updateCoroutine != null) {
StopCoroutine (updateCoroutine);
}
}
IEnumerator updateSystemCoroutine ()
{
var waitTime = new WaitForSecondsRealtime (0.0001f);
while (true) {
updateSystem ();
yield return waitTime;
}
}
void updateSystem ()
{
updatePanelPosition ();
}
void updatePanelPosition ()
{
int touchCount = Input.touchCount;
if (!touchPlatform) {
touchCount++;
}
for (int i = 0; i < touchCount; i++) {
if (!touchPlatform) {
currentTouch = touchJoystick.convertMouseIntoFinger ();
} else {
currentTouch = Input.GetTouch (i);
}
newPosition = new Vector2 (currentTouch.position.x, currentTouch.position.y);
if (useScreenLimitOffsets) {
newPosition.x = Mathf.Clamp (newPosition.x, (leftScreenLimitOffset + screenLimitOffset),
screenLimit.x - (rightScreenLimitOffset + screenLimitOffset));
newPosition.y = Mathf.Clamp (newPosition.y, (downScreenLimitOffset + screenLimitOffset),
screenLimit.y - (upScreenLimitOffset + screenLimitOffset));
} else {
currentScreenLimitOffset = new Vector2 (screenLimitOffset, screenLimitOffset);
newPosition.x = Mathf.Clamp (newPosition.x, currentScreenLimitOffset.x, screenLimit.x - currentScreenLimitOffset.x);
newPosition.y = Mathf.Clamp (newPosition.y, currentScreenLimitOffset.y, screenLimit.y - currentScreenLimitOffset.y);
}
mainPanelToMoveTransform.position = newPosition;
}
}
public void enableMovePanel (RectTransform panelToMove)
{
if (movePanelsEnabled) {
if (!movingPanelActive) {
screenLimit = new Vector2 (Screen.currentResolution.width, Screen.currentResolution.height);
touchPlatform = touchJoystick.checkTouchPlatform ();
currentPanelToMove = panelToMove;
updatePanelPosition ();
previousParent = panelToMove.parent;
panelToMove.SetParent (mainPanelToMoveTransform);
stopUpdateCoroutine ();
updateCoroutine = StartCoroutine (updateSystemCoroutine ());
movingPanelActive = true;
}
}
}
public void disableMovePanel ()
{
if (movePanelsEnabled) {
if (movingPanelActive) {
stopUpdateCoroutine ();
if (currentPanelToMove != null) {
currentPanelToMove.SetParent (previousParent);
currentPanelToMove = null;
}
movingPanelActive = false;
}
}
}
public void toggleMenuPanelActiveState (GameObject buttonObject)
{
if (enableDisablePanelsEnabled) {
if (buttonObject != null) {
int currentIndex = menuPanelInfoList.FindIndex (s => s.mainPanelButton.Equals (buttonObject));
if (currentIndex > -1) {
menuPanelInfo currentMenuPanelInfo = menuPanelInfoList [currentIndex];
bool panelState = !currentMenuPanelInfo.mainPanel.activeSelf;
currentMenuPanelInfo.mainPanel.SetActive (panelState);
if (currentMenuPanelInfo.disabledPanel != null) {
currentMenuPanelInfo.disabledPanel.SetActive (!panelState);
}
}
}
}
}
public void openOrCloseAllMenuPanels (bool state)
{
if (enableDisablePanelsEnabled) {
for (int i = 0; i < menuPanelInfoList.Count; i++) {
setMenuPanelActiveState (state, menuPanelInfoList [i].mainPanelButton);
}
}
}
public void setMenuPanelActive (GameObject panelGameObject)
{
setMenuPanelActiveState (true, panelGameObject);
}
public void setMenuPanelDeactive (GameObject panelGameObject)
{
setMenuPanelActiveState (false, panelGameObject);
}
public void setMenuPanelActiveState (bool state, GameObject buttonObject)
{
if (enableDisablePanelsEnabled) {
if (buttonObject != null) {
int currentIndex = menuPanelInfoList.FindIndex (s => s.mainPanelButton.Equals (buttonObject));
if (currentIndex > -1) {
menuPanelInfo currentMenuPanelInfo = menuPanelInfoList [currentIndex];
currentMenuPanelInfo.mainPanel.SetActive (state);
if (currentMenuPanelInfo.disabledPanel != null) {
currentMenuPanelInfo.disabledPanel.SetActive (!state);
}
}
}
}
}
[System.Serializable]
public class menuPanelInfo
{
public string Name;
public GameObject mainPanel;
public GameObject disabledPanel;
public GameObject mainPanelButton;
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 003e33bc62b29e14a983d5b454a18883
timeCreated: 1637206945
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Menu/ingameMenuPanel.cs
uploadId: 814740

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: 7ed45fe756d1c5046af5d3ba4f917e6b
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Menu/menuPause.cs
uploadId: 814740

View File

@@ -0,0 +1,201 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class openMenuSystem : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool openMenuEnabled;
public string menuToOpenName;
public bool openPauseMenu;
public float openMenuDelay;
public float closeMenuDelay;
public bool pauseEscapeMenuKey = true;
[Space]
[Header ("Other Settings")]
[Space]
public bool useCustomActionOpenMenuSystem;
public customActionOpenMenuSystem mainCustomActionOpenMenuSystem;
[Space]
[Header ("Blur Settings")]
[Space]
public bool ignoreBlurMenu;
[Space]
[Header ("Debug")]
[Space]
public bool menuOpened;
[Space]
[Header ("Components")]
[Space]
public menuPause mainMenuPause;
public GameObject currentPlayer;
Coroutine menuCoroutine;
public void toggleOpenOrCloseMenu ()
{
openOrCloseMenu (!menuOpened);
}
public void openMenu ()
{
openOrCloseMenu (true);
}
public void closeMenu ()
{
openOrCloseMenu (false);
}
public void closeMenuIfOpened ()
{
if (menuOpened) {
closeMenu ();
}
}
public void openOrCloseMenu (bool state)
{
if (!openMenuEnabled) {
return;
}
if (mainMenuPause == null) {
getPauseManager ();
}
if (mainMenuPause == null) {
print ("WARNING: no player assigned in open menu system, make sure to assign it or send it through events to the " +
" function set current player");
return;
}
stopOpenOrCloseMenuCoroutine ();
menuCoroutine = StartCoroutine (openOrCloseMenuCoroutine (state));
}
public void stopOpenOrCloseMenuCoroutine ()
{
if (menuCoroutine != null) {
StopCoroutine (menuCoroutine);
}
}
IEnumerator openOrCloseMenuCoroutine (bool state)
{
menuOpened = state;
bool checkOpenOrCloseMenuResult = true;
if (useCustomActionOpenMenuSystem) {
if (menuOpened) {
WaitForSeconds delay = new WaitForSeconds (openMenuDelay);
yield return delay;
} else {
WaitForSeconds delay = new WaitForSeconds (closeMenuDelay);
yield return delay;
}
mainCustomActionOpenMenuSystem.openOrCloseMenu (state, currentPlayer);
checkOpenOrCloseMenuResult = false;
}
if (checkOpenOrCloseMenuResult) {
if (menuOpened) {
if (pauseEscapeMenuKey) {
mainMenuPause.setPauseGameInputPausedState (true);
} else {
mainMenuPause.setCurrentOpenMenuSystem (this);
}
mainMenuPause.setChangeBetweenIngameMenuPausedState (true);
if (ignoreBlurMenu) {
mainMenuPause.setIgnoreBlurPanelActiveState (true);
}
}
if (menuOpened) {
WaitForSeconds delay = new WaitForSeconds (openMenuDelay);
yield return delay;
} else {
WaitForSeconds delay = new WaitForSeconds (closeMenuDelay);
yield return delay;
}
if (!menuOpened) {
mainMenuPause.setOpenOrClosePlayerOpenMenuByNamePausedState (false);
}
if (openPauseMenu) {
mainMenuPause.openOrClosePauseMenuByName (menuToOpenName, menuOpened);
mainMenuPause.setOpenOrClosePauseMenuExternallyPausedState (menuOpened);
mainMenuPause.setPauseScreenWithoutPausingGameState (menuOpened);
} else {
mainMenuPause.openPlayerOpenMenuByName (menuToOpenName);
}
if (menuOpened) {
mainMenuPause.setOpenOrClosePlayerOpenMenuByNamePausedState (true);
} else {
if (pauseEscapeMenuKey) {
mainMenuPause.setPauseGameInputPausedState (false);
} else {
mainMenuPause.setCurrentOpenMenuSystem (null);
}
mainMenuPause.setChangeBetweenIngameMenuPausedState (false);
if (ignoreBlurMenu) {
mainMenuPause.setIgnoreBlurPanelActiveState (false);
}
}
}
}
public void setCurrentPlayer (GameObject newPlayer)
{
if (currentPlayer != newPlayer) {
currentPlayer = newPlayer;
getPauseManager ();
}
}
public void getPauseManager ()
{
if (currentPlayer != null) {
playerComponentsManager currentPlayerComponentsManager = currentPlayer.GetComponent<playerComponentsManager> ();
if (currentPlayerComponentsManager != null) {
mainMenuPause = currentPlayerComponentsManager.getPauseManager ();
}
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 5e22ff2665e7da941b6254545b6c2b0c
timeCreated: 1590010892
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Menu/openMenuSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,20 @@
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using System.Collections;
public class preventClickDrag : ScrollRect
{
public override void OnBeginDrag (PointerEventData eventData)
{
}
public override void OnDrag (PointerEventData eventData)
{
}
public override void OnEndDrag (PointerEventData eventData)
{
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 1ec5cfaa462ddfb429c39ae66d88fdba
timeCreated: 1527389906
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Menu/preventClickDrag.cs
uploadId: 814740

View File

@@ -0,0 +1,65 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class resetScrollRectOnEnable : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool resetEnabled = true;
public bool useVerticalPosition;
public float positionValue;
[Space]
[Header ("Debug")]
[Space]
public bool showDebugPrint;
[Space]
[Header ("Components")]
[Space]
public RectTransform mainRectTransform;
public ScrollRect mainScrollRect;
void OnEnable ()
{
if (resetEnabled) {
if (gameObject.activeInHierarchy) {
resetRectTransform ();
}
}
}
public void resetRectTransform ()
{
StartCoroutine (resetRectTransformCoroutine ());
}
IEnumerator resetRectTransformCoroutine ()
{
if (showDebugPrint) {
print ("reseting rect transform");
}
if (mainRectTransform != null) {
LayoutRebuilder.ForceRebuildLayoutImmediate (mainRectTransform);
}
yield return new WaitForEndOfFrame ();
yield return new WaitForEndOfFrame ();
if (mainScrollRect != null) {
if (useVerticalPosition) {
mainScrollRect.verticalNormalizedPosition = positionValue;
} else {
mainScrollRect.horizontalNormalizedPosition = positionValue;
}
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 94383127aba32424d80419d94a3a550d
timeCreated: 1671131915
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Menu/resetScrollRectOnEnable.cs
uploadId: 814740

View File

@@ -0,0 +1,195 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class sceneLoadSystem : MonoBehaviour
{
public GameObject mainMenuContent;
public GameObject sceneLoadMenu;
public GameObject sceneSlotPrefab;
public Transform sceneSlotsParent;
public Scrollbar mainScrollbar;
public ScrollRect mainScrollRect;
public List<sceneInfo> sceneInfoList = new List<sceneInfo> ();
public int startingSceneIndex = 1;
public bool addSceneNumberToName = true;
public bool instantiateScenePanelsActivated = true;
public bool useLoadScreen;
public int loadScreenScene = 1;
public bool useLastSceneIndexAsLoadScreen = true;
public string sceneToLoadAsyncPrefsName = "SceneToLoadAsync";
public bool checkLoadingScreenSceneConfigured = true;
public string loadingScreenSceneName = "Loading Screen Scene";
void Start ()
{
if (instantiateScenePanelsActivated) {
int demoNumber = 0;
int sceneInfoListCount = sceneInfoList.Count;
for (int i = 0; i < sceneInfoListCount; i++) {
if (sceneInfoList [i].addSceneToList) {
GameObject newSceneSlot = (GameObject)Instantiate (sceneSlotPrefab, Vector3.zero, Quaternion.identity);
newSceneSlot.name = "Scene Slot " + (i + 1);
newSceneSlot.transform.SetParent (sceneSlotsParent);
newSceneSlot.transform.localScale = Vector3.one;
newSceneSlot.transform.position = newSceneSlot.transform.position;
sceneSlotInfo newSceneSlotInfo = newSceneSlot.GetComponent<sceneSlot> ().sceneSlotInfo;
if (addSceneNumberToName) {
newSceneSlotInfo.sceneNameText.text = (demoNumber + 1) + " - " + sceneInfoList [i].Name;
} else {
newSceneSlotInfo.sceneNameText.text = sceneInfoList [i].Name;
}
if (sceneInfoList [i].titleFontSize > 0) {
newSceneSlotInfo.sceneNameText.fontSize = sceneInfoList [i].titleFontSize;
}
newSceneSlotInfo.sceneDescriptionText.text = sceneInfoList [i].sceneDescription;
newSceneSlotInfo.sceneDescriptionText.fontSize = sceneInfoList [i].fontSize;
newSceneSlotInfo.sceneImage.texture = sceneInfoList [i].sceneImage;
sceneInfoList [i].sceneButton = newSceneSlotInfo.sceneButton;
demoNumber++;
}
}
sceneSlotPrefab.SetActive (false);
StartCoroutine (SetValue ());
}
}
public void loadScene (Button buttonToCheck)
{
mainMenuContent.SetActive (false);
int sceneInfoListCount = sceneInfoList.Count;
for (int i = 0; i < sceneInfoListCount; i++) {
if (sceneInfoList [i].sceneButton == buttonToCheck) {
GKC_Utils.loadScene (sceneInfoList [i].sceneNumber, useLoadScreen, loadScreenScene, sceneToLoadAsyncPrefsName,
useLastSceneIndexAsLoadScreen, checkLoadingScreenSceneConfigured, loadingScreenSceneName);
}
}
}
IEnumerator SetValue ()
{
yield return new WaitForEndOfFrame ();
sceneLoadMenu.SetActive (true);
mainScrollRect.verticalNormalizedPosition = 0f;
mainScrollRect.horizontalNormalizedPosition = 0.5f;
mainScrollRect.horizontalNormalizedPosition = 0.5f;
mainScrollbar.value = 0;
sceneLoadMenu.SetActive (false);
yield return null;
}
public void setSceneNumberInOrder ()
{
int sceneInfoListCount = sceneInfoList.Count;
for (int i = 0; i < sceneInfoListCount; i++) {
sceneInfoList [i].sceneNumber = (i + startingSceneIndex);
}
updateComponent ();
}
public void setSceneNumberInOrderByIndex (int index)
{
int currentIndex = 0;
int sceneInfoListCount = sceneInfoList.Count;
for (int i = 0; i < sceneInfoListCount; i++) {
if (i >= index) {
sceneInfoList [i].sceneNumber = (currentIndex + startingSceneIndex);
currentIndex++;
}
}
updateComponent ();
}
public void enableAddSceneToListByIndex (int index)
{
int sceneInfoListCount = sceneInfoList.Count;
for (int i = 0; i < sceneInfoListCount; i++) {
if (i >= index) {
sceneInfoList [i].addSceneToList = true;
}
}
updateComponent ();
}
public void disableAddSceneToListByIndex (int index)
{
int sceneInfoListCount = sceneInfoList.Count;
for (int i = 0; i < sceneInfoListCount; i++) {
if (i >= index) {
sceneInfoList [i].addSceneToList = false;
}
}
updateComponent ();
}
public void updateComponent ()
{
GKC_Utils.updateComponent (this);
GKC_Utils.updateDirtyScene ("Update Scene Load System", gameObject);
}
[System.Serializable]
public class sceneInfo
{
public string Name;
[TextArea (10, 25)] public string sceneDescription;
public int sceneNumber;
public Texture sceneImage;
public Button sceneButton;
public bool addSceneToList = true;
public int fontSize = 20;
public int titleFontSize = 0;
}
[System.Serializable]
public class sceneSlotInfo
{
public Text sceneNameText;
public Text sceneDescriptionText;
public RawImage sceneImage;
public Button sceneButton;
}
}

View File

@@ -0,0 +1,169 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class sceneLoadSystem : MonoBehaviour
{
public GameObject mainMenuContent;
public GameObject sceneLoadMenu;
public GameObject sceneSlotPrefab;
public Transform sceneSlotsParent;
public Scrollbar mainScrollbar;
public ScrollRect mainScrollRect;
public List<sceneInfo> sceneInfoList = new List<sceneInfo> ();
public int startingSceneIndex = 1;
public bool addSceneNumberToName = true;
public bool useLoadScreen;
public int loadScreenScene = 1;
public bool useLastSceneIndexAsLoadScreen = true;
public string sceneToLoadAsyncPrefsName = "SceneToLoadAsync";
public bool checkLoadingScreenSceneConfigured = true;
public string loadingScreenSceneName = "Loading Screen Scene";
void Start ()
{
for (int i = 0; i < sceneInfoList.Count; i++) {
if (sceneInfoList [i].addSceneToList) {
GameObject newSceneSlot = (GameObject)Instantiate (sceneSlotPrefab, Vector3.zero, Quaternion.identity);
newSceneSlot.name = "Scene Slot " + (i + 1);
newSceneSlot.transform.SetParent (sceneSlotsParent);
newSceneSlot.transform.localScale = Vector3.one;
newSceneSlot.transform.position = newSceneSlot.transform.position;
sceneSlotInfo newSceneSlotInfo = newSceneSlot.GetComponent<sceneSlot> ().sceneSlotInfo;
if (addSceneNumberToName) {
newSceneSlotInfo.sceneNameText.text = (i + 1) + " - " + sceneInfoList [i].Name;
} else {
newSceneSlotInfo.sceneNameText.text = sceneInfoList [i].Name;
}
newSceneSlotInfo.sceneDescriptionText.text = sceneInfoList [i].sceneDescription;
newSceneSlotInfo.sceneDescriptionText.fontSize = sceneInfoList [i].fontSize;
newSceneSlotInfo.sceneImage.texture = sceneInfoList [i].sceneImage;
sceneInfoList [i].sceneButton = newSceneSlotInfo.sceneButton;
}
}
sceneSlotPrefab.SetActive (false);
StartCoroutine (SetValue ());
}
public void loadScene (Button buttonToCheck)
{
mainMenuContent.SetActive (false);
for (int i = 0; i < sceneInfoList.Count; i++) {
if (sceneInfoList [i].sceneButton == buttonToCheck) {
GKC_Utils.loadScene (sceneInfoList [i].sceneNumber, useLoadScreen, loadScreenScene, sceneToLoadAsyncPrefsName,
useLastSceneIndexAsLoadScreen, checkLoadingScreenSceneConfigured, loadingScreenSceneName);
}
}
}
IEnumerator SetValue ()
{
yield return new WaitForEndOfFrame ();
sceneLoadMenu.SetActive (true);
mainScrollRect.verticalNormalizedPosition = 0f;
mainScrollRect.horizontalNormalizedPosition = 0.5f;
mainScrollRect.horizontalNormalizedPosition = 0.5f;
mainScrollbar.value = 0;
sceneLoadMenu.SetActive (false);
yield return null;
}
public void setSceneNumberInOrder ()
{
for (int i = 0; i < sceneInfoList.Count; i++) {
sceneInfoList [i].sceneNumber = (i + startingSceneIndex);
}
updateComponent ();
}
public void setSceneNumberInOrderByIndex (int index)
{
int currentIndex = 0;
for (int i = 0; i < sceneInfoList.Count; i++) {
if (i >= index) {
sceneInfoList [i].sceneNumber = (currentIndex + startingSceneIndex);
currentIndex++;
}
}
updateComponent ();
}
public void enableAddSceneToListByIndex (int index)
{
for (int i = 0; i < sceneInfoList.Count; i++) {
if (i >= index) {
sceneInfoList [i].addSceneToList = true;
}
}
updateComponent ();
}
public void disableAddSceneToListByIndex (int index)
{
for (int i = 0; i < sceneInfoList.Count; i++) {
if (i >= index) {
sceneInfoList [i].addSceneToList = false;
}
}
updateComponent ();
}
public void updateComponent ()
{
GKC_Utils.updateComponent (this);
GKC_Utils.updateDirtyScene ("Update Scene Load System", gameObject);
}
[System.Serializable]
public class sceneInfo
{
public string Name;
[TextArea (10, 25)] public string sceneDescription;
public int sceneNumber;
public Texture sceneImage;
public Button sceneButton;
public bool addSceneToList = true;
public int fontSize = 20;
}
[System.Serializable]
public class sceneSlotInfo
{
public Text sceneNameText;
public Text sceneDescriptionText;
public RawImage sceneImage;
public Button sceneButton;
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: c36641b88471b2148bc8f5bcfca1939c
timeCreated: 1683044378
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Menu/sceneLoadSystem.cs.bak
uploadId: 814740

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 8985a22f64cc78c4092119957cd2d10d
timeCreated: 1549311813
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Menu/sceneLoadSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class sceneSlot : MonoBehaviour
{
public sceneLoadSystem.sceneSlotInfo sceneSlotInfo;
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 07bf7e14d10fdb14bb05490be0b3950c
timeCreated: 1549313768
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Menu/sceneSlot.cs
uploadId: 814740

View File

@@ -0,0 +1,49 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class setCanvasParentSystem : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool setNewPanelScale;
public Vector3 newPanelScale;
[Space]
[Header ("Events Settings")]
[Space]
public bool useEventOnParentChanged;
public UnityEvent eventOnParentChanged;
[Space]
[Header ("Components")]
[Space]
public RectTransform panelToChange;
public RectTransform newPanelParent;
public void activateParentChange ()
{
panelToChange.SetParent (newPanelParent);
panelToChange.localPosition = Vector3.zero;
panelToChange.localRotation = Quaternion.identity;
if (setNewPanelScale) {
panelToChange.localScale = newPanelScale;
} else {
panelToChange.localScale = Vector3.one;
}
if (useEventOnParentChanged) {
eventOnParentChanged.Invoke ();
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 288174410e68adf4fb0c332cbb9f86af
timeCreated: 1584737924
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Menu/setCanvasParentSystem.cs
uploadId: 814740

View File

@@ -0,0 +1,35 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class simpleUIButtonInfo : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public string currentName;
public int ID;
[Space]
[Header ("Components")]
[Space]
public GameObject buttonObject;
public Text mainText;
public RawImage mainIcon;
public void setCurrentName (string newValue)
{
currentName = newValue;
}
public string getCurrentName ()
{
return currentName;
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 7ec6ecb191d97de47ad31a2e4304da5a
timeCreated: 1698297279
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Menu/simpleUIButtonInfo.cs
uploadId: 814740