Exemplo n.º 1
0
 private void EntryCRDButton_Click(object sender, EventArgs e)
 {
     ActiveUpgrades      = new UpgradeIff();
     ActiveUpgrades.Name = ActiveRes.MainIff.Filename;
     UpdateFile();
     Save();
     Render();
 }
Exemplo n.º 2
0
        public void SetActiveObject(GameObject obj)
        {
            ActiveObj           = obj;
            ActiveRes           = obj.Resource;
            ActiveUpgrades      = Content.Content.Get().Upgrades?.GetFile(ActiveRes.MainIff.Filename);
            IffSpecificBox.Text = ActiveRes.MainIff.Filename;

            Render();
        }
        public void UpdateFile(UpgradeIff iff, bool forceLoad)
        {
            if (!ActiveFile.Files.Contains(iff))
            {
                ActiveFile.Files.Add(iff);
            }
            var runtime = new RuntimeUpgradeFile(iff);

            if (forceLoad)
            {
                runtime.Load(ContentManager);
            }
            FileUpgrades[iff.Name] = runtime;
        }
Exemplo n.º 4
0
        public RuntimeUpgradeFile(UpgradeIff file)
        {
            File = file;

            //generate configs.
            foreach (var config in File.Config)
            {
                uint guid;
                if (!uint.TryParse(config.GUID, System.Globalization.NumberStyles.HexNumber, null, out guid))
                {
                    throw new Exception("Invalid GUID for Upgrade! " + guid);
                }
                Configs[guid] = config;
            }
        }
Exemplo n.º 5
0
        public RuntimeUpgradeLevel(UpgradeIff file, UpgradeLevel level, GameObjectResource res, Content content)
        {
            Level = level;
            if (Level.Price.Length == 0)
            {
                throw new Exception("Missing price.");
            }
            if (Level.Price[0] == 'R' || Level.Price[0] == '$')
            {
                if (Level.Price[0] == 'R')
                {
                    Relative = true;
                }
                if (!int.TryParse(Level.Price.Substring(1), out Price))
                {
                    throw new Exception("Could parse literal upgrade level price! " + Level.Price);
                }
            }
            else
            {
                uint guid;
                if (!uint.TryParse(Level.Price, System.Globalization.NumberStyles.HexNumber, null, out guid))
                {
                    throw new Exception("Could parse guid for upgrade level price! " + Level.Price);
                }
                var item = content.WorldCatalog.GetItemByGUID(guid);
                if (item == null)
                {
                    throw new Exception("Could not find catalog entry for price reference! This error is fatal because a 0 price upgrade would be really bad." + Level.Price);
                }
                Price = (int)item.Value.Price;
            }

            Ads = Level.Ad.Split(';');

            Subs = RuntimeUpgradeFile.LoadSubs(Level.Subs, file.Groups, res);
        }