2021-04-08 20:09:59 +08:00
|
|
|
|
using ET;
|
|
|
|
|
using FairyGUI;
|
|
|
|
|
|
|
|
|
|
using Cal.DataTable;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using ET.EventType;
|
|
|
|
|
|
|
|
|
|
namespace ET
|
|
|
|
|
{
|
|
|
|
|
public static class CharacterHelper
|
|
|
|
|
{
|
|
|
|
|
public static JobType GetJobTypeById(int jobId)
|
|
|
|
|
{
|
|
|
|
|
return (JobType)(jobId % 2 != 0 ? jobId / 2 + 1 : jobId / 2);
|
|
|
|
|
}
|
|
|
|
|
public static string SexToSTring(SexType sex)
|
|
|
|
|
{
|
|
|
|
|
switch (sex)
|
|
|
|
|
{
|
|
|
|
|
default:
|
|
|
|
|
case SexType.Male:
|
|
|
|
|
return "男";
|
|
|
|
|
case SexType.Famale:
|
|
|
|
|
return "女";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public static string GetLevelString(Unit unit,int fixedLevel =0)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2021-04-11 19:50:39 +08:00
|
|
|
|
NumericComponent num = unit.GetComponent<NumericComponent>();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
int level = num.GetAsInt(NumericType.Level);
|
|
|
|
|
if (level == 0)
|
|
|
|
|
return fixedLevel + string.Empty;
|
|
|
|
|
int trans = num.GetAsInt(NumericType.Transmigration);
|
|
|
|
|
return GetLevelString(trans,level);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Log.Error(e);
|
|
|
|
|
}
|
|
|
|
|
return "0·0";
|
|
|
|
|
}
|
|
|
|
|
public static string GetLevelString(int trans, int level)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
int baseLevel = ConstDefine.levelArr[trans];
|
|
|
|
|
int newLevel = level - baseLevel;
|
|
|
|
|
return $"{trans}·{newLevel}";
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Log.Error(e);
|
|
|
|
|
}
|
|
|
|
|
return "0·0";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|