1. 버튼 설정은 했음 - 근데 이걸 이제 플레이어라든가 다른데 연결 시키는거 인풋매니저랑 연결시킨다든가 하는걸 해야 할 것 같음 - 기존에는 공격 버튼은 공격버튼으로 만 사용되어서 인풋매니저에서 관리해서 독점적인 관리가 가능했는데 UIButton으로 뺌으로 인해서 이러한 독점 관리가 아니게 되었으므로 이에 대한 처리가 필요로 하다.
85 lines
2.7 KiB
C#
85 lines
2.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Unity.VisualScripting;
|
|
using UnityEngine;
|
|
|
|
public class GameScene : BaseScene
|
|
{
|
|
protected override void Init()
|
|
{
|
|
base.Init();
|
|
|
|
_sceneType = Define.Scene.Game;
|
|
Manager.UI.UIList = new List<string> { "ExpBar" , "JoyStick", "Button_Attack", "Button_Defence"};
|
|
// var onList = new[] { "ExpBar" , "JoyStick", "Button_Attack", "Button_Defence"};
|
|
|
|
Manager.UI.SwitchOnObject<ExpBar>("ExpBar", true);
|
|
Manager.UI.SwitchOnObject<Joystick>("JoyStick", true);
|
|
|
|
UIButton atkbtn = Manager.UI.SwitchOnObject<UIButton>("Button_Attack", true);
|
|
if (atkbtn != null)
|
|
{
|
|
atkbtn.SetButtonContents(null,"공", false, true);
|
|
atkbtn.SetButtonRect("Button_Attack", new Vector2(50, 150));
|
|
atkbtn.Bind(() => Debug.Log("Attack Button Clicked"));
|
|
}
|
|
|
|
UIButton defbtn = Manager.UI.SwitchOnObject<UIButton>("Button_Defence", true);
|
|
if (defbtn != null)
|
|
{
|
|
defbtn.SetButtonContents(null,"방", false, true);
|
|
defbtn.SetButtonRect(
|
|
"Button_Defence",
|
|
new Vector2(-100f - 180f / 2, 100f + 180f / 2),
|
|
180.0f,180.0f,
|
|
new Vector2(1, 0),
|
|
new Vector2(0.5f, 0.5f)
|
|
);
|
|
defbtn.Bind(() => Debug.Log("Defence Button Clicked"));
|
|
}
|
|
|
|
Manager.UI.ExclusiveExpBar();
|
|
CreateSpawner();
|
|
}
|
|
void CreateJoyStick()
|
|
{
|
|
// GameObject joystick = Manager.Resource.Instantiate("Prefabs/UI/VirtualJoyStick", GameObject.Find("@Canvas").transform);
|
|
// joystick.AddComponent<VirtualJoystick>();
|
|
}
|
|
|
|
void CreateButtons()
|
|
{
|
|
Button_Action buttons = _canvas.AddComponent<Button_Action>();
|
|
|
|
// if (buttons != null)
|
|
// {
|
|
// buttons.SetSkillButtonEvent(0, () => Debug.Log("Skill 1 Button Clicked"));
|
|
// buttons.SetSkillButtonEvent(1, () => Debug.Log("Skill 2 Button Clicked"));
|
|
// buttons.SetSkillButtonEvent(2, () => Debug.Log("Skill 3 Button Clicked"));
|
|
// // buttons.SetSkillButtonEvent(3, () => Debug.Log("Skill 4 Button Clicked"));
|
|
// }
|
|
}
|
|
|
|
void CreateSpawner()
|
|
{
|
|
GameObject spawner = Manager.Resource.Instantiate("Prefabs/UI/Spawner", GameObject.Find("@Scene").transform);
|
|
|
|
var spawn = spawner.AddComponent<SpawnController>();
|
|
spawn.EnemyPrefabPath = "Prefabs/Characters/Test_Enemy";
|
|
spawn.EnemyDataPath = "Data/E_Test1";
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
|
|
}
|
|
|
|
public override void Clear()
|
|
{
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|