Files
back_cantanBuilding/Assets/Scripts/Duel/DuelPlayerModel.cs
2026-05-26 16:15:54 +08:00

55 lines
1.4 KiB
C#

using System;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 需要同步服务器
/// </summary>
public class DuelPlayerModel : DuelModel//:服务器接口
{
DateTime LastRecordedTime;
public override void Start()
{
base.Start();
LastRecordedTime = ZZTimeHelper.UtcNow();
}
public override void StartLastRecordedTime()
{
SetRodTime = (int)(ZZTimeHelper.UtcNow() - LastRecordedTime).TotalSeconds;
LastRecordedTime = ZZTimeHelper.UtcNow();
}
//public override void StartFishing()
//{
// SetCastingTime();
// base.StartFishing();
//}
public override bool StopFishing(FishInfoData data)
{
SetFishingTime();
return base.StopFishing(data);
}
public override void CastRod(int fishID)
{
SetSlienceTime();
base.CastRod(fishID);
}
void SetSlienceTime()
{
CurrentState.slienceTime = (int)(ZZTimeHelper.UtcNow() - LastRecordedTime).TotalSeconds;
LastRecordedTime = ZZTimeHelper.UtcNow();
}
//void SetCastingTime()
//{
// CurrentState.castingTime = (int)(ZZTimeHelper.UtcNow() - LastRecordedTime).TotalSeconds;
// LastRecordedTime = ZZTimeHelper.UtcNow();
//}
void SetFishingTime()
{
CurrentState.fishingTime = (int)(ZZTimeHelper.UtcNow() - LastRecordedTime).TotalSeconds;
LastRecordedTime = ZZTimeHelper.UtcNow();
}
}