Initial commit

This commit is contained in:
Ardella Malinda Sarastri
2025-07-10 17:06:42 +07:00
commit 72b8b42a0b
8149 changed files with 4223394 additions and 0 deletions

View File

@ -0,0 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace LayerLab.CasualGame
{
public class PanelCasualGame : MonoBehaviour
{
[SerializeField] private GameObject[] otherPanels;
public void OnEnable()
{
for (int i = 0; i < otherPanels.Length; i++) otherPanels[i].SetActive(true);
}
public void OnDisable()
{
for (int i = 0; i < otherPanels.Length; i++) otherPanels[i].SetActive(false);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9a00128818eda43dfaa959b83527b255
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,84 @@
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace LayerLab.CasualGame
{
public class PanelControlCasualGame : MonoBehaviour
{
private int page = 0;
private bool isReady = false;
[SerializeField] private List<GameObject> panels = new List<GameObject>();
private TextMeshProUGUI textTitle;
[SerializeField] private Transform panelTransform;
[SerializeField] private Button buttonPrev;
[SerializeField] private Button buttonNext;
private void Start()
{
textTitle = transform.GetComponentInChildren<TextMeshProUGUI>();
buttonPrev.onClick.AddListener(Click_Prev);
buttonNext.onClick.AddListener(Click_Next);
foreach (Transform t in panelTransform)
{
panels.Add(t.gameObject);
t.gameObject.SetActive(false);
}
panels[page].SetActive(true);
isReady = true;
CheckControl();
}
void Update()
{
if (panels.Count <= 0 || !isReady) return;
if (Input.GetKeyDown(KeyCode.LeftArrow))
Click_Prev();
else if (Input.GetKeyDown(KeyCode.RightArrow))
Click_Next();
}
//Click_Prev
public void Click_Prev()
{
if (page <= 0 || !isReady) return;
panels[page].SetActive(false);
panels[page -= 1].SetActive(true);
textTitle.text = panels[page].name;
CheckControl();
}
//Click_Next
public void Click_Next()
{
if (page >= panels.Count - 1) return;
panels[page].SetActive(false);
panels[page += 1].SetActive(true);
CheckControl();
}
void SetArrowActive()
{
buttonPrev.gameObject.SetActive(page > 0);
buttonNext.gameObject.SetActive(page < panels.Count - 1);
}
//SetTitle, SetArrow Active
private void CheckControl()
{
textTitle.text = panels[page].name.Replace("_", " ");
SetArrowActive();
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bf55aa2c0d7914b348b9d193f622141c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: