private static Map <string, Animation> Get(CharacterSex sex)
        {
            var sexChar = sex.ToString().ToLower()[0];
            var pre     = path + sexChar;

            var downFalse = new Animation(180, $"{pre}d1");
            var downTrue  = new Animation(180, $"{pre}d1", $"{pre}d2", $"{pre}d1", $"{pre}d3");

            var leftFalse = new Animation(180, $"{pre}l1");
            var leftTrue  = new Animation(180, $"{pre}l1", $"{pre}l2", $"{pre}l1", $"{pre}l3");

            var rightFalse = new Animation(180, $"{pre}r1");
            var rightTrue  = new Animation(180, $"{pre}r1", $"{pre}r2", $"{pre}r1", $"{pre}r3");

            var upFalse = new Animation(180, $"{pre}u1");
            var upTrue  = new Animation(180, $"{pre}u1", $"{pre}u2", $"{pre}u1", $"{pre}u3");

            var animStates = new Map <string, Animation>
            {
                { "Down-False", downFalse },
                { "Down-True", downTrue },
                { "Left-False", leftFalse },
                { "Left-True", leftTrue },
                { "Right-False", rightFalse },
                { "Right-True", rightTrue },
                { "Up-False", upFalse },
                { "Up-True", upTrue },
            };

            return(animStates);
        }
Exemple #2
0
        public static bool TryTranslateFullName(IComponentTranslationContext context, Predicate <Text> predicate,
                                                Func <ChaControl> charGetter, CharacterSex sex = CharacterSex.Unspecified)
        {
            if (!(context.Component is Text textComponent))
            {
                return(false);
            }
            if (!predicate(textComponent))
            {
                return(false);
            }

            var originalText = context.OriginalText;

            void ResultHandler(ITranslationResult result)
            {
                // this fires with a simple full-name translation, which is less likely to be accurate than
                // some other translation options in games with split first/last names, so if it's already changed
                // we discard it here.
                if (result.Succeeded)
                {
                    textComponent.SafeProc(tc =>
                    {
                        if (tc.text == result.TranslatedText)
                        {
                            return;
                        }
                        if (tc.text != originalText)
                        {
                            Logger?.DebugLogDebug(
                                $"text already updated from '{originalText}' to '{tc.text}', discarding '{result.TranslatedText}'");
                            return;
                        }
                        tc.text = result.TranslatedText;
                    });
                }
            }

            var chaControl = charGetter();
            var scope      = chaControl != null ? new NameScope((CharacterSex)chaControl.sex) :
                             sex != CharacterSex.Unspecified ? new NameScope(sex) : NameScope.DefaultNameScope;

            if (TranslationHelper.TryFastTranslateFullName(scope, context.OriginalText, out var translatedName))
            {
                context.OverrideTranslatedText(translatedName);
            }
            else
            {
                Logger?.DebugLogDebug(
                    $"{nameof(ComponentTranslationHelpers)}.{nameof(TryTranslateFullName)}: attempting async translation for {context.OriginalText} ({chaControl})");
                textComponent.StartCoroutine(TranslateFullNameCoroutine(context.OriginalText, chaControl, scope, textComponent,
                                                                        ResultHandler));
            }

            return(true);
        }
Exemple #3
0
 public void showSexPanel(CharacterSex cs)
 {
     if (cs == CharacterSex.None)
     {
         toggleAllExcept(blankText);
     }
     else
     {
         toggleAllExcept(sexFields[(int)cs]);
     }
 }
 public PersonalInformation(CharacterName characterName, CharacterSex characterSex,
                            CharacterRace characterRace, CharacterBackground characterBackground, CharacterAge characterAge,
                            CharacterHeight characterHeight, CharacterWeight characterWeight, CharacterHairStyle hairStyle)
 {
     cName       = characterName;
     cRace       = characterRace;
     cSex        = characterSex;
     cBackground = characterBackground;
     cHeight     = characterHeight;
     cWeight     = characterWeight;
     cAge        = characterAge;
     cHair       = hairStyle;
 }
Exemple #5
0
    public static string ToFriendlyString(this CharacterSex sex)
    {
        switch (sex)
        {
        case CharacterSex.Female:
            return("Female");

        case CharacterSex.Male:
            return("Male");

        default:
            throw new Exception("CharacterSex not setup for ToFriendlyString");
        }
    }
