Ejemplo n.º 1
0
        public void ParseDefinition(byte[] data, int version)
        {
            HeroDefinition definition = HeroDefinition.Create(data, version);

            if (definition != null)
            {
                this.definitions[definition.Id] = definition;
                string key = string.Empty;
                if (string.IsNullOrEmpty(definition.Name))
                {
                    key = definition.Id.ToString();
                }
                else
                {
                    key = definition.Name;
                }
                this.DefinitionsByName[definition.Type][key] = definition;

                //Extension point
                if (addNodeAction != null)
                {
                    this.addNodeAction(definition);
                }

                if (definition.Type == HeroDefinition.Types.Node)
                {
                    this.AddNode(definition as HeroNodeDef);
                }
            }
        }
Ejemplo n.º 2
0
        protected SkinSet(HeroDefinition heroLock, Type headSkin, Type bodySkin, Type legsSkin)
        {
            HeroLock = heroLock;

            HeadSkin = headSkin;
            BodySkin = bodySkin;
            LegsSkin = legsSkin;
        }
Ejemplo n.º 3
0
        public override string ToString()
        {
            HeroDefinition definitionId = GOM.Instance.LookupDefinitionId(this.Id);

            if (definitionId != null)
            {
                return(definitionId.ToString());
            }
            return(string.Format("0x{0:X8}", this.Id));
        }
Ejemplo n.º 4
0
        public override string ToString()
        {
            HeroDefinition heroDefinition = GOM.Instance.LookupDefinitionId(this.Id);

            if (heroDefinition != null)
            {
                return(heroDefinition.ToString());
            }
            else
            {
                return(string.Format("0x{0:X8}", (object)this.Id));
            }
        }
Ejemplo n.º 5
0
        public void ParseDefinition(byte[] data, int version)
        {
            HeroDefinition heroDefinition = HeroDefinition.Create(data, version);

            if (heroDefinition == null)
            {
                return;
            }
            this.definitions[heroDefinition.Id] = heroDefinition;
            this.DefinitionsByName[heroDefinition.Type][heroDefinition.Name] = heroDefinition;
            if (heroDefinition.Type != HeroDefinition.Types.Node)
            {
                return;
            }
            this.AddNode(heroDefinition as HeroNodeDef);
        }
Ejemplo n.º 6
0
        private void SaveHeroes(TagCompound tag)
        {
            HeroDefinition hero = HeroSelectionUIState.SelectedHero;

            if (!HeroSelected && hero != null)
            {
                Hero = hero;

                HeroSelectionUIState.SelectedHero = null;
                HeroSelected = true;
            }

            tag.Add(nameof(Hero), Hero.UnlocalizedName);
            tag.Add(nameof(HeroSelected), HeroSelected);

            SaveShadowFiend(tag);
        }
Ejemplo n.º 7
0
    public void ShowHeroLevels(HeroDefinition definition, Vector3 position)
    {
        HideHeroLevels();
        int count = definition.levels.Count;

        Add(_heroLevels = new Layout("HeroLevels", 3, count + 1, 0.25f, 0.1f, count + 1, container));
        _heroLevels.SetPosition(position + (Vector3.right * _heroLevels.width * 0.5f) + (Vector3.back * _heroLevels.height * 0.5f));

        _heroLevels.Add(new List <Button>(
                            Button.GetButtons(count,
                                              (int index) => new Button("Level " + index, 3, 1, container, "Item", fontSize: 20,
                                                                        Enter: (Button button) => button.SetColor(button.selected ? button.color : Color.green),
                                                                        Stay: (Button button) =>
        {
            if (Input.GetMouseButtonDown(0))
            {
                _selectedHero  = definition;
                _selectedLevel = index;
                ShowHeroEditor();
                HideHeroLevels();
            }
        },
                                                                        Exit: (Button button) => button.SetColor(button.selected ? button.color : Color.white))))
        {
            new Button("Add Hero Level", 3, 1, container, "AddHeroLevel", fontSize: 20,
                       Enter: ( Button button ) => button.SetColor(Color.green),
                       Stay: ( Button button ) =>
            {
                if (Input.GetMouseButtonDown(0))
                {
                    definition.AddLevel();
                    ShowHeroLevels(definition, position);
                }
            },
                       Exit: ( Button button ) => button.SetColor(Color.white))
        }, true);
    }
Ejemplo n.º 8
0
 public void AddHero(Lane lane, HeroDefinition heroDefinition) => lane.Add(new Hero(heroDefinition, new HeroSettings(Color.white, 3), lane));
Ejemplo n.º 9
0
 public Hero(HeroDefinition definition, HeroSettings settings, Lane lane) : base(definition.name, 0, definition.width, definition.laneHeightPadding, settings.health, 0, lane)
 {
     position = lane.end + (Vector3.left * ((definition.width * 0.5f) + 3));
     color    = settings.color;
 }
 private void SelectHero(HeroDefinition hero)
 {
     SelectedHero  = hero;
     Main.menuMode = 2;
 }