private void Start()
 {
     if (AppStorage.Instance.CurrentCharacter != null)
     {
         if (AppStorage.Instance.CurrentCharacter.GetType() == typeof(DnDCharacter))
         {
             DnDCharacter character = AppStorage.Instance.CurrentCharacter as DnDCharacter;
             SelectedAlignment = character.Alignment;
         }
         else
         {
             SelectedAlignment = DnDAlignment.TrueNeutral;
         }
     }
     else
     {
         SelectedAlignment = DnDAlignment.TrueNeutral;
     }
     mPreviousSelected = (int)SelectedAlignment;
     if (ButtonBox != null)
     {
         for (int row = 0; row < mRows; ++row)
         {
             for (int column = 0; column < mColumns; ++column)
             {
                 Button button       = ButtonBox.transform.GetChild(row).GetChild(column).GetComponent <Button>();
                 int    notification = row * mRows + column;
                 button.onClick.AddListener(() => OnSelectedButtonChange(notification));
             }
         }
         OnSelectedButtonChange(mPreviousSelected);
     }
 }
Beispiel #2
0
		public static string ToViewString(DnDAlignment alignment)
		{
			switch (alignment)
			{
				case DnDAlignment.TrueNeutral:
					return "True Neutral";
				case DnDAlignment.NeutralGood:
					return "Neutral Good";
				case DnDAlignment.NeutralEvil:
					return "Neutral Evil";
				case DnDAlignment.LawfulNeutral:
					return "Lawful Neutral";
				case DnDAlignment.LawfulGood:
					return "Lawful Good";
				case DnDAlignment.LawfulEvil:
					return "Lawful Evil";
				case DnDAlignment.ChaoticNeutral:
					return "Chaotic Neutral";
				case DnDAlignment.ChaoticGood:
					return "Chaotic Good";
				case DnDAlignment.ChaoticEvil:
					return "Chaotic Evil";
				default:
					return alignment.ToString();
			}
		}
		private void Start()
		{
			if (AppStorage.Instance.CurrentCharacter != null)
			{
				if (AppStorage.Instance.CurrentCharacter.GetType() == typeof(DnDCharacter))
				{
					DnDCharacter character = AppStorage.Instance.CurrentCharacter as DnDCharacter;
					SelectedAlignment = character.Alignment;
				}
				else
				{
					SelectedAlignment = DnDAlignment.TrueNeutral;
				}
			}
			else
			{
				SelectedAlignment = DnDAlignment.TrueNeutral;
			}
			mPreviousSelected = (int)SelectedAlignment;
			if (ButtonBox != null)
			{
				for (int row = 0; row < mRows; ++row)
				{
					for (int column = 0; column < mColumns; ++column)
					{
						Button button = ButtonBox.transform.GetChild(row).GetChild(column).GetComponent<Button>();
						int notification = row * mRows + column;
						button.onClick.AddListener(() => OnSelectedButtonChange(notification));
					}
				}
				OnSelectedButtonChange(mPreviousSelected);
			}
		}
Beispiel #4
0
 public DnDDeity(string name, List <string> altNames, DnDAlignment alignment, List <DnDRace> races, List <DnDCharClass> classes, List <DnDClericDomain> domains)
 {
     Name               = name;
     AlternativeNames   = altNames;
     Alignment          = alignment;
     WorshippingRaces   = races;
     WorshippingClasses = classes;
     Domains            = domains;
 }
 private void OnSelectedButtonChange(int notification)
 {
     if (ImageBox != null)
     {
         SelectedAlignment = (DnDAlignment)notification;
         ImageBox.transform.GetChild(mPreviousSelected / mRows).GetChild(mPreviousSelected % mColumns).GetChild(0).gameObject.SetActive(false);
         ImageBox.transform.GetChild(notification / mRows).GetChild(notification % mColumns).GetChild(0).gameObject.SetActive(true);
         mPreviousSelected = notification;
     }
 }
		private void OnSelectedButtonChange(int notification)
		{
			if (ImageBox != null)
			{
				SelectedAlignment = (DnDAlignment)notification;
				ImageBox.transform.GetChild(mPreviousSelected / mRows).GetChild(mPreviousSelected % mColumns).GetChild(0).gameObject.SetActive(false);
				ImageBox.transform.GetChild(notification / mRows).GetChild(notification % mColumns).GetChild(0).gameObject.SetActive(true);
				mPreviousSelected = notification;
			}
		}
