78 lines
1.4 KiB
C#
78 lines
1.4 KiB
C#
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();
|
|
}
|
|
}
|
|
} |