Exemple #6
0
    public static string GetSexString(CharacterSex sex)
    {
        switch (sex)
        {
        case CharacterSex.Male:
            return("男性");

        case CharacterSex.Female:
            return("女性");

        case CharacterSex.Unknown:
        default:
            return("未知");
        }
    }
Exemple #7
0
        public bool TryTranslateFullName(CharacterSex sex, string origName, out string result)
        {
            if (_hasEntries && _fullNameCache[sex].TryGetValue(origName, out result))
            {
                if (!TranslationHelper.NameStringComparer.Equals(origName, result) &&
                    !StringUtils.ContainsJapaneseChar(result))
                {
                    CardNameTranslationManager.CacheRecentTranslation(new NameScope(sex), origName, result);
                }

                return(true);
            }
            result = null;
            return(false);
        }
Exemple #8
0
 public PlayerCharacter(CharacterSex sex, ICharSpace charSpace, Transform2 startingLocation)
 {
     _anims = new PlayerCharacterAnimations(sex);
     _components.Add(new Hunger());
     _components.Add(new PlayerEnergy());
     _transform = startingLocation;
     _charSpace = charSpace;
     Input.ClearBindings();
     Input.OnDirection(UpdatePhysics);
     Input.On(Control.A, Interact);
     World.Subscribe(EventSubscription.Create <WentToBed>((e) => WentToBed(), this));
     World.Subscribe(EventSubscription.Create <Awaken>((e) => Awaken(), this));
     World.Subscribe(EventSubscription.Create <CollapsedWithExhaustion>((e) => _isSleeping = true, this));
     World.Subscribe(EventSubscription.Create <InteractionStarted>(x => _isInteracting     = true, this));
     World.Subscribe(EventSubscription.Create <InteractionFinished>(x => _isInteracting    = false, this));
 }
Exemple #9
0
        internal String GenerateName(CharacterSex sex)
        {
            StringBuilder name = new StringBuilder();

            switch (sex)
            {
            case CharacterSex.Female:
                name.Append(StorageEmulation.FemaleNames[_grn.Next(0, StorageEmulation.FemaleNames.Count)]);
                break;

            case CharacterSex.Male:
                name.Append(StorageEmulation.MaleNames[_grn.Next(0, StorageEmulation.MaleNames.Count)]);
                break;
            }
            name.Append(" " + StorageEmulation.SecondNames[_grn.Next(0, StorageEmulation.SecondNames.Count)]);
            return(name.ToString());
        }
Exemple #10
0
    public void loadCharacter(string firstName, string lastName, CharacterSex mCSex, CharacterRace mCRace, int age,
                              CharacterBackground mCBackground, int height, int weight, CharacterClass mCClass,
                              int mCSturdy, int mCPerception, int mCTechnique, int mCWellVersed,
                              Color characterColor, Color headColor, Color primaryColor, Color secondaryColor, CharacterHairStyle hairStyle)
    {
        int heightRemainder = height % 12;

        height -= heightRemainder;

        personalInfo = new PersonalInformation(new CharacterName(firstName, lastName),
                                               mCSex, mCRace, mCBackground, new CharacterAge(age),
                                               new CharacterHeight(height, heightRemainder),
                                               new CharacterWeight(weight), hairStyle);
        characterProgress = new CharacterProgress(mCClass);
        abilityScores     = new AbilityScores(mCSturdy, mCPerception, mCTechnique, mCWellVersed);
        combatScores      = new CombatScores(abilityScores, personalInfo, characterProgress);
        skillScores       = new SkillScores(combatScores, characterProgress);
        CharacterColors characterColors = new CharacterColors(characterColor, headColor, primaryColor, secondaryColor);

        characterSheet = new CharacterSheet(abilityScores, personalInfo,
                                            characterProgress, combatScores, skillScores, characterColors, this, characterLoadout);
    }