Beispiel #7
0
        public override void Deserialize(JSONObject obj)
        {
            mName       = obj.GetString(NAME);
            mGender     = (CharacterGender)(int)obj.GetNumber(GENDER);
            mExperience = (int)obj.GetNumber(EXPERIENCE);
            mAvatar     = obj.GetString(AVATAR);
            mAlignment  = (DnDAlignment)(int)obj.GetNumber(ALIGNMENT);
            mRace       = (DnDRace)(int)obj.GetNumber(RACE);
            mAge        = (int)obj.GetNumber(AGE);
            if (obj.ContainsKey(DEITY))
            {
                mDeity = new DnDDeity();
                mDeity.Deserialize(obj.GetObject(DEITY));
            }
            mSize = (DnDCharacterSize)(int)obj.GetNumber(SIZE);
            // souls:
            JSONObject jSouls  = obj.GetObject(CLASS_SOULS);
            var        classes = Enum.GetValues(typeof(DnDCharClass)).Cast <DnDCharClass>();

            foreach (DnDCharClass charClass in classes)
            {
                if (jSouls.ContainsKey(charClass.ToString()))
                {
                    if (!string.IsNullOrEmpty(jSouls.GetObject(charClass.ToString()).ToString()))
                    {
                        DnDClassSoul newSoul = null;
                        switch (charClass)
                        {
                        case DnDCharClass.Wizard:
                            newSoul = new DnDWizard(this);
                            break;

                        default:
                            break;
                        }
                        if (newSoul != null)
                        {
                            newSoul.Deserialize(jSouls.GetObject(charClass.ToString()));
                            mClasses.Add(newSoul);
                        }
                    }
                }
            }
            // abilities:
            JSONArray tempArray = obj.GetArray(ABILITIES);

            foreach (var val in tempArray)
            {
                mAbilities[(DnDAbilities)((int)val.Array[0].Number)] = (int)val.Array[1].Number;
            }
        }
Beispiel #8
0
		public DnDDeity(string name, List<string> altNames, DnDAlignment alignment, List<DnDRace> races, List<DnDCharClass> classes, List<DnDClericDomain> domains)
		{
			Name = name;
			AlternativeNames = altNames;
			Alignment = alignment;
			WorshippingRaces = races;
			WorshippingClasses = classes;
			Domains = domains;
		}
		public override void Deserialize(JSONObject obj)
		{
			mName = obj.GetString(NAME);
			mGender = (CharacterGender)(int)obj.GetNumber(GENDER);
			mExperience = (int)obj.GetNumber(EXPERIENCE);
			mAvatar = obj.GetString(AVATAR);
			mAlignment = (DnDAlignment)(int)obj.GetNumber(ALIGNMENT);
			mRace = (DnDRace)(int)obj.GetNumber(RACE);
			mAge = (int)obj.GetNumber(AGE);
			if (obj.ContainsKey(DEITY))
			{
				mDeity = new DnDDeity();
				mDeity.Deserialize(obj.GetObject(DEITY));
			}
			mSize = (DnDCharacterSize)(int)obj.GetNumber(SIZE);
			// souls:
			JSONObject jSouls = obj.GetObject(CLASS_SOULS);
			var classes = Enum.GetValues(typeof(DnDCharClass)).Cast<DnDCharClass>();
			foreach (DnDCharClass charClass in classes)
			{
				if (jSouls.ContainsKey(charClass.ToString()))
				{
					if (!string.IsNullOrEmpty(jSouls.GetObject(charClass.ToString()).ToString()))
					{
						DnDClassSoul newSoul = null;
						switch (charClass)
						{
							case DnDCharClass.Wizard:
								newSoul = new DnDWizard(this);
								break;
							default:
								break;
						}
						if (newSoul != null)
						{
							newSoul.Deserialize(jSouls.GetObject(charClass.ToString()));
							mClasses.Add(newSoul);
						}
					}
				}
			}
			// abilities:
			JSONArray tempArray = obj.GetArray(ABILITIES);
			foreach (var val in tempArray)
			{
				mAbilities[(DnDAbilities)((int)val.Array[0].Number)] = (int)val.Array[1].Number;
			}
		}