Exemplo n.º 1
0
 protected override void OnInitSkins()
 {
     Skins.Add("Xerath");
     Skins.Add("Runeborn Xerath");
     Skins.Add("Battlecast Xerath");
     Skins.Add("Scorched Earth Xerath");
 }
Exemplo n.º 2
0
        // --- Skins.

        public void AddSkin(Skin skin)
        {
            if (skin == null)
            {
                throw new ArgumentNullException("skin cannot be null.");
            }
            Skins.Add(skin);
        }
Exemplo n.º 3
0
 protected override void OnInitSkins()
 {
     Skins.Add("Ahri");
     Skins.Add("Dynasty Ahri");
     Skins.Add("Midnight Ahri");
     Skins.Add("Foxfire Ahri");
     Skins.Add("Popstar Ahri");
 }
Exemplo n.º 4
0
        public void Add(List <Identifier> idents, string relPath)
        {
            var ident = idents.FirstOrDefault();

            if (ident == null)
            {
                ExtraFiles.Add(relPath);
                return;
            }
            if (ident is SkinIdentifier skinId)
            {
                var skinIds = idents.Cast <SkinIdentifier>().ToList();
                if (skinIds.Count > 1)
                {
                    MultiSkinFiles.Add(relPath, skinIds);
                }
                else
                {
                    Skins.Add(relPath, ident as SkinIdentifier);
                }
            }
            else if (ident is PortraitIdentifier)
            {
                Portraits.Add(relPath, idents.Cast <PortraitIdentifier>());
            }
            else if (ident is CrosshairIdentifier)
            {
                Crosshairs.Add(relPath, idents.Cast <CrosshairIdentifier>());
            }
            else if (ident is WeaponIdentifier)
            {
                Weapons.Add(relPath, idents.Cast <WeaponIdentifier>());
            }
            else if (ident is EffectsIdentifier)
            {
                Effects.Add(relPath, idents.Cast <EffectsIdentifier>());
            }
            else if (ident is CanopyIdentifier)
            {
                Canopies.Add(relPath, idents.Cast <CanopyIdentifier>());
            }
            else if (ident is EmblemIdentifier)
            {
                Emblems.Add(relPath, idents.Cast <EmblemIdentifier>());
            }
            else if (ident is CockpitIdentifier)
            {
                Cockpits.Add(relPath, idents.Cast <CockpitIdentifier>());
            }
        }
Exemplo n.º 5
0
 public static void LoadSkins()
 {
     foreach (string svgPath in Directory.GetFiles("./skins", "*.svg"))
     {
         var svg = new SvgSkin();
         svg.Load(svgPath);
         Skins.Add(svg);
     }
     foreach (string padpyghtDir in Directory.GetDirectories("./skins"))
     {
         foreach (string iniPath in Directory.GetFiles(padpyghtDir, "*.ini"))
         {
             var pp = new PadpyghtSkin();
             pp.Load(iniPath);
             if (pp.LoadResult == SkinLoadResult.Ok)
             {
                 Skins.Add(pp);
             }
         }
     }
 }
