首次提交
This commit is contained in:
78
Assets/Scripts/Fishing~/Fishing.cs
Normal file
78
Assets/Scripts/Fishing~/Fishing.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class Fishing
|
||||
{
|
||||
Fishing()
|
||||
{
|
||||
App.OnUpdate += Update;
|
||||
}
|
||||
|
||||
private static Fishing _inst;
|
||||
|
||||
public static Fishing Inst => _inst ??= new Fishing();
|
||||
|
||||
public int Map { get; private set; }
|
||||
|
||||
|
||||
public FishingPlay Player { get; private set; }
|
||||
|
||||
public FishingDatasource Datasource { get; private set; }
|
||||
|
||||
public void Go(int map)
|
||||
{
|
||||
Map = map;
|
||||
EnterMap();
|
||||
}
|
||||
|
||||
#region Load
|
||||
|
||||
private void EnterMap()
|
||||
{
|
||||
EnterDone();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
void Update()
|
||||
{
|
||||
Datasource?.Update();
|
||||
Player?.Update();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 进入地图成功
|
||||
/// </summary>
|
||||
private void EnterDone()
|
||||
{
|
||||
DataInit();
|
||||
PlayerInit();
|
||||
}
|
||||
|
||||
private void DataInit()
|
||||
{
|
||||
Datasource = new FishingDatasource();
|
||||
Datasource.Init();
|
||||
}
|
||||
|
||||
private void PlayerInit()
|
||||
{
|
||||
if (Player != null)
|
||||
{
|
||||
Player.UnLoadLevel(NewBattlePlayInit);
|
||||
}
|
||||
else
|
||||
{
|
||||
NewBattlePlayInit();
|
||||
}
|
||||
}
|
||||
|
||||
private void NewBattlePlayInit()
|
||||
{
|
||||
Player = new FishingPlay(Datasource);
|
||||
Player.Init();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user