| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914 |
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- using OfficeOpenXml;
- using Mono.Xml;
- using System.Security;
- public class EffectAsset
- {
- public int id;
- public string desc;
- public string effect;
- public string link;
- public int followType;
- public int targetType;
- public Vector3 rot;
- public float lifeTime;
- public static EffectAsset CreateEffectAsset(ExcelWorksheet sheet, int row)
- {
- EffectAsset effect = new EffectAsset();
- int col = 1;
- effect.id = sheet.GetValue<int>(row, col++);
- effect.desc = sheet.GetValue<string>(row, col++);
- effect.effect = sheet.GetValue<string>(row, col++);
- effect.link = sheet.GetValue<string>(row, col++);
- effect.followType = sheet.GetValue<int>(row, col++);
- effect.targetType = sheet.GetValue<int>(row, col++);
- effect.rot = StringUtil.convertVector3(sheet.GetValue<string>(row, col++));
- effect.lifeTime = sheet.GetValue<float>(row, col++);
- return effect;
- }
- public void SaveAssetToExcel(ref ExcelWorksheet sheet, int row)
- {
- if (sheet == null) return;
- int col = 1;
- sheet.SetValue(row, col++, this.id);
- sheet.SetValue(row, col++, this.desc);
- sheet.SetValue(row, col++, this.effect);
- sheet.SetValue(row, col++, this.link);
- sheet.SetValue(row, col++, this.followType);
- sheet.SetValue(row, col++, this.targetType);
- sheet.SetValue(row, col++, StringUtil.ConvertVector2Str(this.rot));
- sheet.SetValue(row, col++, this.lifeTime);
- }
- }
- public class FunctionDataAsset
- {
- public int id;
- public string name;
- public BattleBuffType buffType;
- public Buff_Function_Type functionType;
- public int group;
- public bool canHurtStop; //是否可以伤害打断
- public bool forbidMove; //是否影响动作
- public bool forbidNormalAttack; //禁止普攻
- public bool forbidSkill; //禁止技能释放
- public bool canIgnoreDodge; //是否可以闪避
- public string desc;
- public float intervalTime; //间隔时长
- public int fromAttr; //来源属性
- public string icon; //图标
- public int effectId; //特效id
- public string word; //文字
- public int iconIdx = -1;
- public int wordIdx = -1;
- public int effectIdx = -1;
- public static FunctionDataAsset CreateFunAsset(ExcelWorksheet sheet, int row)
- {
- FunctionDataAsset funAsset = new FunctionDataAsset();
- int col = 1;
- funAsset.id = sheet.GetValue<int>(row, col++);
- funAsset.name = sheet.GetValue<string>(row, col++);
- funAsset.functionType = (Buff_Function_Type)(sheet.GetValue<int>(row, col++));
- funAsset.group = sheet.GetValue<int>(row, col++);
- funAsset.buffType = (BattleBuffType)(sheet.GetValue<int>(row, col++));
- funAsset.canHurtStop = sheet.GetValue<int>(row, col++) > 0 ? true : false;
- funAsset.forbidMove = sheet.GetValue<int>(row, col++) > 0 ? true : false;
- funAsset.forbidNormalAttack = sheet.GetValue<int>(row, col++) > 0 ? true : false;
- funAsset.forbidSkill = sheet.GetValue<int>(row, col++) > 0 ? true : false;
- funAsset.canIgnoreDodge = sheet.GetValue<int>(row, col++) > 0 ? true : false;
- funAsset.desc = sheet.GetValue<string>(row, col++);
- funAsset.icon = sheet.GetValue<string>(row, col++);
- string temp = sheet.GetValue<string>(row, col++);
- int.TryParse(temp, out funAsset.effectId);
- funAsset.word = sheet.GetValue<string>(row, col++);
- return funAsset;
- }
- public void SaveAssetToExcel(ref ExcelWorksheet sheet, int row)
- {
- if (sheet == null) return;
- int col = 1;
- sheet.SetValue(row, col++, this.id);
- sheet.SetValue(row, col++, this.name);
- sheet.SetValue(row, col++, (int)this.functionType);
- sheet.SetValue(row, col++, this.group);
- sheet.SetValue(row, col++, (int)this.buffType);
- sheet.SetValue(row, col++, this.canHurtStop ? 1 : 0);
- sheet.SetValue(row, col++, this.forbidMove?1:0);
- sheet.SetValue(row, col++, this.forbidNormalAttack?1:0);
- sheet.SetValue(row, col++, this.forbidSkill ? 1 : 0);
- sheet.SetValue(row, col++, this.canIgnoreDodge ? 1 : 0);
- sheet.SetValue(row, col++, this.desc);
- sheet.SetValue(row, col++, this.icon);
- sheet.SetValue(row, col++, this.effectId);
- sheet.SetValue(row, col++, this.word);
- }
- public void Copy(FunctionDataAsset from)
- {
- if (from == null) return;
- this.id = from.id;
- this.name = from.name;
- this.buffType = from.buffType;
- this.functionType = from.functionType;
- this.group = from.group;
- this.canHurtStop = from.canHurtStop;
- this.forbidMove = from.forbidMove;
- this.forbidNormalAttack = from.forbidNormalAttack;
- this.forbidSkill = from.forbidSkill;
- this.canIgnoreDodge = from.canIgnoreDodge;
- this.desc = from.desc;
- this.intervalTime = from.intervalTime;
- this.fromAttr = from.fromAttr;
- this.icon = from.icon;
- this.effectId = from.effectId;
- this.word = from.word;
- this.iconIdx = from.iconIdx;
- this.wordIdx = from.wordIdx;
- this.effectIdx = from.effectIdx;
- }
- }
- public class FrameEventParamEditor
- {
- public string name;
- public string val;
- public string valType;
- public int valTypeIdx = -1;
- public int valIdx = -1;
- public SecurityElement SaveCfgToXml()
- {
- SecurityElement paramNode = new SecurityElement("param");
- paramNode.AddAttribute("name", this.name);
- paramNode.AddAttribute("value", this.val);
- paramNode.AddAttribute("valueType", this.valType);
- return paramNode;
- }
- }
- public class ActionEventParamEditor
- {
- public int startFrame;
- public int endFrame;
- public int eventType;
- public string desc;
- public bool bAffectBySing;
- public List<FrameEventParamEditor> frameParams;
- public ActionEventParamEditor()
- {
- }
- public ActionEventParamEditor(ActionEventParamEditor src)
- {
- if(src!=null)
- {
- this.startFrame = src.startFrame;
- this.endFrame = src.endFrame;
- this.eventType = src.eventType;
- this.desc = src.desc;
- this.bAffectBySing = src.bAffectBySing;
- if (this.frameParams == null)
- this.frameParams = new List<FrameEventParamEditor>();
- this.frameParams.Clear();
- if (src.frameParams != null)
- this.frameParams.AddRange(src.frameParams);
- }
- }
- public SecurityElement SaveCfgToXml()
- {
- SecurityElement eventNode = new SecurityElement("event");
- eventNode.AddAttribute("startFrame", this.startFrame.ToString());
- eventNode.AddAttribute("endFrame", this.endFrame.ToString());
- eventNode.AddAttribute("type", this.eventType.ToString());
- eventNode.AddAttribute("affectBySing", this.bAffectBySing.ToString());
- eventNode.AddAttribute("desc", this.desc);
- if(this.frameParams != null)
- {
- for(int idx =0; idx < this.frameParams.Count;idx++)
- {
- FrameEventParamEditor paramData = this.frameParams[idx];
- if (string.IsNullOrEmpty(paramData.val) || string.IsNullOrEmpty(paramData.valType) || string.IsNullOrEmpty(paramData.name)) continue;
- SecurityElement paramNode = paramData.SaveCfgToXml();
- eventNode.AddChild(paramNode);
- }
- }
- return eventNode;
- }
- }
- public class ActionEventDataEditor
- {
- private int mId;
- public int Id
- {
- get { return mId; }
- }
- public string Name
- {
- get;set;
- }
- private int mTotalFrame = 0;
- public int TotalFrame
- {
- get { return mTotalFrame; }
- set
- {
- mTotalFrame = value;
- }
- }
- /// <summary>
- /// 性别
- /// </summary>
- private int mGender = 2;
- public int Gender
- {
- get { return mGender; }
- set { mGender = value; }
- }
- public List<ActionEventParamEditor> ActionEventList
- {
- get; private set;
- }
- public ActionEventDataEditor(int id, int totalFrame,string name,int gender)
- {
- this.mId = id;
- this.mTotalFrame = totalFrame;
- this.Name = name;
- this.mGender = gender;
- }
- public void AddEvent(ActionEventParamEditor eve)
- {
- if (ActionEventList == null)
- {
- ActionEventList = new List<ActionEventParamEditor>();
- }
- ActionEventList.Add(eve);
- }
- }
- public class FunctionValData
- {
- public int funId;
- public float val; //初始值
- public float incVal; //随等级变化值
- public float duration; //初始时长
- public float incDuration; //随等级变化时长
- public int fromAttr; //依赖那个属性进行计算
- public float intervalTime; //间隔时间
- public bool extendFold;
- public FunctionValData(int id, float val, float incVal, float dur, float incDur, int fromAttr, float intervalTime)
- {
- this.funId = id;
- this.val = val;
- this.incVal = incVal;
- this.duration = dur;
- this.incDuration = incDur;
- this.fromAttr = fromAttr;
- this.intervalTime = intervalTime;
- this.extendFold = true;
- }
- public FunctionValData(FunctionValData src)
- {
- if(src != null)
- {
- this.funId = src.funId;
- this.val = src.val;
- this.incVal = src.incVal;
- this.duration = src.duration;
- this.incDuration = src.duration;
- this.fromAttr = src.fromAttr;
- this.intervalTime = src.intervalTime;
- }
- }
- public override string ToString()
- {
- return funId + ":" + val + (incVal > 0 ? ("_" + incVal) : "") + ":" + duration + (incDuration > 0 ? ("_" + incDuration) : "") + ":" + fromAttr + ":" + intervalTime;
- }
- public void Apply(FunctionValData src)
- {
- if (src != null)
- {
- this.funId = src.funId;
- this.val = src.val;
- this.incVal = src.incVal;
- this.duration = src.duration;
- this.incDuration = src.duration;
- this.fromAttr = src.fromAttr;
- this.intervalTime = src.intervalTime;
- }
- }
- }
- public class BuffDataAsset
- {
- public int id;
- public string desc;
- public string extendFuns;
- public int damageType; //伤害类型
- public int targetType; //目标类型
- public int hitType; //命中类型
- public int effectiveness; //生效率
- public bool ignoreMultiHurt; //是否忽略多段伤害
- public bool removeFunWhenStop; //buff移除时是否关闭对应的fun
- public List<FunctionValData> funList;
- public ActionEventDataEditor actionEventData;
- public ActionEventDataEditor femaleActionEventData;
- public bool canPerfectDodge = false;
- public bool canDodge = false;
- public bool canResist = false;
- public bool canCrit = false;
- #region 工具中使用的东西
- public bool extendBaseFold = true;
- public bool extendFunFold = true;
- public bool extendFrameEventFold = true;
- public bool extendFemaleFrameEventFold = false;
- public bool extendModelPrefab = true;
- public Vector2 scrollPos = Vector2.zero;
- public RuntimeAnimatorController modelAnimator = null;
- public UnityEditor.Animations.AnimatorStateMachine stateMachine = null;
- public string[] animClipNames = null;
- public int animClipIdx = -1;
- #endregion
- public static BuffDataAsset CreateBuffAsset(ExcelWorksheet sheet,int row)
- {
- BuffDataAsset buffAsset = new BuffDataAsset();
- int col = 1;
- buffAsset.id = sheet.GetValue<int>(row, col++);
- buffAsset.desc = sheet.GetValue<string>(row, col++);
- string funStr = sheet.GetValue<string>(row, col++);
- if(!string.IsNullOrEmpty(funStr))
- {
- string[] funStrList = funStr.Split(';');
- buffAsset.funList = new List<FunctionValData>(funStrList.Length);
- for (int idx = 0; idx < funStrList.Length; idx++)
- {
- string[] funTemp = funStrList[idx].Split(':');
- if (funTemp.Length < 2) continue;
- int funId = 0;
- float funVal = 0;
- float funIncVal = 0;
- float funDuration = 0;
- float funIncDuration = 0;
- int fromAttr = 0;
- float intervalTime = 0;
- if (funTemp.Length > 1)
- {
- float[] funValList = StringUtil.split2Float(funTemp[1], '_');
- if (funValList.Length > 0)
- funVal = funValList[0];
- if (funValList.Length > 1)
- funIncVal = funValList[1];
- }
- if (funTemp.Length > 2)
- {
- float[] funDurList = StringUtil.split2Float(funTemp[2], '_');
- if (funDurList.Length > 0)
- funDuration = funDurList[0];
- if (funDurList.Length > 1)
- funIncDuration = funDurList[1];
- }
- if (funTemp.Length > 3)
- {
- int.TryParse(funTemp[3], out fromAttr);
- }
- if (funTemp.Length > 4)
- {
- float.TryParse(funTemp[4], out intervalTime);
- }
- if (int.TryParse(funTemp[0], out funId))
- {
- FunctionValData fun = new FunctionValData(funId, funVal, funIncVal, funDuration, funIncDuration, fromAttr, intervalTime);
- buffAsset.funList.Add(fun);
- }
- }
- }
- buffAsset.extendFuns = sheet.GetValue<string>(row, col++);
- buffAsset.damageType = sheet.GetValue<int>(row, col++);
- buffAsset.targetType = sheet.GetValue<int>(row, col++);
- buffAsset.hitType = sheet.GetValue<int>(row, col++);
- buffAsset.effectiveness = sheet.GetValue<int>(row, col++);
- buffAsset.ignoreMultiHurt = sheet.GetValue<int>(row, col++) > 0 ? true : false;
- buffAsset.removeFunWhenStop = sheet.GetValue<int>(row, col++) > 0 ? true : false;
- buffAsset.canPerfectDodge = (buffAsset.hitType & (int)BuffHitType.Perfect_Dodge) == (int)BuffHitType.Perfect_Dodge;
- buffAsset.canDodge = (buffAsset.hitType & (int)BuffHitType.Dodge) == (int)BuffHitType.Dodge;
- buffAsset.canResist = (buffAsset.hitType & (int)BuffHitType.Resist) == (int)BuffHitType.Resist;
- buffAsset.canCrit = (buffAsset.hitType & (int)BuffHitType.Critical) == (int)BuffHitType.Critical;
- return buffAsset;
- }
- public BuffDataAsset()
- {
- }
- public BuffDataAsset(int buffId)
- {
- this.id = buffId;
- }
- public void Copy(BuffDataAsset src)
- {
- if (src == null) return;
- this.id = src.id;
- this.desc = src.desc;
- this.extendFuns = src.extendFuns;
- this.damageType = src.damageType;
- this.targetType = src.targetType;
- this.hitType = src.hitType;
- this.effectiveness = src.effectiveness;
- this.ignoreMultiHurt = src.ignoreMultiHurt;
- this.removeFunWhenStop = src.removeFunWhenStop;
- this.canPerfectDodge = src.canPerfectDodge;
- this.canDodge = src.canDodge;
- this.canResist = src.canResist;
- this.canCrit = src.canCrit;
- this.actionEventData = src.actionEventData;
- this.femaleActionEventData = src.femaleActionEventData;
- if (this.funList == null)
- this.funList = new List<FunctionValData>();
- this.funList.Clear();
- if(src.funList != null && src.funList.Count > 0)
- {
- for(int idx = 0; idx < src.funList.Count;idx++)
- {
- this.funList.Add(new FunctionValData(src.funList[idx]));
- }
- }
- }
- public void Apply(BuffDataAsset src)
- {
- if (src == null) return;
- this.id = src.id;
- this.desc = src.desc;
- this.extendFuns = src.extendFuns;
- this.damageType = src.damageType;
- this.targetType = src.targetType;
- this.hitType = src.hitType;
- this.effectiveness = src.effectiveness;
- this.ignoreMultiHurt = src.ignoreMultiHurt;
- this.removeFunWhenStop = src.removeFunWhenStop;
- this.canPerfectDodge = src.canPerfectDodge;
- this.canDodge = src.canDodge;
- this.canResist = src.canResist;
- this.canCrit = src.canCrit;
- this.actionEventData = src.actionEventData;
- this.femaleActionEventData = src.femaleActionEventData;
- if (src.funList != null && src.funList.Count > 0)
- {
- for (int idx = 0; idx < src.funList.Count; idx++)
- {
- FunctionValData funVal = GetFunData(src.funList[idx].funId);
- if(funVal == null)
- {
- funVal = new FunctionValData(src.funList[idx]);
- this.funList.Add(funVal);
- }
- else
- {
- funVal.Apply(src.funList[idx]);
- }
- }
- }
- for(int idx = this.funList.Count-1; idx >= 0 ;idx--)
- {
- FunctionValData val = src.GetFunData(this.funList[idx].funId);
- if(val == null)
- {
- this.funList.RemoveAt(idx);
- }
- }
- }
- public FunctionValData GetFunData(int id)
- {
- if (funList == null) return null;
- for(int idx =0; idx < funList.Count;idx++)
- {
- if (funList[idx].funId == id) return funList[idx];
- }
- return null;
- }
- public void SaveAssetToExcel(ref ExcelWorksheet sheet, int row)
- {
- if (sheet == null) return;
- string funStr = "";
- if(funList != null)
- {
- for(int idx =0; idx < funList.Count;idx++)
- {
- FunctionValData val = funList[idx];
- if(idx == 0)
- {
- funStr = val.ToString();
- }
- else
- {
- funStr = funStr + ";" + val.ToString();
- }
- }
- }
- int col = 1;
- this.hitType = 0;
- if (this.canPerfectDodge)
- this.hitType |= (int)BuffHitType.Perfect_Dodge;
- if (this.canDodge)
- this.hitType |= (int)BuffHitType.Dodge;
- if (this.canResist)
- this.hitType |= (int)BuffHitType.Resist;
- if (this.canCrit)
- this.hitType |= (int)BuffHitType.Critical;
- sheet.SetValue(row, col++, this.id);
- sheet.SetValue(row, col++, this.desc);
- sheet.SetValue(row, col++, funStr);
- sheet.SetValue(row, col++, this.extendFuns);
- sheet.SetValue(row, col++, (int)this.damageType);
- sheet.SetValue(row, col++, (int)this.targetType);
- sheet.SetValue(row, col++, this.hitType);
- sheet.SetValue(row, col++, this.effectiveness);
- sheet.SetValue(row, col++, this.ignoreMultiHurt ? 1 : 0);
- sheet.SetValue(row, col++, this.removeFunWhenStop ? 1 : 0);
- }
- public SecurityElement SaveFrameEventToXml()
- {
- if (actionEventData == null) return null;
- SecurityElement buffNode = new SecurityElement("buff");
- buffNode.AddAttribute("id", this.actionEventData.Id.ToString());
- buffNode.AddAttribute("name", this.actionEventData.Name);
- buffNode.AddAttribute("endFrame", this.actionEventData.TotalFrame.ToString());
- buffNode.AddAttribute("gender", this.actionEventData.Gender.ToString());
- if(this.actionEventData.ActionEventList!=null)
- {
- for(int idx =0; idx < this.actionEventData.ActionEventList.Count;idx++)
- {
- ActionEventParamEditor eventData = this.actionEventData.ActionEventList[idx];
- SecurityElement eventNode = eventData.SaveCfgToXml();
- buffNode.AddChild(eventNode);
- }
- }
- return buffNode;
- }
- public SecurityElement SaveFemaleFrameEventToXml()
- {
- if (femaleActionEventData == null) return null;
- SecurityElement buffNode = new SecurityElement("buff");
- buffNode.AddAttribute("id", this.femaleActionEventData.Id.ToString());
- buffNode.AddAttribute("name", this.femaleActionEventData.Name);
- buffNode.AddAttribute("endFrame", this.femaleActionEventData.TotalFrame.ToString());
- buffNode.AddAttribute("gender", this.femaleActionEventData.Gender.ToString());
- if (this.femaleActionEventData.ActionEventList != null)
- {
- for (int idx = 0; idx < this.femaleActionEventData.ActionEventList.Count; idx++)
- {
- ActionEventParamEditor eventData = this.femaleActionEventData.ActionEventList[idx];
- SecurityElement eventNode = eventData.SaveCfgToXml();
- buffNode.AddChild(eventNode);
- }
- }
- return buffNode;
- }
- }
- public class SkillAsset
- {
- public int uniqueId;
- public int skillId;
- public int skillLv;
- public string skillName;
- public string skillDesc;
- public string skillIcon;
- public int skillType;
- public int cost;
- public int jobType;
- public int jobBranch;
- public int jobStage;
- public float fixedSingTime;
- public float changeSingTime;
- public float preCastingTime;
- public float castingTime;
- public float afterCastingTime;
- public float cd;
- public bool hide;
- public string levelUpDesc;
- public float[] PerceptionRange = new float[6];
- public List<int> buffIdList;
- public List<BuffDataAsset> buffList;
- public bool bAddNewBuff = false;
- public bool extendPerceptionFold = false;
- public bool extendBuffFold = true;
- public int iconIdx = -1;
- public SkillAsset()
- {
- this.skillId = 0;
- }
- public void AddNewBuff(BuffDataAsset buffData)
- {
- if (buffList == null)
- buffList = new List<BuffDataAsset>();
- buffList.Add(buffData);
- }
- public void RemoveBuff(BuffDataAsset buffData)
- {
- if (buffList == null || buffData == null) return;
- for(int idx =0; idx < buffList.Count;idx++)
- {
- if(buffList[idx].id == buffData.id)
- {
- buffList.RemoveAt(idx);
- return;
- }
- }
- }
- public BuffDataAsset GetBuffData(int buffId)
- {
- if (buffList == null) return null;
- for(int idx =0; idx < buffList.Count;idx++)
- {
- if (buffList[idx].id == buffId) return buffList[idx];
- }
- return null;
- }
- public void AddFunEventToBuff(int buffId, FunctionDataAsset funAsset)
- {
- BuffDataAsset buffData = GetBuffData(buffId);
- if (buffData == null) return;
- if (buffData.funList == null)
- buffData.funList = new List<FunctionValData>();
- FunctionValData newFunVal = new FunctionValData(funAsset.id, 0, 0, 0, 0, 0, 0);
- buffData.funList.Add(newFunVal);
- }
- public void Copy(SkillAsset src)
- {
- if (src == null) return;
- this.uniqueId = src.uniqueId;
- this.skillId = src.skillId;
- this.skillLv = src.skillLv;
- this.skillName = src.skillName;
- this.skillDesc = src.skillDesc;
- this.skillIcon = src.skillIcon;
- this.skillType = src.skillType;
- this.cost = src.cost;
- this.jobType = src.jobType;
- this.jobBranch = src.jobBranch;
- this.jobStage = src.jobStage;
- this.fixedSingTime = src.fixedSingTime;
- this.changeSingTime = src.changeSingTime;
- this.preCastingTime = src.preCastingTime;
- this.castingTime = src.castingTime;
- this.afterCastingTime = src.afterCastingTime;
- this.cd = src.cd;
- this.hide = src.hide;
- this.levelUpDesc = src.levelUpDesc;
- for (int idx = 0; idx < src.PerceptionRange.Length; idx++)
- this.PerceptionRange[idx] = src.PerceptionRange[idx];
- if (buffList == null)
- buffList = new List<BuffDataAsset>();
- buffList.Clear();
- if (src.buffList != null && src.buffList.Count > 0)
- {
- for(int idx =0; idx < src.buffList.Count;idx++)
- {
- BuffDataAsset srcBuffdata = src.buffList[idx];
- BuffDataAsset buff = new BuffDataAsset();
- buff.Copy(srcBuffdata);
- buffList.Add(buff);
- }
- }
- this.iconIdx = src.iconIdx;
- }
- public void Apply(SkillAsset src)
- {
- this.skillId = src.skillId;
- this.skillLv = src.skillLv;
- this.skillName = src.skillName;
- this.skillDesc = src.skillDesc;
- this.skillIcon = src.skillIcon;
- this.skillType = src.skillType;
- this.cost = src.cost;
- this.jobType = src.jobType;
- this.jobBranch = src.jobBranch;
- this.jobStage = src.jobStage;
- this.fixedSingTime = src.fixedSingTime;
- this.changeSingTime = src.changeSingTime;
- this.preCastingTime = src.preCastingTime;
- this.castingTime = src.castingTime;
- this.afterCastingTime = src.afterCastingTime;
- this.cd = src.cd;
- this.hide = src.hide;
- this.levelUpDesc = src.levelUpDesc;
- for (int idx = 0; idx < src.PerceptionRange.Length; idx++)
- this.PerceptionRange[idx] = src.PerceptionRange[idx];
- if (src.buffList != null && src.buffList.Count > 0)
- {
- for (int idx = 0; idx < src.buffList.Count; idx++)
- {
- BuffDataAsset srcBuff = src.buffList[idx];
- BuffDataAsset buff = GetBuffData(srcBuff.id);
- if(buff == null)
- {
- buff = new BuffDataAsset();
- buff.Copy(srcBuff);
- buffList.Add(buff);
- }
- else
- {
- buff.Apply(srcBuff);
- }
- }
- }
- for(int idx = buffList.Count -1; idx>=0; idx--)
- {
- BuffDataAsset buff = src.GetBuffData(buffList[idx].id);
- if(buff == null)
- {
- this.buffList.RemoveAt(idx);
- }
- }
- this.iconIdx = src.iconIdx;
- }
- public static SkillAsset CreateSkillAsset(ExcelWorksheet sheet,int rowIndex)
- {
- int colIndex = 1;
- SkillAsset skill = new SkillAsset();
- skill.uniqueId = sheet.GetValue<int>(rowIndex, colIndex++);
- skill.skillId = sheet.GetValue<int>(rowIndex, colIndex++);
- skill.skillName = sheet.GetValue<string>(rowIndex, colIndex++);
- skill.skillDesc = sheet.GetValue<string>(rowIndex, colIndex++);
- skill.skillIcon = sheet.GetValue<string>(rowIndex, colIndex++);
- skill.skillLv = sheet.GetValue<int>(rowIndex, colIndex++);
- skill.skillType = sheet.GetValue<int>(rowIndex, colIndex++);
- skill.cost = sheet.GetValue<int>(rowIndex, colIndex++);
- skill.jobType = sheet.GetValue<int>(rowIndex, colIndex++);
- skill.jobBranch = sheet.GetValue<int>(rowIndex, colIndex++);
- skill.jobStage = sheet.GetValue<int>(rowIndex, colIndex++);
- skill.fixedSingTime = sheet.GetValue<float>(rowIndex, colIndex++);
- skill.changeSingTime = sheet.GetValue<float>(rowIndex, colIndex++);
- skill.preCastingTime = sheet.GetValue<float>(rowIndex, colIndex++);
- skill.castingTime = sheet.GetValue<float>(rowIndex, colIndex++);
- skill.afterCastingTime = sheet.GetValue<float>(rowIndex, colIndex++);
- skill.cd = sheet.GetValue<float>(rowIndex, colIndex++);
- string buffStr = sheet.GetValue<string>(rowIndex, colIndex++);
- if (!string.IsNullOrEmpty(buffStr))
- {
- skill.buffIdList = StringUtil.convert2IntList(buffStr, ';');
- }
- for (int idx = 0; idx <= 5; idx++)
- {
- skill.PerceptionRange[idx] = sheet.GetValue<float>(rowIndex, colIndex++);
- }
- skill.hide = sheet.GetValue<int>(rowIndex, colIndex++) > 1 ? true : false;
- skill.levelUpDesc = sheet.GetValue<string>(rowIndex, colIndex++);
- return skill;
- }
- public void SaveAssetToExcel(ref ExcelWorksheet sheet, int row)
- {
- int col = 1;
- Debug.Log("skillId:" + this.skillId + " LV:" + this.skillLv);
- this.uniqueId = this.skillId * 100 + this.skillLv;
- sheet.SetValue(row, col++,this.uniqueId);
- sheet.SetValue(row, col++, this.skillId);
- sheet.SetValue(row, col++, this.skillName);
- sheet.SetValue(row, col++, this.skillDesc);
- sheet.SetValue(row, col++, this.skillIcon);
- sheet.SetValue(row, col++, this.skillLv);
- sheet.SetValue(row, col++, this.skillType);
- sheet.SetValue(row, col++, this.cost);
- sheet.SetValue(row, col++, this.jobType);
- sheet.SetValue(row, col++, this.jobBranch);
- sheet.SetValue(row, col++, this.jobStage);
- sheet.SetValue(row, col++, string.Format("{0:F}",this.fixedSingTime));
- sheet.SetValue(row, col++, string.Format("{0:F}", this.changeSingTime));
- sheet.SetValue(row, col++, string.Format("{0:F}", this.preCastingTime));
- sheet.SetValue(row, col++, string.Format("{0:F}", this.castingTime));
- sheet.SetValue(row, col++, string.Format("{0:F}", this.afterCastingTime));
- sheet.SetValue(row, col++, this.cd);
- string buffStr = "";
- if(buffList!=null)
- {
- for(int idx =0; idx < buffList.Count;idx++)
- {
- if (idx == 0)
- buffStr = buffList[idx].id.ToString();
- else
- buffStr = buffStr+";"+ buffList[idx].id.ToString();
- }
- }
- sheet.SetValue(row, col++, buffStr);
- for(int idx =0; idx <= 5;idx++)
- {
- sheet.SetValue(row, col++, PerceptionRange[idx]);
- }
- sheet.SetValue(row, col++, this.hide ? 1: 0);
- sheet.SetValue(row, col++, this.levelUpDesc);
- }
- }
|