public void GenerateVisuals() { gameObject.SetActive(false); string torsoid = Race.ToString() + " " + Profession.ToString() + " Torso"; string headid = Race.ToString() + " " + Profession.ToString() + " Head " + Random.Range(1, 4); var path = "Sprites/" + torsoid; Debug.Log(path); var torsoSprite = Resources.Load <Sprite>(path); path = "Sprites/" + headid; Debug.Log(path); var headSprite = Resources.Load <Sprite>(path); ApplySprites(headSprite, torsoSprite); if (Race.Halfling != Race) { string torsoMatId = "Materials/NPCMaterial"; TorsoImage.material = Resources.Load <Material>(torsoMatId); Debug.Log(torsoMatId); } string headMatId = "Materials/NPCMaterial"; Debug.Log(headMatId); HeadImage.material = Resources.Load <Material>(headMatId); }
public static string GetDescription(Profession val) { FieldInfo fi = val.GetType().GetField(val.ToString()); if (fi != null) { object[] profs = fi.GetCustomAttributes(typeof(DescriptionAttribute), true); if (profs != null && profs.Length > 0) { return(((DescriptionAttribute)profs[0]).Description); } } return(val.ToString()); }
public string ToString(bool verbose) { if (verbose) { string output = null; output = "Name: " + Name + "\n"; output += "Age: " + Age + "\n"; output += "Birthdate: " + Birthday.ToString(true) + " under " + PatronConstellation.TranslateConstellation() + "\n"; output += CharacterProfession.ToString(true) + "\n"; foreach (Trait trait in CharacterTraits) { output += trait.GetName() + ": " + trait.GetTier() + " at " + trait.GetValue() + "\n"; } foreach (Ability ability in CharacterAbilities) { output += ability.GetName() + ": " + ability.GetValue() + "\n"; } output += string.Format("Skills[{0}]: ", SkillSlots); foreach (Skill skill in CharacterSkills) { output += skill + ": " + skill.GetDescription() + " "; } output += string.Format("Idiosyncracy Severity: {0} \n Quirk: {1} : {2} | Flaw: {3} : {4}", CharacterFlaw.GetSeverity(), CharacterQuirk, CharacterQuirk.GetDescription(), CharacterFlaw, CharacterFlaw.GetDescription()); return(output); } else { return(ToString()); } }
public void Default() { // Arrange var wisdom = Mock.Of <IAbilityScore>(); var mockAbilityScores = new Mock <IAbilityScoreSection>(); mockAbilityScores.Setup(abs => abs.Wisdom) .Returns(wisdom); var mockCharacter = new Mock <ICharacter>(); mockCharacter.Setup(c => c.AbilityScores) .Returns(mockAbilityScores.Object); string professionType = "Superhero"; // Act var profession = new Profession(mockCharacter.Object, professionType); // Assert Assert.AreSame(wisdom, profession.KeyAbilityScore); Assert.AreEqual("Profession (Superhero)", profession.ToString()); Assert.IsFalse(profession.ArmorCheckPenaltyApplies); Assert.IsFalse(profession.CanBeUsedUntrained); }
// init demographics void initProfession(int professionID, int Ammount) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); // Type type = getProfession(professionID); Profession prof = (Profession)professionID; for (int j = 0; j < Ammount; j++) { // try { // Person temp = (Person)Activator.CreateInstance(type); // Population.Add(temp); // Demographics[professionID].Add(temp); // } catch (Exception e) { // Console.WriteLine("Error: Could not initialize Person from type"); // Console.WriteLine(e); // } Person temp = prof.ToPerson(); Population.Add(temp); Demographics[professionID].Add(temp); } // test Console.WriteLine(prof.ToString() + "\t" + stopwatch.Elapsed.TotalMilliseconds.ToString()); }
void ChangeClass(int index) { m_class = (Profession)(index + 1); m_classText.text = m_class.ToString(); if (m_roles[index] == null) { m_roles[index] = Core.Database.LoadResource("Roles/" + m_class.ToString()); } for (int i = 0; i < m_roles.Length; i++) { if (m_roles[i] != null) { m_roles[i].SetActive(index == i); } m_classButtons[i].interactable = index != i; } }
/// <summary> /// override the default greeting in the Character class to include the job title /// set the proper article based on the job title /// </summary> /// <returns>default greeting</returns> public override string DefaultGreeting() { string article = "a"; List <string> vowels = new List <string>() { "A", "E", "I", "O", "U" }; if (vowels.Contains(_jobTitle.ToString().Substring(0, 1))) { article = "an"; } return($"Hello, my name is {_name} and I am {article} {_jobTitle} for the Aion Project."); }
// helper : cast int to Person type Type getProfession(int professionID) { Type type = null; try { // cast the current proffesion Profession prof = (Profession)professionID; // cast it to type type = Type.GetType(prof.ToString()); } catch (Exception e) { Console.WriteLine("Error: Could not cast Profession"); Console.WriteLine("Log: Happened in {0}-ava Profession", ((Profession)professionID).ToString()); Console.WriteLine(e); } return(type); }
void Start() { worldObject = GameObject.Find("World"); world = worldObject.GetComponent <WorldScript>(); canvasObject = GameObject.Find("Canvas"); highlightObject = transform.Find("Highlight").gameObject; highlightObject.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0.5f); OwnedLands = new List <GameObject>(); //AgentProfession = Profession.Unemployed; AgentName = "Another " + AgentProfession.ToString(); InitAgentUI(); animator = GetComponent <Animator>(); SetAgentSprite(); }
/// <summary> /// 綁定窗口DM,获取客户端大小,启动提示消除Timer,获取人物职业 /// </summary> /// <param name="className">類名</param> /// <returns>0失敗,1成功</returns> public int BindDM(string className, int pid, int handle) { Log("BindDM:" + className + ",pid:" + pid.ToString() + ",handle:" + handle.ToString()); int ret = 0; IntPtr p = IntPtr.Zero; if (pid == 0 && handle == 0) { p = FindWindow(className, null); if (p == IntPtr.Zero) { Log("BindDM:" + "找不到窗口,类名:" + className); throw new Exception("找不到窗口,类名:" + className); } } else { if (handle != 0) p = new IntPtr(handle); else { p = GetMainWindowHandle(pid); } } hwnd = p.ToInt32(); //dm.SetWindowState(p.ToInt32(), 1);//激活窗口 Thread.Sleep(200); //ret = dm.BindWindow(p.ToInt32(), "normal", "windows", "windows", 0); ret = dm.BindWindow(hwnd, "dx2", "dx", "dx", 0); Log("BindWindow"); if (ret == 0) { throw new Exception("绑定失败"); } //ret = dm.LockInput(1); object w, h; ret = dm.GetClientSize(hwnd, out w, out h); if (ret == 0) { throw new Exception("获取窗口客户区失败"); } clientH = (int)h; clientW = (int)w; Thread.Sleep(200); Log("客户区域,W:" + clientW.ToString() + ";H:" + clientH.ToString()); pro = GetUserProfession(); ProDtInfo = GetProfessionDtInfo(pro); Log("职业:" + pro.ToString()); //CNoticeTimer.Start(); return ret; }
public string GetProfessionName() { return(_proffesion.ToString()); }
public static Task <ProfessionInfo> Professions(Profession ID) { return(Builder.AddDirective("professions") .AddDirective(ID.ToString()) .RequestAsync <ProfessionInfo>()); }
public void RenderTo(GameObject uiPrefab) { // Level txt uiPrefab.transform.Find("H/Level").GetComponent <Text>().text = mLevel.ToString(); // Profession Sprite professionSprite = Utilities.GetSpriteManager().GetSprite(Profession == PersonAttribute.NONE ? "NO_PROFESSION" : Profession.ToString()); uiPrefab.transform.Find("H/Profession/Image").GetComponent <Image>().sprite = professionSprite; // Attributes List <PersonAttribute> attributes = NonProfessionAttributes; if (attributes.Count > 2) { Debug.Log("WARNING: a person has >2 attributes!"); } for (int i = 0; i < 2; i++) { Image attrImage = uiPrefab.transform.Find("H/V/Attribute" + (i + 1).ToString()).GetComponent <Image>(); attrImage.enabled = (i < attributes.Count); if (i < attributes.Count) { attrImage.sprite = Utilities.GetSpriteManager().GetSprite(attributes[i]); } } // HP / XP bars uiPrefab.transform.Find("H/HP/Bar").localScale = new Vector3(1f, mHealth / MaxHealth, 1f); if (mLevel == GameState.GetLevelCap(Profession)) { uiPrefab.transform.Find("H/XP/Bar").localScale = new Vector3(1f, 1f, 1f); uiPrefab.transform.Find("H/XP/Bar").GetComponent <Image>().color = new Color(.7f, .7f, .7f); } else { uiPrefab.transform.Find("H/XP/Bar").GetComponent <Image>().color = new Color(1f, 1f, 0f); uiPrefab.transform.Find("H/XP/Bar").localScale = new Vector3(1f, GetLevelUpProgressPercent() / 100f, 1f); } // Highlight uiPrefab.transform.Find("Background").GetComponent <Outline>().enabled = IsHighlighted(); }