Exemple #11
0
 public GameState(string charName, CharacterSex charSex)
 {
     Job            = Job.ReturnSpecialistLevel1;
     CharName       = charName;
     CharacterSex   = charSex;
     ActivePolicies = new ActivePolicies(ReturnSpecialistPolicies.Level1);
     Clock          = new Clock(400, new DateTime(2328, 7, 16, 8, 0, 0));
     PlayerAccount  = new PlayerAccount();
     SingleInstanceSubscriptions = new Map <Type, object>();
     Landlord = new Landlord(new Rent(50), PlayerAccount);
     Mailbox  = new Mailbox();
     AddSingleInstanceSubscription(new MegaBuyAccounting(PlayerAccount));
     AddSingleInstanceSubscription(new CallQueue());
     AddSingleInstanceSubscription(new MegaBuyEmployment(ActivePolicies));
     AddSingleInstanceSubscription(new GovernmentTaxes(PlayerAccount));
     AddSingleInstanceSubscription(new AutoSave());
     AddSingleInstanceSubscription(new FoodDelivery());
     AddSingleInstanceSubscription(new MegaBuyPolicyDepartment(ActivePolicies));
     AddSingleInstanceSubscription(new AllSounds());
     AddSingleInstanceSubscription(new MegaBuyReporting());
     World.Publish(new JobChanged(Job));
     //World.Publish(new TimeRateChanged(5.0f)); // To speed the game during development
 }
 public PlayerCharacterAnimations(CharacterSex sex)
     : base(Get(sex), "Up-False")
 {
 }
Exemple #13
0
 public NameScope(CharacterSex sex, NameType nameType = NameType.Unclassified)
 {
     NameType         = nameType;
     Sex              = sex;
     TranslationScope = BaseScope + ((int)NameType * 16) + (int)Sex + 1;
 }
Exemple #14
0
 public override void initData(string id, string name, string desc, CharacterSex sex, string faceIcon
                               , SDConstants.CharacterType ctype = SDConstants.CharacterType.Enemy)
 {
     base.initData(id, name, desc, sex, faceIcon, ctype);
 }