Exemplo n.º 6
0
        public static void LoadSkins()
        {
            foreach (var dir in SkinFolders)
            {
                if (!Directory.Exists(dir.Path))
                {
                    continue;
                }

                if ((dir.Types & SkinType.Svg) != 0)
                {
                    foreach (string svgPath in Directory.GetFiles(dir.Path, "*.svg"))
                    {
                        var svg = new SvgSkin();
                        svg.Load(svgPath);
                        if (svg.LoadResult == SkinLoadResult.Ok)
                        {
                            Skins.Add(svg);
                            var b = new BindingList <ColorRemap>();
                            foreach (var map in svg.EmbeddedRemaps)
                            {
                                b.Add(map);
                            }
                            AvailableRemaps[svg.Path] = b;
                            SelectedRemaps[svg]       = null;
                        }
                    }
                }

                if ((dir.Types & SkinType.PadPyght) != 0)
                {
                    foreach (string padpyghtDir in Directory.GetDirectories(dir.Path))
                    {
                        foreach (string iniPath in Directory.GetFiles(padpyghtDir, "*.ini"))
                        {
                            var pp = new PadpyghtSkin();
                            pp.Load(iniPath);
                            if (pp.LoadResult == SkinLoadResult.Ok)
                            {
                                Skins.Add(pp);
                            }
                        }
                    }
                }

                if ((dir.Types & SkinType.NintendoSpy) != 0)
                {
                    foreach (string nspyDir in Directory.GetDirectories(dir.Path))
                    {
                        foreach (string xmlPath in Directory.GetFiles(nspyDir, "skin.xml"))
                        {
                            var pp = new NintendoSpySkin();
                            pp.Load(xmlPath);
                            if (pp.LoadResult == SkinLoadResult.Ok)
                            {
                                Skins.Add(pp);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 7
0
        // Pit Functions


        


   

























        private IEnumerator<bool> Init()
        {

            Skins.Clear();
            ShipData.Clear();
            InitProblemBlockNames.Clear();

            blocks = new List<IMyTerminalBlock>();
            GridTerminalSystem.GetBlocksOfType(blocks, x => x.IsSameConstructAs(Me));


            var sprites = new List<string>();

            foreach (var block in blocks)
            {
                if (block is IMyShipController)
                {
                    var contr = block as IMyShipController;
                    if (contr.CanControlShip)
                    {
                        if (Controller == null)
                        {
                            //Take any controller just to have one.
                            Controller = contr;
                        }
                        if (contr.IsMainCockpit)
                        {
                            //If a main one is defined, use that.
                            Controller = contr;
                        }
                    }
                }

                var surfaceProvider = block as IMyTextSurfaceProvider;
                if (surfaceProvider != null && surfaceProvider.SurfaceCount > 0)
                {
                    //Get all textures, might be needed in the ini parser
                    if (sprites.Count == 0)
                    {
                        surfaceProvider.GetSurface(0).GetSprites(sprites);
                    }

                    //Has Surface, check custom data

                    Ini ini = new Ini(block.CustomData, surfaceProvider.SurfaceCount, sprites, Preloads);
                    //Skins will be added to the Skins list in ParseIni

                    while (true)
                    {
                        if (ini.ParserDone() == true)
                        {
                            break;
                        }
                        else
                        {
                            if (OverInstructionLimit()) yield return true;
                        }
                    }

                    if (!ini.NoErrors)
                    {
                        //TODO
                        InitProblemBlockNames.Add(block.CustomName);
                    }
                    block.CustomData = ini.Processed;

                    foreach (var skinDef in ini.SkinDataList)
                    {
                        if (skinDef.screenId < surfaceProvider.SurfaceCount)
                        {
                            var surface = surfaceProvider.GetSurface(skinDef.screenId);
                            var sm = new SurfaceMath(surface);
                            var meters = new List<IMeter>();
                            foreach (var meter in skinDef.meters)
                            {
                                if (meter.type == Meter.Text)
                                {
                                    RegisterDataPoint(meter.data);
                                    meters.Add(new MeterText(sm, meter, ShipData));
                                }
                                else if (meter.type == Meter.Value)
                                {
                                    RegisterDataPoint(meter.data);
                                    meters.Add(new MeterValue(sm, meter, ShipData));
                                }
                                else if (meter.type == Meter.Bar)
                                {
                                    RegisterDataPoint(meter.data);
                                    meters.Add(new MeterBar(sm, meter, ShipData));
                                }
                                else if (meter.type == Meter.LineGraph)
                                {
                                    RegisterDataPoint(meter.data);
                                    meters.Add(new MeterLineGraph(sm, meter, ShipData));
                                }
                                else if (meter.type == Meter.Meter)
                                {
                                    RegisterDataPoint(meter.data);
                                    meters.Add(new MeterMeter(sm, meter, ShipData, (skinDef.backgroundColorSet ? skinDef.backgroundColor : surface.ScriptBackgroundColor)));
                                }
                                else if (meter.type == Meter.HalfMeter)
                                {
                                    RegisterDataPoint(meter.data);
                                    meters.Add(new MeterHalfMeter(sm, meter, ShipData, (skinDef.backgroundColorSet ? skinDef.backgroundColor : surface.ScriptBackgroundColor)));
                                }
                                else if (meter.type == Meter.ThreeQuaterMeter)
                                {
                                    RegisterDataPoint(meter.data);
                                    meters.Add(new MeterThreeQuaterMeter(sm, meter, ShipData, (skinDef.backgroundColorSet ? skinDef.backgroundColor : surface.ScriptBackgroundColor)));
                                }
                                else if (meter.type == Meter.Sprite)
                                {
                                    RegisterDataPoint(meter.data);
                                    meters.Add(new MeterSprite(sm, meter, ShipData));
                                }
                                else if (meter.type == Meter.Action)
                                {
                                    RegisterDataPoint(meter.data);
                                    meters.Add(new MeterAction(sm, meter, ShipData, blocks, GridTerminalSystem, Me));
                                }

                            }
                            Skins.Add(new Skin(this, surface, sm, block, skinDef, meters));
                        }
                    }

                    /* Adding all isn't what we want.
					for (int i = 0; i < surfaceProvider.SurfaceCount; i++)
					{
						Skins.Add(new Skin(this, surfaceProvider.GetSurface(i), i, block));
					}
					*/
                }
            }

            DrawStateMachine = Draw();
            Initialized++;
            yield return false;
        }
Exemplo n.º 8
0
        private void Read(BinaryReader br, Dictionary <string, BinaryReader> sequenceGroups)
        {
            Header = new Header
            {
                ID             = ID.Idst,
                Version        = Version.Goldsource,
                Name           = br.ReadFixedLengthString(Encoding.ASCII, 64),
                Size           = br.ReadInt32(),
                EyePosition    = br.ReadVector3(),
                HullMin        = br.ReadVector3(),
                HullMax        = br.ReadVector3(),
                BoundingBoxMin = br.ReadVector3(),
                BoundingBoxMax = br.ReadVector3(),
                Flags          = br.ReadInt32()
            };

            // Read all the nums/offsets from the header
            var sections = new int[(int)Section.NumSections][];

            for (var i = 0; i < (int)Section.NumSections; i++)
            {
                var sec = (Section)i;

                int indexNum;
                if (sec == Section.Texture || sec == Section.Skin)
                {
                    indexNum = 3;
                }
                else
                {
                    indexNum = 2;
                }

                sections[i] = new int[indexNum];
                for (var j = 0; j < indexNum; j++)
                {
                    sections[i][j] = br.ReadInt32();
                }
            }

            // Bones
            var num      = SeekToSection(br, Section.Bone, sections);
            var numBones = num;

            for (var i = 0; i < num; i++)
            {
                var bone = new Bone
                {
                    Name          = br.ReadFixedLengthString(Encoding.ASCII, 32),
                    Parent        = br.ReadInt32(),
                    Flags         = br.ReadInt32(),
                    Controllers   = br.ReadIntArray(6),
                    Position      = br.ReadVector3(),
                    Rotation      = br.ReadVector3(),
                    PositionScale = br.ReadVector3(),
                    RotationScale = br.ReadVector3()
                };
                Bones.Add(bone);
            }

            // Bone controllers
            num = SeekToSection(br, Section.BoneController, sections);
            for (var i = 0; i < num; i++)
            {
                var boneController = new BoneController
                {
                    Bone  = br.ReadInt32(),
                    Type  = br.ReadInt32(),
                    Start = br.ReadSingle(),
                    End   = br.ReadSingle(),
                    Rest  = br.ReadInt32(),
                    Index = br.ReadInt32()
                };
                BoneControllers.Add(boneController);
            }

            // Hitboxes
            num = SeekToSection(br, Section.Hitbox, sections);
            for (var i = 0; i < num; i++)
            {
                var hitbox = new Hitbox
                {
                    Bone  = br.ReadInt32(),
                    Group = br.ReadInt32(),
                    Min   = br.ReadVector3(),
                    Max   = br.ReadVector3()
                };
                Hitboxes.Add(hitbox);
            }

            // Sequence groups
            num = SeekToSection(br, Section.SequenceGroup, sections);
            for (var i = 0; i < num; i++)
            {
                var group = new SequenceGroup
                {
                    Label = br.ReadFixedLengthString(Encoding.ASCII, 32),
                    Name  = br.ReadFixedLengthString(Encoding.ASCII, 64)
                };
                br.ReadBytes(8); // unused
                SequenceGroups.Add(group);
            }

            // Sequences
            num = SeekToSection(br, Section.Sequence, sections);
            for (var i = 0; i < num; i++)
            {
                var sequence = new Sequence
                {
                    Name                  = br.ReadFixedLengthString(Encoding.ASCII, 32),
                    Framerate             = br.ReadSingle(),
                    Flags                 = br.ReadInt32(),
                    Activity              = br.ReadInt32(),
                    ActivityWeight        = br.ReadInt32(),
                    NumEvents             = br.ReadInt32(),
                    EventIndex            = br.ReadInt32(),
                    NumFrames             = br.ReadInt32(),
                    NumPivots             = br.ReadInt32(),
                    PivotIndex            = br.ReadInt32(),
                    MotionType            = br.ReadInt32(),
                    MotionBone            = br.ReadInt32(),
                    LinearMovement        = br.ReadVector3(),
                    AutoMovePositionIndex = br.ReadInt32(),
                    AutoMoveAngleIndex    = br.ReadInt32(),
                    Min            = br.ReadVector3(),
                    Max            = br.ReadVector3(),
                    NumBlends      = br.ReadInt32(),
                    AnimationIndex = br.ReadInt32(),
                    BlendType      = br.ReadIntArray(2),
                    BlendStart     = br.ReadSingleArray(2),
                    BlendEnd       = br.ReadSingleArray(2),
                    BlendParent    = br.ReadInt32(),
                    SequenceGroup  = br.ReadInt32(),
                    EntryNode      = br.ReadInt32(),
                    ExitNode       = br.ReadInt32(),
                    NodeFlags      = br.ReadInt32(),
                    NextSequence   = br.ReadInt32()
                };

                var seqGroup = SequenceGroups[sequence.SequenceGroup];

                // Only load seqence group 0 for now (others are in other files)
                if (sequence.SequenceGroup == 0)
                {
                    var pos = br.BaseStream.Position;
                    sequence.Blends        = LoadAnimationBlends(br, sequence, numBones);
                    br.BaseStream.Position = pos;
                }
                else if (sequenceGroups.ContainsKey(seqGroup.Name))
                {
                    var reader = sequenceGroups[seqGroup.Name];
                    sequence.Blends = LoadAnimationBlends(reader, sequence, numBones);
                }

                Sequences.Add(sequence);
            }

            // Textures
            num = SeekToSection(br, Section.Texture, sections);
            var firstTextureIndex = Textures.Count;

            for (var i = 0; i < num; i++)
            {
                var texture = new Texture
                {
                    Name   = br.ReadFixedLengthString(Encoding.ASCII, 64),
                    Flags  = (TextureFlags)br.ReadInt32(),
                    Width  = br.ReadInt32(),
                    Height = br.ReadInt32(),
                    Index  = br.ReadInt32()
                };
                Textures.Add(texture);
            }

            // Texture data
            for (var i = firstTextureIndex; i < firstTextureIndex + num; i++)
            {
                var t = Textures[i];
                br.BaseStream.Position = t.Index;
                t.Data      = br.ReadBytes(t.Width * t.Height);
                t.Palette   = br.ReadBytes(256 * 3);
                Textures[i] = t;
            }

            // Skins
            var skinSection     = sections[(int)Section.Skin];
            var numSkinRefs     = skinSection[0];
            var numSkinFamilies = skinSection[1];

            br.BaseStream.Seek(skinSection[2], SeekOrigin.Begin);
            for (var i = 0; i < numSkinFamilies; i++)
            {
                var skin = new SkinFamily
                {
                    Textures = br.ReadShortArray(numSkinRefs)
                };
                Skins.Add(skin);
            }

            // Body parts
            num = SeekToSection(br, Section.BodyPart, sections);
            for (var i = 0; i < num; i++)
            {
                var part = new BodyPart
                {
                    Name       = br.ReadFixedLengthString(Encoding.ASCII, 64),
                    NumModels  = br.ReadInt32(),
                    Base       = br.ReadInt32(),
                    ModelIndex = br.ReadInt32()
                };
                var pos = br.BaseStream.Position;
                part.Models            = LoadModels(br, part);
                br.BaseStream.Position = pos;
                BodyParts.Add(part);
            }

            // Attachments
            num = SeekToSection(br, Section.Attachment, sections);
            for (var i = 0; i < num; i++)
            {
                var attachment = new Attachment
                {
                    Name    = br.ReadFixedLengthString(Encoding.ASCII, 32),
                    Type    = br.ReadInt32(),
                    Bone    = br.ReadInt32(),
                    Origin  = br.ReadVector3(),
                    Vectors = br.ReadVector3Array(3)
                };
                Attachments.Add(attachment);
            }

            // Transitions

            // Sounds & Sound groups aren't used
        }
Exemplo n.º 9
0
        /*####################################################################*/
        /*                          Skin Management                           */
        /*####################################################################*/

        internal void AddSkin(string name, Skin skin)
        {
            Skins.Add(name, skin);
        }