// Use this for initialization void Start() { foreach (PlayMakerFSM fsm in PlayMakerFSM.FsmList) { if (fsm.name == "PetRunFSM") { PetRunFSM = fsm; break; } } //Placeholder for getting the current pet interface currentPet = GameObject.Find("Pet").GetComponent(typeof(IPet)) as IPet; //Initializes the list of available pet states if (PetRunFSM != null) { GameObject petStates = GameObject.Find("PetStates"); Object[] oStates = petStates.GetComponents(typeof(PetState)); foreach (object o in oStates) { states.Add(o as PetState); (o as PetState).SetMyPet(currentPet); //Sets up all the states to refer to the correct IPet script } } }
/// <summary> /// 设置宠物技能 /// </summary> void SetPetSkill() { LearnSkillDataManager data = DataManager.Manager <LearnSkillDataManager>(); gameObject.SetActive(data.bShowPetSkill); PetDataManager petData = DataManager.Manager <PetDataManager>(); if (petData != null) { IPet pet = petData.GetPetByThisID(petData.CurFightingPet); if (pet != null) { List <PetSkillObj> list = pet.GetPetSkillList(); if (list.Count == 0) { skillIcon.mainTexture = null; SetLongPressEvent(false); ShowAdd(true); return; } for (int i = 0; i < list.Count; i++) { var skill = list[i]; uint skillID = (uint)skill.id; SkillDatabase db = GameTableManager.Instance.GetTableItem <SkillDatabase>(skillID, skill.lv); if (db != null) { if (db.petType == (int)PetSkillType.Initiative) { m_skillid = skillID; UIManager.GetTextureAsyn(DataManager.Manager <UIManager>().GetResIDByFileName(false, db.iconPath, true), ref iuiIconAtlas, () => { if (null != skillIcon) { skillIcon.mainTexture = null; } }, skillIcon, false); ShowAdd(false); SetLongPressEvent(true); break; } else { SetLongPressEvent(false); ShowAdd(true); skillIcon.mainTexture = null; } } } } } if (data.bShowPetSkill) { RunCD(); } }
public Memento(string filepath) { var savedState = DataSerializer.DeserializeState(filepath); InventoryState = savedState.InventoryState; WalletState = savedState.WalletState; PetState = savedState.PetState; }
public IStudent CreateStudent(string name, IPet pet) { var studentType = GenerateStudentype(); var otherCompetance = GenerateOtherCompetance(); var knowledge = GenerateInitialKnowedge(studentType, otherCompetance); return(new Student(name, pet, studentType, otherCompetance, knowledge)); }
public Student(string name, IPet pet, StudentType studentType, OtherCompetence otherCompetance, IKnowledge knowledge) : base(name, Student.StudentBaseHp) { this.studentType = studentType; this.otherCompetence = otherCompetance; this.Knowledge = knowledge; this.pet = pet; this.IsAlive = true; }
public IStudent CreateStudent(string name, IPet pet) { var studentType = GenerateStudentype(); var otherCompetance = GenerateOtherCompetance(); var knowledge = GenerateInitialKnowedge(studentType, otherCompetance); return new Student(name, pet, studentType, otherCompetance, knowledge); }
public async Task <IList <IEnvDataSample> > GetRangeByPet([NotNull] IPet pet, DateTime start, DateTime end) { return(await _context.EnvDataSamples .Include(sample => sample.RealOccupant) .Where(sample => sample.RealOccupant.Id == pet.Id) .Where(sample => sample.Captured >= start && sample.Captured < end) .Select(concrete => concrete as IEnvDataSample) .ToListAsync()); }
public void Exec() { IPet pet1 = FindPet_1(); //Avoiding the NullPointer Exception //pet1 is null IPet pet2 = FindPet_2(); //Pet2 is a Empty object }
private bool TryToAddPetInRoom(int index, IPet pet) { if (this.rooms[index] == null) { this.rooms[index] = pet; return(true); } return(false); }
public void Adopt(IPet pet) { pet.OwnersName = this.Name; Pets.Add(pet); foreach (var Pet in Pets) { Pet.NameSelf(); Console.WriteLine($"{Pet.Name} is owned by {Pet.OwnersName}"); } }
public async Task UpdateImage([NotNull] IPet pet, [NotNull] IBlobRecord imageRecord) { if (!(pet is Pet concretePet) || !(imageRecord is BlobRecord concreteRecord)) { throw new ArgumentException("Mismatched infrastructure components"); } concretePet.ProfileRecordEntity = concreteRecord; await _context.SaveChangesAsync(); }
public void AddPet(IPet pet) { if (Pets == null) { Pets = new List <IPet>(); } Pets.Add(pet); pet.Dono = this; }
public IPet GetPet(string[] args) { IPet pet = null; string name = args[1]; string birthdate = args[2]; pet = new Pet(name, birthdate); return(pet); }
private static void SetPropriedadesComuns(this IPet pet, List <Dono> donos, string[] colunas) { pet.Nome = colunas[1]; pet.Sexo = colunas[2] == "Macho" ? Sexo.Macho : Sexo.Femea; pet.Peso = double.Parse(colunas[4]); var dono = donos.GetDono(colunas[3]); dono.AddPet(pet); }
bool GetInheritXiuWeiLevel(out int level) { level = 0; IPet oldpet = petDataManager.GetInheritPet((int)PetInheritPos.Old); if (oldpet == null) { return(true); } IPet newpet = petDataManager.GetInheritPet((int)PetInheritPos.New); if (newpet == null) { return(true); } int oldPetLv = oldpet.GetProp((int)PetProp.YinHunLevel); uint oldExp = (uint)oldpet.GetProp((int)PetProp.YinHunExp); for (int i = 0; i < oldPetLv; i++) { PetYinHunDataBase udb = GameTableManager.Instance.GetTableItem <PetYinHunDataBase>((uint)i); if (udb != null) { oldExp += udb.lingQiMax; } } int newPetLv = newpet.GetProp((int)PetProp.YinHunLevel); uint newExp = (uint)newpet.GetProp((int)PetProp.YinHunExp); newExp += oldExp; level = newPetLv; while (newExp > 0) { PetYinHunDataBase udb = GameTableManager.Instance.GetTableItem <PetYinHunDataBase>((uint)level); if (udb != null) { if (newExp >= udb.lingQiMax) { level += 1; newExp -= udb.lingQiMax; } else { break; } } else { level -= 1; return(false); } } return(true); }
/// <summary> /// /// </summary> /// <param name="baseID">等于0时为第一次初始化</param> /// <returns></returns> int GetPetResID(int baseID = 0) { int resID = 0; List <SuitDataBase> petList = GetPetSuitData(); SuitDataBase petData = null; if (baseID == 0) { if (petList.Count == 0) { return(resID); } petData = petList[0]; PetDataManager pm = DataManager.Manager <PetDataManager>(); if (pm != null) { if (pm.CurFightingPet != 0) { IPet pet = pm.GetPetByThisID(pm.CurFightingPet); if (pet != null) { uint petBaseID = pet.PetBaseID; PetDataBase db = GameTableManager.Instance.GetTableItem <PetDataBase>(petBaseID); if (db != null) { resID = (int)db.modelID; } } } else { resID = (int)petData.resid; } } } else { for (int i = 0; i < petList.Count; i++) { if (baseID == petList[i].base_id) { petData = petList[i]; break; } } if (petData == null) { return(resID); } resID = (int)petData.resid; } return(resID); }
public void OnPetChangeName(stChangeNamePetUserCmd_CS cmd) { IPet pet = GetPetByThisID(cmd.id); if (pet != null) { // pet.SetName( cmd.name ); pet.SendMessage(EntityMessage.EntityCommond_SetName, cmd.name); } RefreshPetProp(); }
public bool Add(IPet pet) { if (!HasEmptyRooms) { return(false); } this.AddPetToRoom(pet); return(true); }
void InitOldPet(uint petID) { m_uPetOldThisID = petID; petDataManager.AddInhertPet((int)PetInheritPos.Old, petID); IPet pet = petDataManager.GetPetByThisID(petID); if (pet != null) { uint baseID = pet.PetBaseID; m_uOldPetBaseID = baseID; PetDataBase pdb = GameTableManager.Instance.GetTableItem <PetDataBase>(baseID); if (pdb != null) { m_label_Old_name.text = petDataManager.GetPetName(pet); //DataManager.Manager<UIManager>().SetSpriteDynamicIcon(m_sprite_Old_icon, pdb.icon); UIManager.GetTextureAsyn(pdb.icon, ref m_inheritOldIconAsynSeed, () => { if (null != m__Old_icon) { m__Old_icon.mainTexture = null; } }, m__Old_icon, false); string bgSpriteName = ItemDefine.GetItemFangBorderIconByItemID(pdb.ItemID); //DataManager.Manager<UIManager>().SetSpriteDynamicIcon(m_sprite_OldIconBox, bgSpriteName); UIManager.GetAtlasAsyn(bgSpriteName, ref m_inheritOldQuaAsynSeed, () => { if (null != m_sprite_OldIconBox) { m_sprite_OldIconBox.atlas = null; } }, m_sprite_OldIconBox, false); int oldLv = pet.GetProp((int)CreatureProp.Level); m_label_Old_level_Before.text = oldLv.ToString(); m_label_Old_level_After.text = "0"; m_label_Old_skill_Before.text = pet.GetPetSkillList().Count.ToString(); m_label_Old_skill_After.text = "0"; m_label_Old_xiuwei_Before.text = pet.GetProp((int)PetProp.YinHunLevel).ToString(); m_label_Old_xiuwei_After.text = "0"; PetInHeritDataBase idb = GetInHeritData(m_uNewPetBaseID); if (idb != null) { UIItem.AttachParent(m_sprite_ChuanChengCommon_icon_di.transform, idb.costItem, 0, InheritGetWayCallBack); ItemDataBase db = GameTableManager.Instance.GetTableItem <ItemDataBase>(idb.costItem); if (db != null) { m_label_ChuanChengCommon_name.text = db.itemName; } m_label_ChuanChengCommon_number.text = "0/0"; } m_btn_btn_Old_delete.gameObject.SetActive(true); } } }
public int GetPropByThisID(uint petThisID, PetProp propID) { IPet pet = GetPetByThisID(petThisID); if (pet != null) { return(pet.GetProp((int)propID)); } Log.Error("get pet prop failed propid is " + propID); return(-1); }
public bool AddPet(IPet pet) { using (IDal dal = new ProtoDBContext()) { var mapper = new ProtoPetMap(dal); var dbmodel = mapper.Map(pet as IModel); return dal.AddPet(dbmodel as ProtoPetModel); } }
void OnChuZhanClick(GameObject go) { Transform parent = go.transform.parent; if (parent != null) { string name = parent.name; if (!string.IsNullOrEmpty(name)) { char indexStr = name[name.Length - 1]; int index = -1; if (int.TryParse(indexStr.ToString(), out index)) { index -= 1; if (index != -1) { List <uint> petList = m_petData.GetUserQuicSettingList(); if (petList != null) { uint petid = petList[index]; if (petid == 0) { OnPetClick(null); //TipsManager.Instance.ShowTips( "没有设置" ); return; } IPet pet = m_petData.GetPetByThisID(petid); if (pet != null) { int life = pet.GetProp((int)PetProp.Life); if (life <= 0) { TipsManager.Instance.ShowTips(LocalTextType.Pet_Age_zhanhunshoumingbuzuwufachuzhan); //m_petData.ShowTips(108017); return; } if (petid == m_petData.CurFightingPet) { //Local_TXT_Notice_Pet_HasChuzhan TipsManager.Instance.ShowTips(LocalTextType.Local_TXT_Notice_Pet_HasChuzhan); //TipsManager.Instance.ShowTips("已经出战"); return; } stUseFightPetUserCmd_CS cmd = new stUseFightPetUserCmd_CS(); cmd.id = pet.GetID(); NetService.Instance.Send(cmd); } } } } } } }
public void RemovePet(IPet pet) { if (Pets == null) { return; } if (Pets.Remove(pet)) { pet.Dono = null; } }
public void Reset(bool depthClearData = false) { ReleaseRenderObj(); petDic.Clear(); curPetThisID = 0; curPet = null; skilldb = null; lockSkillNum = 0; curFightingPet = 0; petToNpcDic.Clear(); m_petQuickList.Clear(); }
public bool AddNewPet(IPet pet) { if (this.roomsRow.Count == 0) { return(false); } int currentRoom = this.roomsRow.Dequeue(); this.pets[currentRoom] = (Pet)pet; return(true); }
public async Task UpdateLatestSample(IPet pet, IEnvDataSample sample) { if (!(pet is Pet concretePet) || !(sample is EnvDataSample concreteSample)) { throw new ArgumentException("Mismatched infrastructure types"); } concretePet.LatestConcreteSample = concreteSample; // TODO: confirm pet is being tracked by context await _context.SaveChangesAsync(); }
static void Main(string[] args) { PetFactory factory = new PetFactory(); // creating factory IPet pet = factory.GetPet("Bow"); // factory instantiates an object // you don't know which object factory created Console.WriteLine(pet.PetSound()); pet = petFactory.GetPet("Meaw"); // factory instantiates another object Console.WriteLine(pet.PetSound()); Console.ReadLine(); }
public void AddStudent(string name) { IPet pet = this.petFactory.CreatePet(); IStudent student = this.studentFactory.CreateStudent(name, pet); this.students.Add(student); student.CantPassExam += this.ExamFailsObserver; logger.WriteLine(GlobalMessages.StudentWasAded(name)); // logger.WriteLine(student.Pet.HelpMe(student)); // NE TUK!!! }
public void LoadGame(int slotNumber) { if (slotNumber > 0 && slotNumber < 2) { var save = new Memento($"..\\..\\..\\Model\\ConstructionModules\\Saving\\SaveSlots\\{slotNumber}.txt"); _playerInventory = save.InventoryState; _playerWallet = save.WalletState; _tamagochi = save.PetState; _tamagochi.AttachListener(this); _tamagochi.RestartTimer(); } }
public Game(IGameContext context, AbstractTamagochiTimer timer, IPet pet) : base(context, timer) { Pet = pet; if (!context.IsDefault) { _isContextCreated = true; } Pet.PetDied += OnPetDying; State = _context.GameState; _gameTime = context.GameTime; _innerTime = context.InnerPetTime; }
void InitNewPet(uint petID) { m_uPetNewThisID = petID; petDataManager.AddInhertPet((int)PetInheritPos.New, petID); IPet pet = petDataManager.GetPetByThisID(petID); if (pet != null) { uint baseID = pet.PetBaseID; m_uNewPetBaseID = baseID; PetDataBase pdb = GameTableManager.Instance.GetTableItem <PetDataBase>(baseID); if (pdb != null) { m_label_New_name.text = petDataManager.GetPetName(pet); // DataManager.Manager<UIManager>().SetSpriteDynamicIcon(m_sprite_New_icon, pdb.icon); UIManager.GetTextureAsyn(pdb.icon, ref m_inheritNewIconAsynSeed, () => { if (null != m__New_icon) { m__New_icon.mainTexture = null; } }, m__New_icon, false); string bgSpriteName = ItemDefine.GetItemFangBorderIconByItemID(pdb.ItemID); //DataManager.Manager<UIManager>().SetSpriteDynamicIcon(m_sprite_NewIconBox, bgSpriteName); UIManager.GetAtlasAsyn(bgSpriteName, ref m_inheritNewQuaAsynSeed, () => { if (null != m_sprite_NewIconBox) { m_sprite_NewIconBox.atlas = null; } }, m_sprite_NewIconBox, false); int NewLv = pet.GetProp((int)CreatureProp.Level); m_label_New_level_Before.text = NewLv.ToString(); int lv = 0; GetInheritLevel(out lv); m_label_New_level_After.text = lv.ToString(); IPet oldpet = petDataManager.GetInheritPet((int)PetInheritPos.Old); if (oldpet != null) { m_label_New_skill_After.text = oldpet.GetPetSkillList().Count.ToString(); } m_label_New_skill_Before.text = pet.GetPetSkillList().Count.ToString(); m_label_New_xiuwei_Before.text = pet.GetProp((int)PetProp.YinHunLevel).ToString(); int yinhunLv = 0; GetInheritXiuWeiLevel(out yinhunLv); m_label_New_xiuwei_After.text = yinhunLv.ToString(); m_btn_btn_New_delete.gameObject.SetActive(true); } } }
void SetPetTalent(PetTalent pt, uint petid) { IPet pet = GetPetByThisID(petid); if (pet != null) { pet.SetProp((int)FightCreatureProp.Strength, (int)pt.liliang); pet.SetProp((int)FightCreatureProp.Corporeity, (int)pt.tizhi); pet.SetProp((int)FightCreatureProp.Intelligence, (int)pt.zhili); pet.SetProp((int)FightCreatureProp.Spirit, (int)pt.jingshen); pet.SetProp((int)FightCreatureProp.Agility, (int)pt.minjie); } }
public void OnPetGuiYuan(stTalentPetUserCmd_S cmd) { IPet pet = GetPetByThisID(cmd.id); if (pet != null) { ShowTipsEnum(LocalTextType.Pet_GuiYuan_guiyuanchenggong); //ShowTips(108510); SetPetTalent(cmd.talent, cmd.id); pet.SetProp((int)PetProp.PetGuiYuanStatus, cmd.guiyuanstatus); UpdatePetProp(); } }
public void SetMyPet(IPet _myPet) { myPet = _myPet; }
public bool UpdatePet(IPet pet) { return new ProtoDBCollections().UpdatePet(pet); }
public bool UpdatePet(IPet pet) { var dbModel = pet as ProtoPetModel; if (dbModel == null) return false; lock (petLock) { var existingModel = petList.SingleOrDefault(x => x.ID == dbModel.ID); if (existingModel == null) { return false; } existingModel.CopyMutableValues(dbModel); storePets(); return true; } }
public bool AddPet(IPet pet) { var dbModel = pet as ProtoPetModel; if (dbModel == null) return false; lock (petLock) { petList.Add(dbModel); storePets(); } return true; }
public virtual void AssertQuery(IList expected, IPet pet, string name) { IteratorAssert.SameContent(expected, Db().From(pet.GetType()).Where(pet.Name()).Equal (name).Select()); }
public bool AddPet(IPet pet) { return new ProtoDBCollections().AddPet(pet); }
public void PokePet(IPet pet) { pet.Speak(); }