Exemple #15
0
    private static void CreateArmorConfig()
    {
        List <Dictionary <string, string> > xxListResult;


        #region BasicHeros
        xxListResult = ReadVSC("hero");
        HeroRace[]      heroRaces   = Resources.LoadAll <HeroRace>("");
        RoleCareer[]    careers     = Resources.LoadAll <RoleCareer>("");
        List <HeroInfo> AlreadyHave = Resources.LoadAll <HeroInfo>("").ToList();
        for (int i = 0; i < xxListResult.Count; i++)
        {
            Dictionary <string, string> Dic = xxListResult[i];

            if (AlreadyHave.Exists(x => x.ID == Dic["id"]))
            {
                continue;
            }
            //
            HeroInfo     mi  = ScriptableObject.CreateInstance <HeroInfo>();
            CharacterSex sex = (CharacterSex)(StringToInteger(Dic["gender"]));
            mi.initData(Dic["id"], Dic["name"], Dic["desc"], sex, "");
            int Race = StringToInteger(Dic["race"]);
            foreach (HeroRace race in heroRaces)
            {
                if (race.Index == Race)
                {
                    mi.Race = race; break;
                }
            }
            int career = StringToInteger(Dic["career"]);
            foreach (RoleCareer c in careers)
            {
                if (c.Index == career)
                {
                    mi.Career = c; break;
                }
            }
            mi.InitRAL(RALByDictionary(Dic));
            mi.WeaponRaceList = GetWeaponTypeList(Dic["weaponClass"]);
            mi.SpecialStr     = Dic["specialStr"];
            mi.AddSkillData(
                getSkillsByString(Dic["skill0"])
                , getSkillsByString(Dic["skill1"])
                , getSkillsByString(Dic["skillOmega"])
                );
            //
            AssetDatabase.CreateAsset(mi, "Assets/Resources/ScriptableObjects/heroes/"
                                      + career + "_"
                                      + mi.ID.Substring(mi.ID.Length - 3) + "_" + mi.Name + ".asset");
        }
        #endregion
        return;

        #region enemy
        xxListResult = CreateConfig.ReadVSC("enemy");
        EnemyRank[] eRanks = Resources.LoadAll <EnemyRank>("");
        for (int i = 0; i < xxListResult.Count; i++)
        {
            Dictionary <string, string> Dic = xxListResult[i];
            EnemyInfo    mi  = ScriptableObject.CreateInstance <EnemyInfo>();
            CharacterSex sex = (CharacterSex)(StringToInteger(Dic["gender"]));
            mi.initData(Dic["id"], Dic["name"], Dic["desc"], sex, "");
            mi.Race = EnemyRaces(Dic["race"]);

            int ranktype = StringToInteger(Dic["rank"]);
            foreach (EnemyRank rank in eRanks)
            {
                if (rank.Index == ranktype)
                {
                    mi.EnemyRank = rank; break;
                }
            }
            mi.RAL              = RALByDictionary(Dic);
            mi.weight           = StringToInteger(Dic["weight"]);
            mi.dropPercent      = StringToInteger(Dic["dropRate"]);
            mi.StartAppearLevel = StringToInteger(Dic["startLevel"]);
            mi.EndAppearLevel   = StringToInteger(Dic["endLevel"]);
            //
            AssetDatabase.CreateAsset(mi, "Assets/Resources/ScriptableObjects/enemies/"
                                      + mi.ID.Split('#')[1] + mi.Name + ".asset");
        }
        #endregion
        return;

        #region Equip
        xxListResult = CreateConfig.ReadVSC("equip");
        ArmorRank[]        armor_ranks  = Resources.LoadAll <ArmorRank>("");
        WeaponRace[]       waepon_races = Resources.LoadAll <WeaponRace>("");
        List <SpriteAtlas> allAtlas     = Resources.LoadAll <SpriteAtlas>("Sprites/atlas").ToList();
        for (int i = 0; i < xxListResult.Count; i++)
        {
            Dictionary <string, string> Dic = xxListResult[i];
            EquipItem ei = ScriptableObject.CreateInstance <EquipItem>();
            ei.initData(Dic["id"], Dic["name"], Dic["desc"], CreateConfig.StringToInteger(Dic["level"])
                        , false, true, true, true, false, Dic["specialStr"]);
            ei.ResistStr = Dic["resistStr"];
            //
            int rankType = CreateConfig.StringToInteger(Dic["type"]);
            foreach (ArmorRank rank in armor_ranks)
            {
                if (rank.Index == rankType)
                {
                    ei.ArmorRank = rank; break;
                }
            }
            if (!string.IsNullOrEmpty(Dic["suit"]))
            {
                ei.SuitBelong = true; ei.SuitId = Dic["suit"];
            }
            //
            ei.RAL           = RALBySpecialStr(RoleAttributeList.zero, Dic["specialStr"]);
            ei.RAL           = RALByResistStr(ei.RAL, Dic["resistStr"]);
            ei.PassiveEffect = Dic["passiveEffect"];
            //
            string        _class = Dic["class"];
            EquipPosition pos    = ROHelp.EQUIP_POS(_class);
            ei.EquipPos = pos;
            if (pos == EquipPosition.Hand)
            {
                string weaponClass = Dic["weaponClass"].ToLower();
                foreach (WeaponRace r in waepon_races)
                {
                    if (weaponClass == r.NAME.ToLower())
                    {
                        ei.WeaponRace = r; break;
                    }
                }
            }


            //
            AssetDatabase.CreateAsset(ei, "Assets/Resources/ScriptableObjects/items/Equips/"
                                      + (int)ei.EquipPos + "_"
                                      + ei.LEVEL + "_" + ei.NAME + ".asset");
        }
        #endregion
        return;

        xxListResult = ReadVSC("hero");
        //HeroRace[] heroRaces = Resources.LoadAll<HeroRace>("");
        //RoleCareer[] careers = Resources.LoadAll<RoleCareer>("");
        for (int i = 0; i < xxListResult.Count; i++)
        {
            Dictionary <string, string> Dic = xxListResult[i];
            HeroInfo     mi  = ScriptableObject.CreateInstance <HeroInfo>();
            CharacterSex sex = (CharacterSex)(StringToInteger(Dic["gender"]));
            mi.initData(Dic["id"], Dic["name"], Dic["desc"], sex, "");
            int Race = StringToInteger(Dic["race"]);
            foreach (HeroRace race in heroRaces)
            {
                if (race.Index == Race)
                {
                    mi.Race = race; break;
                }
            }
            int career = StringToInteger(Dic["career"]);
            foreach (RoleCareer c in careers)
            {
                if (c.Index == career)
                {
                    mi.Career = c; break;
                }
            }
            mi.InitRAL(RALByDictionary(Dic));
            mi.WeaponRaceList = GetWeaponTypeList(Dic["weaponClass"]);
            mi.SpecialStr     = Dic["specialStr"];
            mi.AddSkillData(
                getSkillsByString(Dic["skill0"])
                , getSkillsByString(Dic["skill1"])
                , getSkillsByString(Dic["skillOmega"])
                );
            //
            AssetDatabase.CreateAsset(mi, "Assets/Resources/ScriptableObjects/heroes/"
                                      + career + "_"
                                      + mi.ID.Substring(mi.ID.Length - 3) + "_" + mi.Name + ".asset");
        }

        return;



        return;

        #region Consumable
        xxListResult = CreateConfig.ReadVSC("material");
        for (int i = 0; i < xxListResult.Count; i++)
        {
            Dictionary <string, string> Dic = xxListResult[i];
            SDConstants.MaterialType    MT  = CreateConfig.getMTypeByString(Dic["materialType"]);
            consumableItem mi = ScriptableObject.CreateInstance <consumableItem>();
            mi.initData(Dic["id"], Dic["name"], Dic["desc"], CreateConfig.StringToInteger(Dic["level"])
                        , false, true, true, true, false, Dic["specialStr"], SDConstants.ItemType.Consumable);
            mi.MaterialType     = MT;
            mi.buyPrice_coin    = StringToInteger(Dic["buyPrice_coin"]);
            mi.buyPrice_diamond = StringToInteger(Dic["buyPrice_diamond"]);
            mi.minLv            = StringToInteger(Dic["minLv"]);
            mi.maxLv            = StringToInteger(Dic["maxLv"]);
            mi.exchangeType     = StringToInteger(Dic["exchangeType"]);
            mi.weight           = StringToInteger(Dic["weight"]);
            mi.ConsumableType   = (SDConstants.ConsumableType)StringToInteger(Dic["consumableType"]);
            if (Dic.ContainsKey("range"))
            {
                mi.AOE = ROHelp.AOE_TYPE(Dic["range"]);
            }
            if (Dic.ContainsKey("target"))
            {
                mi.AIM = Dic["target"].ToUpper();
            }
            //
            AssetDatabase.CreateAsset(mi, "Assets/Resources/ScriptableObjects/items/Consumables/"
                                      + mi.ID.Substring(mi.ID.Length - 3) + mi.NAME + ".asset");
        }
        #endregion
    }
