void onClick(GameObject e) { switch (e.name) { case "RandomBtn": randomName(); break; case "CreateBtn": if (NameInputField.text.Length == 0) { AlertCtrl.Show("称谓不能为空!"); return; } if (NameInputField.text.Length > 6) { AlertCtrl.Show("称谓不能超过6个字!"); return; } ConfirmCtrl.Show(string.Format("<color=\"{0}\">{1}</color>以后就是你的称谓,确定后不可更改", Statics.GetGenderColor(genderType), NameInputField.text), () => { RoleData role = new RoleData(); role.Id = hostRoleId; role.Name = NameInputField.text; role.Gender = genderType; role.IsHost = true; // role.ResourceWeaponDataId = "1"; //默认武器是布缠手 role.Occupation = OccupationType.None; role.IconId = IconImages[iconIndex].sprite.name; role.DeadSoundId = role.Gender == GenderType.Male ? "die0003" : "die0002"; Messenger.Broadcast <RoleData>(NotifyTypes.CreateHostRole, role); }, null, "确定", "取消"); break; default: break; } }
public void UpdateData(RoleData role) { roleData = role; roleData.Init(); desc = string.Format("称谓:{0}\n门派:{1}\n地位:{2}", roleData.Name, Statics.GetOccupationName(roleData.Occupation), roleData.IsHost ? ("当家" + string.Format("(<color=\"{0}\">{1}</color>)", Statics.GetGenderColor(roleData.Gender), Statics.GetGenderDesc(roleData.Gender))) : "门客"); info = string.Format("状态:{0}\n气血:{1}/{2}\n外功:{3}\n外防:{4}\n内功:{5}\n内防:{6}\n攻速:{7}\n轻功:{8}\n{9}", Statics.GetInjuryName(roleData.Injury), roleData.HP, roleData.MaxHP, roleData.PhysicsAttack, roleData.PhysicsDefense, roleData.MagicAttack, roleData.MagicDefense, roleData.AttackSpeed, roleData.Dodge, roleData.Desc == "" ? "" : "人物介绍:\n" + roleData.Desc); }