public void CreateUserCharacterCommand(Player player, int index) { userCharacterService.saveUserCharacter(player); UserCharacter userCharacter = userCharacterService.createNewUserCharacter(player, index); applyChar(player, userCharacter); }
void AddCharacter(UserCharacter userCharacter) { var character = CampCharacter.Instantiate(userCharacter); character.transform.SetParent(_worldRoot, false); character.OnSelectCallback += OnSelectCharacter; _characters[userCharacter.Id] = character; }
/// <summary> /// 返回创建人物故事卡 /// </summary> private void CreateCharacter() { UserCharacter character = new UserCharacter() { ID = Guid.NewGuid(), UserId = GetUserId(), IsActivate = true, }; _context.UserCharacter.Add(character); UserSchedule schedule = new UserSchedule() { ID = Guid.NewGuid(), CharacterID = character.ID, StoryCardID = new DefaultValue().createCharacter, StorySeriesID = new DefaultValue().ScreateCharacter, IsMain = true, IsStory = true, }; _context.UserSchedule.Add(schedule); _context.SaveChanges(); ViewBag.ReadList = _context.StoryCard.AsNoTracking().Include(a => a.StoryOptions).AsNoTracking().SingleOrDefault(a => a.ID == new DefaultValue().createCharacter); ViewBag.InLocation = false; }
public void ChooseUserCharacterCommand(Player player, int index) { userCharacterService.saveUserCharacter(player); UserCharacter userCharacter = userCharacterService.loadUserCharacterById(index); applyChar(player, userCharacter); }
protected void Page_Load(object sender, EventArgs e) { // Block Page if we haven't selected a Character if (Session["activeCharacter"] != null) { // find active character int activeCharacter = (int)Session["activeCharacter"]; // pull their info + their fights Character = Utilities.FindCharacter(activeCharacter); fRecs = (Utilities.FindFights(activeCharacter)); } else if (Session["loggedin"] != null) { // redirect to character select page Response.BufferOutput = true; Response.Redirect("~/Character/"); } else { // redirect to login page Response.BufferOutput = true; Response.Redirect("~/Account/Login"); } }
/// <summary> /// 执行道具效果 /// </summary> private void ExeEffect(Guid itemID) { Item item = _context.Item.AsNoTracking().Where(a => a.ID == itemID).First(); UserSchedule schedule = _context.UserSchedule.Where(a => a.UserID == GetUserId() && a.IsMain == true).First(); UserCharacter character = _context.UserCharacter.Where(a => a.ID == schedule.CharacterID).First(); var characterItem = _context.CharacterItem.Where(a => a.CharacterID == character.ID && a.ID == itemID).First(); exeeffect(item.EffectClass1, item.EffectName1, item.EffectType1, item.EffectValue1, character, schedule); exeeffect(item.EffectClass2, item.EffectName2, item.EffectType2, item.EffectValue2, character, schedule); exeeffect(item.EffectClass3, item.EffectName3, item.EffectType3, item.EffectValue3, character, schedule); exeeffect(item.EffectClass4, item.EffectName4, item.EffectType4, item.EffectValue4, character, schedule); exeeffect(item.EffectClass5, item.EffectName5, item.EffectType5, item.EffectValue5, character, schedule); characterItem.Amount--; _context.SaveChanges(); }
protected void Page_Load(object sender, EventArgs e) { try { // Block Page if we haven't selected a Character if (Session["activeCharacter"] != null) { // pull out the friendlyURL variable telling us who what battle we're looking at fRecord = Utilities.FindFight(int.Parse(Page.RouteData.Values["var"].ToString())); // so we have a character selected, now we make sure it's involved in the fight if (fRecord.IsInvolved((int)Session["activeCharacter"])) { // find our character Character = Utilities.FindCharacter(fRecord.GetOwnedBy((int)Session["currentUser"])); // find opponent Opponent = Utilities.FindCharacter(fRecord.GetNOT(Character.Id)); } else { // redirect to BattleSummary page Response.BufferOutput = true; Response.Redirect("~/BattleSummary/"); } } else if (Session["loggedin"] != null) { // redirect to character select page Response.BufferOutput = true; Response.Redirect("~/Character/"); } else { // redirect to login page Response.BufferOutput = true; Response.Redirect("~/Account/Login"); } } catch { // if we're missing our variable we've hit an error Response.BufferOutput = true; Response.Redirect("~/Shared/ErrorPage"); } }
/// <summary> /// 清除该用户之前的故事记录 /// </summary> /// <param name="SeriesID"></param> /// <param name="userid"></param> private void CleanStory(string SeriesID, Guid userid) { //清除上次运行数据 UserSchedule UserSchedule = _context.UserSchedule.Where(a => a.UserID == userid && a.StorySeriesID == Guid.Parse(SeriesID)).FirstOrDefault(); UserCharacter userCharacter = null; List <CharacterItem> characterItem = new List <CharacterItem>(); if (UserSchedule != null) { userCharacter = _context.UserCharacter.Where(a => a.UserId == userid && a.ID == UserSchedule.CharacterID).FirstOrDefault(); } if (userCharacter != null) { characterItem = _context.CharacterItem.Where(a => a.CharacterID == userCharacter.ID).ToList(); } if (UserSchedule != null) { _context.Remove(UserSchedule); } if (userCharacter != null) { _context.Remove(userCharacter); } if (characterItem.Count > 0) { _context.RemoveRange(characterItem); } //清除旧状态 var statuslist = _context.CharacterStatus.Where(a => a.StorySeries == SeriesID && a.UserID == userid).ToList(); if (statuslist.Count > 0) { _context.CharacterStatus.RemoveRange(statuslist); } //清楚随机数记录 var random = _context.StoryCardRandom.Where(a => a.UserID == GetUserId() && a.StorySeriesID == Guid.Parse(SeriesID)).ToList(); if (random.Count > 0) { _context.StoryCardRandom.RemoveRange(random); } _context.SaveChanges(); }
private UserCharacter CreateCharacter(Guid UserID, Guid StorySeriesID) { UserCharacter character = new UserCharacter() { ID = Guid.NewGuid(), UserId = UserID, CharacterName = string.Empty, IsActivate = true, ActionPoints = 5, Lucky = 5, Speed = 5, Strength = 5, Intelligence = 5, Experience = 5, Status = 5, Moral = 5 }; return(character); }
private void applyChar(Player player, UserCharacter userCharacter) { if (userCharacter == null) { return; } player.SetData <int>("CHARID", userCharacter.ID); Vector3 spawnPos = new Vector3() { X = userCharacter.X, Y = userCharacter.Y, Z = userCharacter.Z, }; Vector3 spawnRot = new Vector3() { X = userCharacter.RX, Y = userCharacter.RY, Z = userCharacter.RZ }; NAPI.Entity.SetEntityPosition(player, spawnPos); NAPI.Entity.SetEntityRotation(player, spawnRot); player.SetClothes(1, userCharacter.CSlot1, 0); }
public void Update(UserCharacter userCharacter) { throw new NotImplementedException(); }
public static CampCharacter Instantiate(UserCharacter character) { var ret = Assets._.CampCharacter.Instantiate(); ret._data = character.Data; return ret; }