Exemple #16
0
 public void selectSex(Button b, CharacterSex cs)
 {
     character.sex = cs;
     selectSexButton(b);
     showSexPanel(cs);
 }
 public void Init()
 {
     _createCharacterLabel = new Label {
         BackgroundColor = Color.Transparent, TextColor = Color.White, Text = "Create Your Character", Transform = new Transform2(Sizes.LargeLabel)
     };
     _charName = new Label {
         BackgroundColor = Color.Black, TextColor = Color.White, Text = "Name", Transform = new Transform2(Sizes.MediumLabel)
     };
     _charSexLabel = new Label {
         BackgroundColor = Color.Black, TextColor = Color.White, Text = "Make", Transform = new Transform2(Sizes.MediumLabel)
     };
     _startGameButton = new ImageTextButton("Start Game",
                                            "Images/Menu/button-default",
                                            "Images/Menu/button-hover",
                                            "Images/Menu/button-pressed",
                                            new Transform2(new Vector2(800 - 100, 750 - 22),
                                                           new Size2(200, 44)), StartGame);
     _maleButton = new ImageTextButton("Male",
                                       "Images/Menu/button-default",
                                       "Images/Menu/button-hover",
                                       "Images/Menu/button-pressed",
                                       new Transform2(new Vector2(800 - 100, 650 - 22),
                                                      new Size2(200, 44)), () => _sex = CharacterSex.Male);
     _femaleButton = new ImageTextButton("Female",
                                         "Images/Menu/button-default",
                                         "Images/Menu/button-hover",
                                         "Images/Menu/button-pressed",
                                         new Transform2(new Vector2(800 - 100, 600 - 22),
                                                        new Size2(200, 44)), () => _sex = CharacterSex.Female);
     _ui = new ClickUI();
     _ui.Add(_startGameButton);
     _ui.Add(_maleButton);
     _ui.Add(_femaleButton);
 }
