Esempio n. 1
0
    public override void CopyValues(ScrObjLibraryEntry other)
    {
        base.CopyValues(other);
        MissionEntry mission = (MissionEntry)other;

        mapLocation    = mission.mapLocation;
        mapDescription = mission.mapDescription;

        maps = new List <MapEntry>();
        for (int i = 0; i < mission.maps.Count; i++)
        {
            maps.Add(mission.maps[i]);
        }
        squads = new List <SquadGroup>();
        for (int i = 0; i < mission.squads.Count; i++)
        {
            squads.Add(mission.squads[i]);
        }

        duration       = mission.duration;
        unlockReq      = mission.unlockReq;
        unlockDay      = mission.unlockDay;
        squadSize      = mission.squadSize;
        characterReq   = mission.characterReq;
        clearedMission = mission.clearedMission;

        reward = mission.reward;
    }
        public PlatformSpecificsPage()
        {
            InitializeComponent();

            //Fluent code configuration
            CharEntry.On <iOS>().SetIsClearEnabled(true);
        }
Esempio n. 3
0
    public override void CopyValues(ScrObjLibraryEntry other)
    {
        base.CopyValues(other);
        CharEntry cd = (CharEntry)other;

        portraitSet      = cd.portraitSet;
        startClass       = cd.startClass;
        startClassLevels = cd.startClassLevels;

        hp  = cd.hp;
        dmg = cd.dmg;
        mnd = cd.mnd;
        skl = cd.skl;
        spd = cd.spd;
        def = cd.def;

        gHp  = cd.gHp;
        gDmg = cd.gDmg;
        gMnd = cd.gMnd;
        gSkl = cd.gSkl;
        gSpd = cd.gSpd;
        gDef = cd.gDef;

        supports = new List <SupportTuple>();
        for (int i = 0; i < cd.supports.Count; i++)
        {
            supports.Add(cd.supports[i]);
        }

        faction     = cd.faction;
        mustSurvive = cd.mustSurvive;
        deathQuote  = cd.deathQuote;
    }
Esempio n. 4
0
 public StatsContainer(SpawnData pos)
 {
     level        = pos.level;
     charData     = pos.charData;
     currentClass = pos.charData.startClass;
     classLevels  = pos.charData.startClassLevels;
     GenerateStartingStats();
 }
Esempio n. 5
0
 public SpawnData(TacticsMove tactics)
 {
     x                  = tactics.posx;
     y                  = tactics.posy;
     charData           = tactics.stats.charData;
     level              = tactics.stats.level;
     stats              = tactics.stats;
     inventoryContainer = tactics.inventory;
     skills             = tactics.skills;
 }
Esempio n. 6
0
 public SupportTuple GetSupport(CharEntry partner)
 {
     for (int i = 0; i < supports.Count; i++)
     {
         if (supports[i].partner.uuid == partner.uuid)
         {
             return(supports[i]);
         }
     }
     return(null);
 }
