97 lines
3.4 KiB
C#
97 lines
3.4 KiB
C#
using asap.core;
|
||
using cfg;
|
||
using game;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
|
||
public class MMTService
|
||
{
|
||
[Inject]
|
||
public Tables _tables { set; get; }
|
||
public int MMTValue { private set; get; }
|
||
public string MMTStr { private set; get; }
|
||
public bool CanShowHand { set; get; } = true;
|
||
public bool MMFailParamValue;
|
||
public bool MMTNoviceProtectionValue;
|
||
public bool MMTEventTargetIDValue;
|
||
public bool MMTFastAutoBuildSwitchValue;
|
||
public MMTFailParam MMTFailParamData { get; private set; }
|
||
public MMTNoviceProtection MMTNoviceProtectionData { get; private set; }
|
||
public MMTEventTargetID MMTEventTargetIDData { get; private set; }
|
||
|
||
public float GetFailDelayTime() => MMFailParamValue ? MMTFailParamData.FailDelayTime : _tables.TbGlobalConfig.FailDelayTime;
|
||
public float GetFishingFailStrugglingTime() => MMFailParamValue ? MMTFailParamData.FishingFailStrugglingTime : _tables.TbGlobalConfig.FishingFailStrugglingTime;
|
||
public float GetFishingFailProgress() => MMFailParamValue ? MMTFailParamData.FishingFailProgress : _tables.TbGlobalConfig.FishingFailProgress;
|
||
public int GetNoFail() => MMTNoviceProtectionValue ? MMTNoviceProtectionData.NoFail : _tables.TbGlobalConfig.NoFail;
|
||
public int GetNoFailWithGuidance() => MMTNoviceProtectionValue ? MMTNoviceProtectionData.NoFailWithGuidance : _tables.TbGlobalConfig.NoFailWithGuidance;
|
||
public int GetEventTargetIDOffset() => MMTEventTargetIDValue ? MMTEventTargetIDData.IDOffset : 0;
|
||
|
||
public string Init(int MMTValue)
|
||
{
|
||
this.MMTValue = MMTValue;
|
||
MMFailParamValue = false;
|
||
MMTNoviceProtectionValue = false;
|
||
MMTEventTargetIDValue = false;
|
||
MMTFastAutoBuildSwitchValue = false;
|
||
MMTFailParamData = null;
|
||
MMTNoviceProtectionData = null;
|
||
MMTEventTargetIDData = null;
|
||
|
||
var mmDatas = _tables.TbMMTInit.DataList;
|
||
string MMType = "";
|
||
|
||
for (int i = 0; i < mmDatas.Count; i++)
|
||
{
|
||
MMTInit data = mmDatas[i];
|
||
bool isB = false;
|
||
// #if UNITY_ANDROID
|
||
if (CheckMMT(data.ID - 1001))
|
||
{
|
||
isB = true;
|
||
switch (data.MMTParam)
|
||
{
|
||
case MMTFailParam fp:
|
||
MMFailParamValue = true;
|
||
MMTFailParamData = fp;
|
||
break;
|
||
case MMTNoviceProtection np:
|
||
MMTNoviceProtectionValue = true;
|
||
MMTNoviceProtectionData = np;
|
||
break;
|
||
case MMTEventTargetID et:
|
||
MMTEventTargetIDValue = true;
|
||
MMTEventTargetIDData = et;
|
||
break;
|
||
case MMTFastAutoBuildSwitch:
|
||
MMTFastAutoBuildSwitchValue = true;
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
// #endif
|
||
if (isB)
|
||
{
|
||
MMType += "B";
|
||
}
|
||
else
|
||
{
|
||
MMType += "A";
|
||
}
|
||
}
|
||
MMTStr = MMType;
|
||
return MMType;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 检查分组
|
||
/// </summary>
|
||
/// <param name="index">第几大组0,1,2</param>
|
||
/// <returns>false=A true=B </returns>
|
||
bool CheckMMT(int index)
|
||
{
|
||
int ab = 1 << index;
|
||
return (MMTValue & ab) == ab;
|
||
}
|
||
}
|