Exemple #18
0
    public void loadCharacterFromTextFile(string fileName)
    {
        //	TextAsset text = Resources.Load<TextAsset>("Saves/" + fileName);
        //	string data = text.text;
        string data = Saves.getCharactersString(fileName);

        string[]            components     = data.Split(new char[] { ';' });
        int                 curr           = 0;
        string              firstName      = components[curr++];
        string              lastName       = components[curr++];
        int                 sex            = int.Parse(components[curr++]);
        CharacterSex        sexC           = (sex == 0 ? CharacterSex.Male : (sex == 1 ? CharacterSex.Female : CharacterSex.Other));
        int                 race           = int.Parse(components[curr++]);
        CharacterRace       raceC          = CharacterRace.getRace(race == 0 ? RaceName.Berrind : (race == 1 ? RaceName.Ashpian : RaceName.Rorrul));
        int                 background     = int.Parse(components[curr++]);
        CharacterBackground backgroundC    = (background == 0 ? (race == 0 ? CharacterBackground.FallenNoble : (race == 1 ? CharacterBackground.Commoner : CharacterBackground.Servant)) : (race == 0 ? CharacterBackground.WhiteGem : (race == 1 ? CharacterBackground.Immigrant : CharacterBackground.Unknown)));
        int                 age            = int.Parse(components[curr++]);
        int                 height         = int.Parse(components[curr++]);
        int                 weight         = int.Parse(components[curr++]);
        int                 class1         = int.Parse(components[curr++]);
        ClassName           className      = (class1 == 0 ? ClassName.ExSoldier : (class1 == 1 ? ClassName.Engineer : (class1 == 2 ? ClassName.Investigator : (class1 == 3 ? ClassName.Researcher : ClassName.Orator))));
        int                 sturdy         = int.Parse(components[curr++]);
        int                 perception     = int.Parse(components[curr++]);
        int                 technique      = int.Parse(components[curr++]);
        int                 wellVersed     = int.Parse(components[curr++]);
        int                 athletics      = int.Parse(components[curr++]);
        int                 melee          = int.Parse(components[curr++]);
        int                 ranged         = int.Parse(components[curr++]);
        int                 stealth        = int.Parse(components[curr++]);
        int                 mechanical     = int.Parse(components[curr++]);
        int                 medicinal      = int.Parse(components[curr++]);
        int                 historical     = int.Parse(components[curr++]);
        int                 political      = int.Parse(components[curr++]);
        Color               characterColor = new Color(int.Parse(components[curr++]) / 255.0f, int.Parse(components[curr++]) / 255.0f, int.Parse(components[curr++]) / 255.0f);

        Debug.Log(characterColor.r + " " + characterColor.g + " " + characterColor.b);
        Color headColor      = new Color(int.Parse(components[curr++]) / 255.0f, int.Parse(components[curr++]) / 255.0f, int.Parse(components[curr++]) / 255.0f);
        Color primaryColor   = new Color(int.Parse(components[curr++]) / 255.0f, int.Parse(components[curr++]) / 255.0f, int.Parse(components[curr++]) / 255.0f);
        Color secondaryColor = new Color(int.Parse(components[curr++]) / 255.0f, int.Parse(components[curr++]) / 255.0f, int.Parse(components[curr++]) / 255.0f);
        int   hairStyle      = 0;
        int   level          = 1;
        int   experience     = 0;

        if (curr < components.Length - 1)
        {
            hairStyle = int.Parse(components[curr++]);
        }
        if (curr < components.Length - 1)
        {
            level = int.Parse(components[curr++]);
        }
        if (curr < components.Length - 1)
        {
            experience = int.Parse(components[curr++]);
        }
        int money       = 0;
        int health      = 100000;
        int composure   = 100000;
        int numFeatures = 0;
        int numItems    = 0;
        int focus       = 0;

        if (curr < components.Length - 1)
        {
            money = int.Parse(components[curr++]);
        }
        if (curr < components.Length - 1)
        {
            health = int.Parse(components[curr++]);
        }
        if (curr < components.Length - 1)
        {
            composure = int.Parse(components[curr++]);
        }
        if (curr < components.Length - 1)
        {
            numFeatures = int.Parse(components[curr++]);
        }
        int[] features = new int[numFeatures];
        for (int n = 0; n < numFeatures; n++)
        {
            if (curr < components.Length - 1)
            {
                features[n] = int.Parse(components[curr++]);
            }
        }
        if (curr < components.Length - 1)
        {
            focus = int.Parse(components[curr++]);
        }
        if (curr < components.Length - 1)
        {
            numItems = int.Parse(components[curr++]);
        }
        personalInfo = new PersonalInformation(new CharacterName(firstName, lastName), sexC,
                                               raceC, backgroundC, new CharacterAge(age), new CharacterHeight(height),
                                               new CharacterWeight(weight), new CharacterHairStyle(hairStyle));
        characterProgress = new CharacterProgress(CharacterClass.getClass(className));
        abilityScores     = new AbilityScores(sturdy, perception, technique, wellVersed);
        combatScores      = new CombatScores(abilityScores, personalInfo, characterProgress);
        skillScores       = new SkillScores(combatScores, characterProgress);
        CharacterColors characterColors = new CharacterColors(characterColor, headColor, primaryColor, secondaryColor);

        characterSheet = new CharacterSheet(abilityScores, personalInfo, characterProgress, combatScores, skillScores, characterColors, this, characterLoadout);
        skillScores.incrementScore(Skill.Athletics, athletics);
        skillScores.incrementScore(Skill.Melee, melee);
        skillScores.incrementScore(Skill.Ranged, ranged);
        skillScores.incrementScore(Skill.Stealth, stealth);
        skillScores.incrementScore(Skill.Mechanical, mechanical);
        skillScores.incrementScore(Skill.Medicinal, medicinal);
        skillScores.incrementScore(Skill.Historical, historical);
        skillScores.incrementScore(Skill.Political, political);
        characterProgress.setLevel(level);
        characterProgress.setExperience(experience);
        characterSheet.inventory.purse.receiveMoney(money);
        combatScores.setHealth(health);
        combatScores.setComposure(composure);
        characterProgress.getCharacterClass().chosenFeatures = features;
        characterProgress.setWeaponFocus(focus);
        Inventory inv = characterSheet.inventory;

        for (int n = 0; n < numItems; n++)
        {
            int      slot     = int.Parse(components[curr++]);
            ItemCode code     = (ItemCode)int.Parse(components[curr++]);
            string   itemData = components[curr++];
            Item     i        = Item.deserializeItem(code, itemData);
            if (slot < 100)
            {
                if (inv.inventory[slot].item != null)
                {
                    if (inv.itemCanStackWith(inv.inventory[slot].item, i))
                    {
                        inv.inventory[slot].item.addToStack(i);
                    }
                }
                else if (inv.canInsertItemInSlot(i, Inventory.getSlotForIndex(slot)))
                {
                    inv.insertItemInSlot(i, Inventory.getSlotForIndex(slot));
                }
            }
            else
            {
                characterSheet.characterLoadout.setItemInSlot(getArmorSlot(slot), i);
            }
            //Inventory stuff
        }
        //Right Weapon = 100;
        //Left Weapon = 110;
        //Head = 120;
        //Shoulder = 130;
        //Chest = 140;
        //Legs = 150;
        //Boots = 160;
        //Gloves = 170;
        if (curr < components.Length - 1)
        {
            characterProgress.setFavoredRace(int.Parse(components[curr++]));
        }
    }