Esempio n. 7
0
 public bool IsCharacterLocked(CharEntry character)
 {
     for (int i = 0; i < maps.Count; i++)
     {
         if (maps[i].IsLocked(character))
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 8
0
 /// <summary>
 /// Checks the locked character list to see if the given character appears.
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public bool IsLocked(CharEntry data)
 {
     for (int i = 0; i < lockedCharacters.Count; i++)
     {
         if (lockedCharacters[i].entryName == data.entryName)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 9
0
 public void Copy(SpawnData other)
 {
     triggerType  = other.triggerType;
     spawnTurn    = other.spawnTurn;
     triggerIndex = other.triggerIndex;
     faction      = other.faction;
     x            = other.x;
     y            = other.y;
     level        = other.level;
     charData     = other.charData;
     for (int i = 0; i < other.inventory.Count; i++)
     {
         inventory.Add(new WeaponTuple()
         {
             item      = other.inventory[i].item,
             droppable = other.inventory[i].droppable
         });
     }
     joiningSquad = other.joiningSquad;
     aggroType    = other.aggroType;
     hasQuotes    = other.hasQuotes;
     quotes.Clear();
     for (int i = 0; i < other.quotes.Count; i++)
     {
         quotes.Add(new FightQuote()
         {
             triggerer = other.quotes[i].triggerer,
             quote     = other.quotes[i].quote,
             activated = other.quotes[i].activated
         });
     }
     talks.Clear();
     for (int i = 0; i < other.talks.Count; i++)
     {
         talks.Add(new FightQuote()
         {
             triggerer = other.talks[i].triggerer,
             quote     = other.talks[i].quote,
             willJoin  = other.talks[i].willJoin,
             activated = other.talks[i].activated
         });
     }
     huntX           = other.huntX;
     huntY           = other.huntY;
     patrolPositions = new List <Position>();
     for (int i = 0; i < other.patrolPositions.Count; i++)
     {
         patrolPositions.Add(new Position()
         {
             x = other.patrolPositions[i].x, y = other.patrolPositions[i].y
         });
     }
 }
Esempio n. 10
0
            public TokenPattern(string stringPattern)
            {
                // TODO surrogate pairs handling

                Entries = new TokenEntry[stringPattern.Length];

                var index = 0;

                foreach (var ch in stringPattern)
                {
                    Entries[index++] = new CharEntry(ch);
                }
            }
Esempio n. 11
0
    private void CreateSupportEntry()
    {
        oldIndex = supportList.GetPosition();
        supportList.FilterShow((x) => x.index != selectedIndex);
        for (int i = 0; i < supportList.Size; i++)
        {
            CharEntry    other = playerData.stats[supportList.GetEntry(i).index].charData;
            SupportTuple tuple = playerData.stats[selectedIndex].charData.GetSupport(other);
            SupportValue value = playerData.baseInfo[selectedIndex].GetSupportValue(other);

            supportList.GetEntry(i).SetDark(tuple == null);
            supportList.GetEntry(i).SetSupportValue(tuple, value);
        }
    }
Esempio n. 12
0
 public SupportValue GetSupportValue(CharEntry other)
 {
     for (int i = 0; i < supportValues.Count; i++)
     {
         if (supportValues[i].uuid == other.uuid)
         {
             return(supportValues[i]);
         }
     }
     return(new SupportValue()
     {
         uuid = other.uuid
     });
 }
Esempio n. 13
0
        private bool InitializeChar(System.Drawing.Graphics graphics, int bitmapWidth, int bitmapHeight, System.Drawing.Font font, int fontSize, float xWidth, float xHeight, char c, FontStyle style, ref float currentX, ref float currentY)
        {
            var    charKey = new CharKey(c, style);
            string s       = new string(c, 1);

            if (char.IsWhiteSpace(c))
            {
                _charEntries[charKey] = new CharEntry {
                    TextureWidth = graphics.MeasureString("X" + s + "X", font).Width - graphics.MeasureString("xx", font).Width
                };
                return(true);
            }

            RectangleF charRectangle = MeasureRectangle(graphics, fontSize, font, s);
            float      charWidth = charRectangle.Width, charHeight = charRectangle.Height;

            if (currentX + charWidth + xWidth > bitmapWidth)
            {
                currentX  = 0;
                currentY += xHeight;

                if (currentY + xHeight > bitmapHeight)
                {
                    // We have run out of space in our image for further characters. This means we need a larger image texture --
                    // though on the other hand, we can't properly handle most Unicode characters anyway, so the whole approach
                    // might need rethinking.
                    return(false);
                }
            }

            graphics.DrawString(s, font, Brushes.White, currentX + 0.5f * xWidth - charRectangle.Left, currentY);

            float measuredCharWidth = graphics.MeasureString("X" + s + "X", font).Width - graphics.MeasureString("XX", font).Width;

            _charEntries[charKey] = new CharEntry
            {
                TextureX      = currentX / bitmapWidth,
                TextureY      = currentY / bitmapHeight,
                TextureWidth  = (charWidth + xWidth) / bitmapWidth,
                TextureHeight = charHeight / bitmapHeight,

                BoxLeft    = 0.5f * xWidth / xHeight,
                BoxRight   = (charWidth + 0.5f * xWidth) / xHeight,
                InnerWidth = measuredCharWidth / xHeight,
            };

            currentX += charWidth + xWidth;
            return(true);
        }
        private void btnFormatData_Click(object sender, EventArgs e)
        {
            foreach (DataGridViewRow row in dgvTransmission.SelectedRows)
            {
                TElement_Constant selectedTE = row.DataBoundItem as TElement_Constant; //gets the selected element

                if (selectedTE != null)                                                //not sure if this is necessary
                {
                    using (var form = new CharEntry(selectedTE))
                    {
                        form.ShowDialog();
                        this.UpdateTransDGV();
                    }
                }
            }
        }
Esempio n. 15
0
    public override void ResetValues()
    {
        base.ResetValues();
        mapLocation    = MapLocation.UNKNOWN;
        mapDescription = "";

        squads = new List <SquadGroup>();
        maps   = new List <MapEntry>();

        duration       = 1;
        unlockReq      = Unlocking.TIME;
        unlockDay      = 1;
        unlockDay      = 99;
        characterReq   = null;
        clearedMission = null;

        reward = new Reward();
    }
Esempio n. 16
0
        private void LoadList()
        {
            //sample file contents:
            //32D0;CIRCLED KATAKANA A;So;0;L;<circle> 30A2;;;;N;;;;;
            string rawTextOfList = ResourceExtensions.GetResourceTextFile("UnicodeCharSet.txt");

            //split by <CR>
            string[] lines = rawTextOfList.Split('\r');
            foreach (string oneLine in lines)
            {
                string[] elements = oneLine.Replace("\n", "").Split(';');

                CharEntry oneEntry = new CharEntry();
                oneEntry.CodeHex = elements[0];
                oneEntry.CodeDec = Int64.Parse(elements[0], System.Globalization.NumberStyles.HexNumber).ToString();
                oneEntry.Desc    = elements[1];
                oneEntry.AltDesc = elements[10];

                _charCodes.Add(oneEntry);
            }
        }
Esempio n. 17
0
    private void SetupValues(CharacterSaveData saveData, CharEntry cStacDatas, ClassEntry cClass)
    {
        charData     = cStacDatas;
        currentClass = cClass;

        if (saveData == null)
        {
            return;
        }

        classLevels = new int[ClassWheel.CLASS_COUNT];
        for (int i = 0; i < ClassWheel.CLASS_COUNT; i++)
        {
            if (i < saveData.classLevels.Length)
            {
                classLevels[i] = saveData.classLevels[i];
            }
        }
        level = saveData.level;
        if (level == -1)
        {
            return;
        }
        currentExp = saveData.currentExp;

        eHp  = saveData.eHp;
        eDmg = saveData.eDmg;
        eMnd = saveData.eMnd;
        eSpd = saveData.eSpd;
        eSkl = saveData.eSkl;
        eDef = saveData.eDef;

        //TODO calculate support boost.
        supportBoost = new Boost();

        CalculateStats();
    }
    private void ShowGrowths()
    {
        CharEntry charValues = (CharEntry)entryValues;

        GUILayout.Label("Stat growths", EditorStyles.boldLabel);
        GUILayout.BeginHorizontal();
        GUILayout.Label("HP  " + charValues.startClass.gHp);
        charValues.gHp = 5 * (EditorGUILayout.IntSlider(charValues.gHp, -30, 30) / 5);
        GUILayout.Label("Tot: " + (charValues.startClass.gHp + charValues.gHp));
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        GUILayout.Label("DMG  " + charValues.startClass.gDmg);
        charValues.gDmg = 5 * (EditorGUILayout.IntSlider(charValues.gDmg, -30, 30) / 5);
        GUILayout.Label("Tot: " + (charValues.startClass.gDmg + charValues.gDmg));
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        GUILayout.Label("MND  " + charValues.startClass.gMnd);
        charValues.gMnd = 5 * (EditorGUILayout.IntSlider(charValues.gMnd, -30, 30) / 5);
        GUILayout.Label("Tot: " + (charValues.startClass.gMnd + charValues.gMnd));
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        GUILayout.Label("SKL  " + charValues.startClass.gSkl);
        charValues.gSkl = 5 * (EditorGUILayout.IntSlider(charValues.gSkl, -30, 30) / 5);
        GUILayout.Label("Tot: " + (charValues.startClass.gSkl + charValues.gSkl));
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        GUILayout.Label("SPD  " + charValues.startClass.gSpd);
        charValues.gSpd = 5 * (EditorGUILayout.IntSlider(charValues.gSpd, -30, 30) / 5);
        GUILayout.Label("Tot: " + (charValues.startClass.gSpd + charValues.gSpd));
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        GUILayout.Label("DEF  " + charValues.startClass.gDef);
        charValues.gDef = 5 * (EditorGUILayout.IntSlider(charValues.gDef, -30, 30) / 5);
        GUILayout.Label("Tot: " + (charValues.startClass.gDef + charValues.gDef));
        GUILayout.EndHorizontal();
        GUILayout.Label("Total growth diff:  " + (charValues.gHp + charValues.gDmg + charValues.gMnd + charValues.gSkl + charValues.gSpd + charValues.gDef));
    }
    private void ShowBaseStats()
    {
        CharEntry charValues = (CharEntry)entryValues;

        GUILayout.Label("Base stats", EditorStyles.boldLabel);
        GUILayout.BeginHorizontal();
        GUILayout.Label("HP  " + charValues.startClass.hp);
        charValues.hp = EditorGUILayout.IntSlider(charValues.hp, -10, 10);
        GUILayout.Label("Tot: " + (charValues.startClass.hp + charValues.hp));
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        GUILayout.Label("DMG  " + charValues.startClass.dmg);
        charValues.dmg = EditorGUILayout.IntSlider(charValues.dmg, -10, 10);
        GUILayout.Label("Tot: " + (charValues.startClass.dmg + charValues.dmg));
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        GUILayout.Label("MND  " + charValues.startClass.mnd);
        charValues.mnd = EditorGUILayout.IntSlider(charValues.mnd, -10, 10);
        GUILayout.Label("Tot: " + (charValues.startClass.mnd + charValues.mnd));
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        GUILayout.Label("SKL  " + charValues.startClass.skl);
        charValues.skl = EditorGUILayout.IntSlider(charValues.skl, -10, 10);
        GUILayout.Label("Tot: " + (charValues.startClass.skl + charValues.skl));
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        GUILayout.Label("SPD  " + charValues.startClass.spd);
        charValues.spd = EditorGUILayout.IntSlider(charValues.spd, -10, 10);
        GUILayout.Label("Tot: " + (charValues.startClass.spd + charValues.spd));
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        GUILayout.Label("DEF  " + charValues.startClass.def);
        charValues.def = EditorGUILayout.IntSlider(charValues.def, -10, 10);
        GUILayout.Label("Tot: " + (charValues.startClass.def + charValues.def));
        GUILayout.EndHorizontal();
        GUILayout.Label("Total base diff:  " + (charValues.hp + charValues.dmg + charValues.mnd + charValues.skl + charValues.spd + charValues.def));
    }
    private void ShowSupports()
    {
        CharEntry charValues = (CharEntry)entryValues;

        GUILayout.Label("Supports", EditorStyles.boldLabel);
        GUILayout.Space(5);
        for (int i = 0; i < charValues.supports.Count; i++)
        {
            GUILayout.Label("Support " + (i + 1));
            GUILayout.BeginHorizontal();
            charValues.supports[i].partner = (CharEntry)EditorGUILayout.ObjectField("Partner", charValues.supports[i].partner, typeof(CharEntry), false);
            if (GUILayout.Button("X", GUILayout.Width(50)))
            {
                GUI.FocusControl(null);
                charValues.supports.RemoveAt(i);
                i--;
            }
            GUILayout.EndHorizontal();

            if (charValues.supports[i].partner != null)
            {
                GUILayout.BeginHorizontal();
                EditorGUIUtility.labelWidth     = 70;
                charValues.supports[i].maxlevel = (SupportLetter)EditorGUILayout.EnumPopup("Max level", charValues.supports[i].maxlevel);
                charValues.supports[i].speed    = (SupportSpeed)EditorGUILayout.EnumPopup("Level", charValues.supports[i].speed);
                EditorGUIUtility.labelWidth     = 120;
                GUILayout.EndHorizontal();
            }

            LibraryEditorWindow.HorizontalLine(Color.black);
        }
        if (GUILayout.Button("+"))
        {
            charValues.supports.Add(new SupportTuple());
        }
    }
Esempio n. 21
0
    public void GenerateDamageActions()
    {
        TacticsMove attacker = attackerTile.value.currentCharacter;
        TacticsMove defender = defenderTile.value.currentCharacter;

        dialogue = null;
        if (defender == null)
        {
            showBattleAnim    = false;
            _currentCharacter = attacker;
            actions.Clear();
            actions.Add(new BattleAction(AttackSide.LEFT, BattleAction.Type.DAMAGE, attacker, defenderTile.value.blockMove));
            Debug.Log("BLOCK FIGHT!!");
        }
        else
        {
            showBattleAnim = useBattleAnimations.value;
            // Add battle init boosts
            attacker.ActivateSkills(SkillActivation.INITCOMBAT, defender);
            attacker.ActivateSkills(SkillActivation.PRECOMBAT, defender);
            defender.ActivateSkills(SkillActivation.COUNTER, attacker);
            defender.ActivateSkills(SkillActivation.PRECOMBAT, attacker);

            _currentCharacter = attacker;
            InventoryTuple atkTup = attacker.GetEquippedWeapon(ItemCategory.WEAPON);
            InventoryTuple defTup = defender.GetEquippedWeapon(ItemCategory.WEAPON);
            actions.Clear();
            actions.Add(new BattleAction(AttackSide.LEFT, BattleAction.Type.DAMAGE, attacker, defender));
            int range = Mathf.Abs(attacker.posx - defender.posx) + Mathf.Abs(attacker.posy - defender.posy);
            if (!string.IsNullOrEmpty(defTup.uuid) && defTup.currentCharges > 0 && defender.GetEquippedWeapon(ItemCategory.WEAPON).InRange(range))
            {
                actions.Add(new BattleAction(AttackSide.RIGHT, BattleAction.Type.DAMAGE, defender, attacker));
            }
            //Compare speeds
            int spdDiff = actions[0].GetSpeedDifference();
            if (spdDiff >= doublingSpeed.value)
            {
                if (atkTup.currentCharges > 1)
                {
                    actions.Add(new BattleAction(AttackSide.LEFT, BattleAction.Type.DAMAGE, attacker, defender));
                }
            }
            else if (spdDiff <= -doublingSpeed.value)
            {
                if (!string.IsNullOrEmpty(defTup.uuid) && defTup.currentCharges > 0 && defender.GetEquippedWeapon(ItemCategory.WEAPON).InRange(range))
                {
                    actions.Add(new BattleAction(AttackSide.RIGHT, BattleAction.Type.DAMAGE, defender, attacker));
                }
            }

            TacticsMove quoter    = (attacker.faction == Faction.ENEMY) ? attacker : defender;
            CharEntry   triggerer = (attacker.faction == Faction.ENEMY) ? defender.stats.charData : attacker.stats.charData;
            FightQuote  bestFind  = null;
            for (int q = 0; q < quoter.fightQuotes.Count; q++)
            {
                if (quoter.fightQuotes[q].triggerer == null)
                {
                    if (bestFind == null)
                    {
                        bestFind = quoter.fightQuotes[q];
                    }
                }
                else if (quoter.fightQuotes[q].triggerer == triggerer)
                {
                    bestFind = quoter.fightQuotes[q];
                    break;
                }
            }
            if (bestFind != null && !bestFind.activated)
            {
                dialogue           = bestFind.quote;
                bestFind.activated = true;
            }
        }
    }
Esempio n. 22
0
    /// <summary>
    /// Does the actual loading of all the data and puts it into the game.
    /// </summary>
    public void Load()
    {
        if (saveFileData == null)
        {
            Debug.LogError("There's no file to read!");
            return;
        }

        // Read simple data
        currentTotalDays.value = simpleTotalDays[saveIndex.value].value;
        currentPlayTime.value  = simplePlayTimes[saveIndex.value].value;

        // Read data in save file
        SaveData loadedData = saveFileData.saveFiles[saveIndex.value];

        currentMoney.value = loadedData.money;
        currentScrap.value = loadedData.scrap;

        // Read map data
        currentMission.value = missionLibrary.GetEntry(loadedData.mapData.missionString);
        mapIndex.value       = loadedData.mapData.mapIndex;
        loadMapID.value      = (currentMission.value != null) ? ((MissionEntry)currentMission.value).maps[mapIndex.value].uuid : "";
        squad1.values.Clear();
        for (int i = 0; i < loadedData.mapData.squad1.Count; i++)
        {
            squad1.values.Add(new PrepCharacter(loadedData.mapData.squad1[i]));
        }
        squad2.values.Clear();
        for (int i = 0; i < loadedData.mapData.squad2.Count; i++)
        {
            squad2.values.Add(new PrepCharacter(loadedData.mapData.squad2[i]));
        }

        // Read player data
        playerData.ResetData();
        for (int i = 0; i < loadedData.upgrade.Count; i++)
        {
            UpgradeEntry upgrade = (UpgradeEntry)upgradeLibrary.GetEntry(loadedData.upgrade[i].id);
            playerData.upgrader.upgrades.Add(new UpgradeItem(upgrade, loadedData.upgrade[i].researched));
        }
        for (int i = 0; i < loadedData.characters.Count; i++)
        {
            CharEntry  cStats = (CharEntry)characterLibrary.GetEntry(loadedData.characters[i].id);
            ClassEntry cClass = (ClassEntry)classLibrary.GetEntry(loadedData.characters[i].currentClass);
            playerData.stats.Add(new StatsContainer(loadedData.characters[i], cStats, cClass));
            playerData.inventory.Add(new InventoryContainer(itemLibrary, loadedData.characters[i], playerData.upgrader));
            playerData.skills.Add(new SkillsContainer(skillLibrary, loadedData.characters[i]));
            playerData.baseInfo.Add(new SupportContainer(loadedData.characters[i]));
        }
        for (int i = 0; i < loadedData.items.Count; i++)
        {
            ItemEntry item = (ItemEntry)itemLibrary.GetEntry(loadedData.items[i].id);
            playerData.items.Add(new InventoryItem(item, loadedData.items[i].charges));
        }
        for (int i = 0; i < loadedData.missions.Count; i++)
        {
            playerData.missions.Add(new MissionProgress(loadedData.missions[i].id, loadedData.missions[i].cleared));
        }
        playerData.upgrader.CalculateResearch();
        Debug.Log("Successfully loaded the save data!");
        loadFinishedEvent.Invoke();
    }
 public CharacterEditorWindow(ScrObjLibraryVariable entries, CharEntry container)
 {
     entryLibrary = entries;
     entryValues  = container;
     LoadLibrary();
 }
Esempio n. 24
0
        private bool InitializeChar(System.Drawing.Graphics graphics, int bitmapWidth, int bitmapHeight, System.Drawing.Font font, int fontSize, float xWidth, float xHeight, char c, FontStyle style, ref float currentX, ref float currentY)
        {
            var charKey = new CharKey(c, style);
            string s = new string(c, 1);

            if (char.IsWhiteSpace(c))
            {
                _charEntries[charKey] = new CharEntry { TextureWidth = graphics.MeasureString("X" + s + "X", font).Width - graphics.MeasureString("xx", font).Width };
                return true;
            }

            RectangleF charRectangle = MeasureRectangle(graphics, fontSize, font, s);
            float charWidth = charRectangle.Width, charHeight = charRectangle.Height;

            if (currentX + charWidth + xWidth > bitmapWidth)
            {
                currentX = 0;
                currentY += xHeight;

                if (currentY + xHeight > bitmapHeight)
                {
                    // We have run out of space in our image for further characters. This means we need a larger image texture --
                    // though on the other hand, we can't properly handle most Unicode characters anyway, so the whole approach
                    // might need rethinking.
                    return false;
                }
            }

            graphics.DrawString(s, font, Brushes.White, currentX + 0.5f * xWidth - charRectangle.Left, currentY);

            float measuredCharWidth = graphics.MeasureString("X" + s + "X", font).Width - graphics.MeasureString("XX", font).Width;

            _charEntries[charKey] = new CharEntry
            {
                TextureX = currentX / bitmapWidth,
                TextureY = currentY / bitmapHeight,
                TextureWidth = (charWidth + xWidth) / bitmapWidth,
                TextureHeight = charHeight / bitmapHeight,

                BoxLeft = 0.5f * xWidth / xHeight,
                BoxRight = (charWidth + 0.5f * xWidth) / xHeight,
                InnerWidth = measuredCharWidth / xHeight,
            };

            currentX += charWidth + xWidth;
            return true;
        }
    protected override void DrawContentWindow()
    {
        CharEntry charValues = (CharEntry)entryValues;

        GUILayout.BeginHorizontal();
        charValues.faction = (Faction)EditorGUILayout.EnumPopup("Character class faction", charValues.faction);
        GUILayout.EndHorizontal();

        GUILayout.Space(10);

        GUILayout.Label("Visuals", EditorStyles.boldLabel);
        GUILayout.BeginHorizontal(GUILayout.Height(64));
        charValues.portraitSet = (PortraitEntry)EditorGUILayout.ObjectField("Portrait set", charValues.portraitSet, typeof(PortraitEntry), false);
        if (charValues.portraitSet == null)
        {
            GUILayout.Label("NO PORTRAIT SET", EditorStyles.boldLabel, GUILayout.Width(160));
        }
        else if (charValues.portraitSet.small == null)
        {
            GUILayout.Label("INVALID PORTRAIT", EditorStyles.boldLabel, GUILayout.Width(160));
        }
        else
        {
            GUILayout.Label(charValues.portraitSet.small.texture, GUILayout.Width(160), GUILayout.Height(64));
        }
        GUILayout.EndHorizontal();

        GUILayout.Space(10);

        GUILayout.Label("Other values", EditorStyles.boldLabel);
        charValues.deathQuote  = (DialogueEntry)EditorGUILayout.ObjectField("Death Quote", charValues.deathQuote, typeof(DialogueEntry), false);
        charValues.mustSurvive = EditorGUILayout.Toggle("Must survive", charValues.mustSurvive);

        GUILayout.Space(10);

        GUILayout.Label("Class", EditorStyles.boldLabel);
        charValues.startClass = (ClassEntry)EditorGUILayout.ObjectField("Class", charValues.startClass, typeof(ClassEntry), false);
        GUILayout.Label("Class levels");
        if (charValues.startClassLevels.Length != ClassWheel.CLASS_COUNT)
        {
            charValues.startClassLevels = new int[ClassWheel.CLASS_COUNT];
        }
        if (charValues.faction == Faction.PLAYER)
        {
            for (int i = 0; i < ClassWheel.CLASS_COUNT; i++)
            {
                charValues.startClassLevels[i] = EditorGUILayout.IntField(((PlayerClassName)i).ToString(), charValues.startClassLevels[i]);
            }
        }
        if (charValues.faction == Faction.ENEMY)
        {
            for (int i = 0; i < ClassWheel.ENEMY_CLASS_COUNT; i++)
            {
                charValues.startClassLevels[i] = EditorGUILayout.IntField(((EnemyClassName)i).ToString(), charValues.startClassLevels[i]);
            }
        }
        if (charValues.faction == Faction.ALLY)
        {
            GUILayout.Label("Not implemented!");
        }

        GUILayout.Space(30);

        if (charValues.startClass != null && charValues.faction == Faction.PLAYER)
        {
            showStats = EditorGUILayout.Toggle("Show stats", showStats);
            if (showStats)
            {
                ShowBaseStats();
                ShowGrowths();
            }
            ShowSupports();
        }
    }
Esempio n. 26
0
 public StatsContainer(CharacterSaveData saveData, CharEntry cStats, ClassEntry charClass)
 {
     SetupValues(saveData, cStats, charClass);
 }