public Sprite GetPSprite(PHIPart part) { Sprite ret = null; var tempHeadIcon = GetHeadIcon(); if (tempHeadIcon.ContainsKey(part)) { //获得原始Key string temp = tempHeadIcon[part]; if (temp.IsInv()) { return(null); } //身份(职业)加工(自定义处理)身份加工 string sourcePartKey = OnProcessIdentity(part, temp); string addPartKey = sourcePartKey; //隐藏设置 if (OnProcessHide(part)) { return(null); } //加工年龄 addPartKey = OnProcessAge(part, addPartKey); //获得图片 ret = GRMgr.Head.Get(addPartKey, false); if (ret == null) { ret = GRMgr.Head.Get(sourcePartKey, true); } //记录ID if (ret != null) { if (LastPartIDs.ContainsKey(part)) { LastPartIDs[part] = sourcePartKey; } else { LastPartIDs.Add(part, sourcePartKey); } } else { LastPartIDs.Remove(part); } return(ret); } else { throw new NotImplementedException("没有这个部分:" + part.ToString()); } }
//自定义隐藏(比如年轻的时候隐藏胡子) protected virtual bool OnProcessHide(PHIPart part) { if (part == PHIPart.PBeard) { if (AgeRange == AgeRange.Child) { return(true); } if (Gender == Gender.Female) { return(true); } } else if (part == PHIPart.PDecorate) { if (AgeRange == AgeRange.Child) { return(true); } } return(false); }
protected virtual string OnProcessAge(PHIPart part, string inputStr) { inputStr = inputStr + "_" + AgeRange.ToString(); return(inputStr); }
//自定义身份加工 protected virtual string OnProcessIdentity(PHIPart part, string source) { return(source); }