Exemple #19
0
    public string getCharacterString()
    {
        string characterStr = "";

        //********PERSONAL INFORMATION********\\
        //Adding player first name.
        characterStr += personalInfo.getCharacterName().firstName + delimiter;
        characterStr += personalInfo.getCharacterName().lastName + delimiter;
        CharacterSex sex = personalInfo.getCharacterSex();

        characterStr += (sex == CharacterSex.Male ? 0 : (sex == CharacterSex.Female ? 1 : 2)) + delimiter;
        RaceName race = personalInfo.getCharacterRace().raceName;

        characterStr += (race == RaceName.Berrind ? 0 : (race == RaceName.Ashpian ? 1 : 2)) + delimiter;
        CharacterBackground background = personalInfo.getCharacterBackground();

        characterStr += (background == CharacterBackground.FallenNoble || background == CharacterBackground.Commoner || background == CharacterBackground.Servant ? 0 : 1) + delimiter;
        characterStr += personalInfo.getCharacterAge().age + delimiter;
        characterStr += (personalInfo.getCharacterHeight().feet * 12 + personalInfo.getCharacterHeight().inches) + delimiter;
        characterStr += personalInfo.getCharacterWeight().weight + delimiter;
        ClassName clas = characterProgress.getCharacterClass().getClassName();

        characterStr += (clas == ClassName.ExSoldier ? 0 : (clas == ClassName.Engineer ? 1 : (clas == ClassName.Investigator ? 2 : (clas == ClassName.Researcher ? 3 : 4)))) + delimiter;
        characterStr += abilityScores.getSturdy() + delimiter;
        characterStr += abilityScores.getPerception(0) + delimiter;
        characterStr += abilityScores.getTechnique() + delimiter;
        characterStr += abilityScores.getWellVersed() + delimiter;
        foreach (int score in skillScores.scores)
        {
            characterStr += score + delimiter;
        }
        CharacterColors colors = characterSheet.characterColors;

        characterStr += colorString(colors.characterColor);
        characterStr += colorString(colors.headColor);
        characterStr += colorString(colors.primaryColor);
        characterStr += colorString(colors.secondaryColor);
        characterStr += characterSheet.personalInformation.getCharacterHairStyle().hairStyle + delimiter;
        characterStr += characterProgress.getCharacterLevel() + delimiter;
        characterStr += characterProgress.getCharacterExperience() + delimiter;
        //*********Hair*********\\
        characterStr += characterSheet.inventory.purse.money + delimiter;
        characterStr += characterSheet.combatScores.getCurrentHealth() + delimiter;
        characterStr += characterSheet.combatScores.getCurrentComposure() + delimiter;
        int[] features = characterSheet.characterProgress.getCharacterClass().chosenFeatures;
        characterStr += features.Length + delimiter;
        foreach (int feature in features)
        {
            characterStr += feature + delimiter;
        }
        characterStr += characterSheet.characterProgress.getWeaponFocusAsNumber() + delimiter;
        string inventoryString = "";
        int    inventorySize   = 0;

        foreach (InventoryItemSlot slot in characterSheet.inventory.inventory)
        {
            if (slot.item != null)
            {
                inventorySize++;
                inventoryString += slot.index + delimiter;
                inventoryString += (int)slot.item.getItemCode() + delimiter;
                inventoryString += slot.item.getItemData() + delimiter;
                if (slot.item.stackSize() > 0)
                {
                    foreach (Item i in slot.item.stack)
                    {
                        inventorySize++;
                        inventoryString += slot.index + delimiter;
                        inventoryString += (int)i.getItemCode() + delimiter;
                        inventoryString += i.getItemData() + delimiter;
                    }
                }
            }
        }
        foreach (InventorySlot slot in UnitGUI.armorSlots)
        {
            Item i = characterSheet.characterLoadout.getItemInSlot(slot);
            if (i != null)
            {
//				if (characterSheet.personalInformation.getCharacterName().firstName == "v") Debug.Log("GUI Slot: " + slot + "  " + (i is Weapon) + "   " + (i is Medicinal));
                inventorySize++;
                inventoryString += getArmorSlotIndex(slot) + delimiter;
                inventoryString += (int)i.getItemCode() + delimiter;
                inventoryString += i.getItemData() + delimiter;
            }
        }
        characterStr += inventorySize + delimiter + inventoryString;
        characterStr += characterSheet.characterProgress.getFavoredRaceAsNumber() + delimiter;
        return(characterStr);
    }
Exemple #20
0
 public virtual void initData(string id, string name, string desc, CharacterSex sex, string faceIcon, SDConstants.CharacterType ctype)
 {
     ID            = id; Name = name; DESC = desc; Sex = sex;
     CharacterType = ctype;
 }
Exemple #21
0
 public static void SetupCharacter(string characterName, CharacterSex sex)
 {
     _charName = characterName;
     _charSex  = sex;
 }
Exemple #22
0
 public NameScope(CharacterSex sex) : this(sex, NameType.Unclassified)
 {
 }
Exemple #23
0
 public NameScope(CharacterSex sex, NameType nameType)
 {
     NameType = nameType;
     Sex      = sex;
 }