示例#1
0
        public OtherPlayerEntity(CharacterPlayer others) : base(others._name)
        {
            others.MaxHealth = 100;

            other = others;
            TextComponent textComponent = new TextComponent(Graphics.Instance.BitmapFont, others._name, Vector2.Zero, Color.White);

            //HealthtextComponent = new TextComponent(Graphics.Instance.BitmapFont, others.CurrentHealth.ToString(), Vector2.Zero, Color.White);

            this.SetPosition(others.physicalPosition);
            AddComponent(new OtherPlayerComponent(others));
            AddComponent(textComponent);
            //AddComponent(HealthtextComponent).SetHorizontalAlign(HorizontalAlign.Left).SetVerticalAlign(VerticalAlign.Bottom).SetRenderLayer(-2);
            SetTag(7);
            this.SetScale(3.5f);

            SpriteAnimation Idle     = TextureContainer.GetSpriteAtlasByName("Knight").GetAnimation("Idle");
            SpriteAnimation Movement = TextureContainer.GetSpriteAtlasByName("Knight").GetAnimation("Movement");

            SpriteAnimator animator = AddComponent <SpriteAnimator>();

            animator.AddAnimation("Idle", Idle);
            animator.AddAnimation("Movement", Movement);
            animator.Play("Idle");
        }
        public ModifyPAT0Dialog(TextureContainer tx)
        {
            InitializeComponent();
            textures = tx;
            AcceptButton = btnOkay;

            if (textures.seriesicon.pat0 == null) {
                selchrBox.Enabled = false;
            } else {
                var i4 = from tex in textures.TEX0Folder.Children
                         where tex is TEX0Node && ((TEX0Node)tex).Format == WiiPixelFormat.I4
                         orderby !tex.Name.Contains("MenSelchrMark") && !tex.Name.Contains("SeriesIcon"), tex.Name
                         select tex.Name;
                selchrList = i4.ToList();
                selchrBox.DataSource = selchrList;
                if (textures.seriesicon.tex0 != null) selchrBox.SelectedItem = textures.seriesicon.tex0.Name;
                selchrBox.Enabled = true;
            }

            if (textures.selmap_mark.pat0 == null) {
                selmapBox.Enabled = false;
            } else {
                var ia4 = from tex in textures.TEX0Folder.Children
                          where tex is TEX0Node && SelmapMarkFormats.Contains(((TEX0Node)tex).Format)
                          orderby !tex.Name.Contains("MenSelmapMark"), tex.Name
                          select tex.Name;
                selmapList = ia4.ToList();
                selmapBox.DataSource = selmapList;
                if (textures.selmap_mark.tex0 != null) selmapBox.SelectedItem = textures.selmap_mark.tex0.Name;
                selmapBox.Enabled = true;
            }
        }
示例#3
0
        public void ExportImages(int p, string thisdir)
        {
            TextureContainer texs = get_icons(p);

            if (texs == null)
            {
                return;
            }

            if (texs.prevbase.tex0 != null)
            {
                texs.prevbase.tex0.Export(thisdir + "/MenSelmapPrevbase.png");
            }
            if (texs.icon.tex0 != null)
            {
                texs.icon.tex0.Export(thisdir + "/MenSelmapIcon.png");
            }
            if (texs.frontstname.tex0 != null)
            {
                texs.frontstname.tex0.Export(thisdir + "/MenSelmapFrontStname.png");
            }
            if (texs.seriesicon.tex0 != null)
            {
                texs.seriesicon.tex0.Export(thisdir + "/MenSelchrMark.png");
            }
            if (texs.selmap_mark.tex0 != null)
            {
                texs.selmap_mark.tex0.Export(thisdir + "/MenSelmapMark.png");
            }
        }
        public AbilityAnimationEntity(AbilityHead ability, Entity target, Vector2 source)
        {
            this.ability = ability;
            this.target  = target;
            this.SetScale(0.25f);
            this.source = source;

            switch (ability.ID)
            {
            case 1:
                animation = TextureContainer.GetSpriteAtlasByName("FireBall").GetAnimation("travel");
                break;

            default:
                break;
            }

            float deltaX = target.Position.X - source.X;

            this.SetPosition(source);
            animator = AddComponent <SpriteAnimator>();
            if (deltaX > 0)
            {
                animator.FlipX = true;
            }
            animator.AddAnimation("travel", animation);
            animator.Play("travel");
        }
示例#5
0
        /// <summary>
        /// Automatically updates texture flags
        /// </summary>
        private void UpdateTextureFlags()
        {
            TextureContainer prev = null;

            _mobj.Textures = null;

            var index = 0;

            foreach (TextureContainer c in listTexture.Items)
            {
                if (prev == null)
                {
                    _mobj.Textures = c.TOBJ;
                }
                else
                {
                    prev.TOBJ.Next = c.TOBJ;
                }

                c.TOBJ.GXTexGenSrc = 4 + index;
                c.TOBJ.TexMapID    = HSDRaw.GX.GXTexMapID.GX_TEXMAP0 + index++;

                prev = c;
            }

            if (prev != null)
            {
                prev.TOBJ.Next = null;
            }
        }
示例#6
0
        public InventoryWindow(Skin skin, Vector2 position, float width = -1, float height = -1, string title = "Inventory", string styleName = null) : base(title, skin, styleName)
        {
            sprite = TextureContainer.GetSpriteAtlasByName("UI").GetSprite("bg_01_02");
            SetMovable(true);
            SetResizable(true);
            SetResizeBorderSize(20);
            AddItems(skin);
            Pack();

            if (width != -1)
            {
                SetWidth(width);
            }
            if (height != -1)
            {
                SetHeight(height);
            }
            if (position == new Vector2(-1, -1))
            {
                SetPosition(Core.GraphicsDevice.Viewport.Width - GetWidth(), Core.GraphicsDevice.Viewport.Height - GetHeight());
            }
            else
            {
                SetPosition(position.X, position.Y);
            }
            NinePatchDrawable drawable = new NinePatchDrawable(sprite, 0, 0, 0, 0)
            {
                MinHeight = this.MinHeight, MinWidth = this.MinWidth
            };

            SetBackground(drawable);
        }
示例#7
0
        private void ReloadData()
        {
            if (sss.OtherCodesIgnoredInSameFile > 0)
            {
                MessageBox.Show(this, "More than one Custom SSS code found in the codeset. All but the last one will be ignored.",
                                this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            var screen1     = new List <StagePair>();
            var screen2     = new List <StagePair>();
            var definitions = new List <StagePair>();

            for (int i = 0; i < sss.sss3.Length; i += 2)
            {
                definitions.Add(new StagePair {
                    stage = sss.sss3[i],
                    icon  = sss.sss3[i + 1],
                });
            }
            foreach (byte b in sss.sss1)
            {
                screen1.Add(definitions[b]);
            }
            foreach (byte b in sss.sss2)
            {
                screen2.Add(definitions[b]);
            }

            PairListModel model = new PairListModel();

            for (int i = 0; i < model.songsByStage.Length; i++)
            {
                model.songsByStage[i] = sss.SongLoaders.GetSong(i);
            }
            for (int i = 0; i < model.icons.Length; i++)
            {
                var tex = new TextureContainer(md80, i);
                if (tex.icon_tex0 != null)
                {
                    using (MemoryStream ms = new MemoryStream()) {
                        tex.icon_tex0.GetImage(0).Save(ms, ImageFormat.Png);
                        model.icons[i] = ms.ToArray();
                    }
                }
            }
            for (int i = 0; i < definitions.Count; i++)
            {
                StagePair pair = definitions[i];
                model.pairs.Add(new ModelPair {
                    icon   = pair.icon,
                    stage  = pair.stage,
                    origId = i
                });
            }
            model.screen1 = sss.sss1;
            model.screen2 = sss.sss2;

            html = webBrowser1.DocumentText = RazorEngine.Engine.Razor.RunCompile(Resources.PairList, "PairList", typeof(PairListModel), model);
        }
        private void ReloadIcons()
        {
            if (miscdata80 == null)
            {
                return;
            }
            CHR0Node chr0 = miscdata80.FindChild("AnmChr(NW4R)/MenSelmapPos_TopN__" + (MyMusic ? "1" : "0"), false) as CHR0Node;

            if (chr0 == null)
            {
                return;
            }

            icons = new Tuple <Image, RectangleF> [_numIcons + 1];

            CHR0EntryNode entry  = chr0.FindChild("MenSelmapPos_TopN", false) as CHR0EntryNode;
            Vector3       offset = entry.GetAnimFrame(_numIcons + OFFSET).Translation;

            for (int i = 1; i <= _numIcons; i++)
            {
                entry = chr0.FindChild("pos" + i.ToString("D2"), false) as CHR0EntryNode;
                CHRAnimationFrame frame = entry.GetAnimFrame(_numIcons + OFFSET, true);
                float             x     = (BRAWLWIDTH / 2 + frame.Translation._x + offset._x) / BRAWLWIDTH;
                float             y     = (BRAWLHEIGHT / 2 - frame.Translation._y - offset._y) / BRAWLHEIGHT;
                float             w     = 6.4f * (frame.Scale._x) / BRAWLWIDTH;
                float             h     = 5.6f * (frame.Scale._y) / BRAWLHEIGHT;
                RectangleF        r     = new RectangleF(x, y, w, h);

                TextureContainer tc = new TextureContainer(miscdata80,
                                                           IconOrder != null && i <= IconOrder.Length ? IconOrder[i - 1] : 100);
                if (tc.icon.tex0 == null)
                {
                    continue;
                }
                Image image = tc.icon.tex0.GetImage(0);

                icons[i] = new Tuple <Image, RectangleF>(image, r);
            }

            var nexttex0 = miscdata80.FindChild("Textures(NW4R)/MenSelmapIcon_Change.1", false) as TEX0Node;

            if (nexttex0 != null)
            {
                float NEXTOFFSET = 10.8f;
                entry = chr0.FindChild("pos" + (_numIcons + 1).ToString("D2"), false) as CHR0EntryNode;
                CHRAnimationFrame frame2 = entry.GetAnimFrame(_numIcons + OFFSET, true);
                float             x2     = (BRAWLWIDTH / 2 + frame2.Translation._x - NEXTOFFSET) / BRAWLWIDTH;
                float             y2     = (BRAWLHEIGHT / 2 - frame2.Translation._y) / BRAWLHEIGHT;
                float             w2     = 14.4f * (frame2.Scale._x) / BRAWLWIDTH;
                float             h2     = 4.8f * (frame2.Scale._y) / BRAWLHEIGHT;
                RectangleF        r2     = new RectangleF(x2, y2, w2, h2);
                Image             image2 = nexttex0.GetImage(0);
                icons[0] = new Tuple <Image, RectangleF>(image2, r2);                //pos00 is not used anyway, so let's overwrite it
            }

            this.Invalidate();
        }
示例#9
0
        public MapWindow(Texture2D MapTex)
        {
            this.WM     = Main.CurrentScene.WindowManager;
            this.Width  = 820;
            this.Height = 830;
            TextureContainer map = new TextureContainer(MapTex, WM);

            AddControl(map);
            map.OnClick += new ClickEventHandler((sender, m) => GoToMap(m.X, m.Y));
        }
    // Use this for initialization
    void Start()
    {
        GameObject texContainerObject = GameObject.Find("00_TextureContainer");
        texContainer = texContainerObject.GetComponentInChildren<TextureContainer>();

        if (lage == 19) isHidden = false;

        //texContainer = texContainerObject.GetComponent<TextureContainer>();

        LoadTexture();
    }
示例#11
0
        private void AddItems(Skin skin)
        {
            var textButtonStyle = new ImageButtonStyle
            {
                Up             = new PrimitiveDrawable(Color.DarkGray, 6, 2),
                Over           = new PrimitiveDrawable(Color.DimGray),
                Down           = new PrimitiveDrawable(Color.DimGray),
                PressedOffsetX = 0,
                PressedOffsetY = 0
            };

            int count = 0;

            foreach (var i in LoginManagerClient.GetCharacter().Equipment)
            {
                float f = GetWidth();
                if (count % 5 == 0)
                {
                    Row();
                }
                if (i != null && i.GetSprite() == null)
                {
                    i.SetSprite(TextureContainer.GetSpriteAtlasByName("Items").GetSprite(i.TextureName));
                }

                if (i != null)
                {
                    SpriteDrawable    spd = new SpriteDrawable(i.GetSprite());
                    NinePatchDrawable ninePatchDrawable = new NinePatchDrawable(i.GetSprite(), 0, 0, 0, 0)
                    {
                        MinHeight = 48, MinWidth = 48
                    };

                    ItemButton imButton = new ItemButton(ninePatchDrawable, count, i);

                    imButton.SetTouchable(Touchable.Enabled);
                    imButton.OnHovered += delegate { OnHovered(imButton, i, skin, stage); };
                    imButton.OnExited  += delegate { OnExit(imButton, stage); };
                    imButton.OnMoved   += delegate { OnMovedAndHovered(imButton); };
                    imButton.OnClicked += delegate { OnClickedCharacter(imButton); };
                    Add(imButton).Size(48, 48).Pad(4).Expand();
                }
                else
                {
                    ItemButton imButton = new ItemButton(textButtonStyle, count, null);
                    imButton.Add(new Label("")).Expand().Left().SetAlign(Nez.UI.Align.BottomLeft);
                    imButton.SetTouchable(Touchable.Disabled);
                    Add(imButton).Size(48, 48).Pad(4).Expand();
                }
                count++;
            }
        }
示例#12
0
        void RegisterTexture(TextureContainer n)
        {
            // create image
            var imageNode = new ImageElem(n);

            root.SharedNodeTable.Add(imageNode, n.InstanceId);

            // create texture
            var texNode = new TextureElem(n);

            texNode.Image = imageNode;
            root.SharedNodeTable.Add(texNode, n.InstanceId);
        }
 void VisitToCreateTexture(IEnumerable <MaterialContainer> materials)
 {
     foreach (var material in materials)
     {
         foreach (var tex in material.Textures)
         {
             if (!containerTable.Contains <TextureContainer>(tex.GetInstanceID()))
             {
                 var c = new TextureContainer(tex);
                 containerTable.Add(c.InstanceId, c);
             }
         }
     }
 }
示例#14
0
    // Use this for initialization
    void Start()
    {
        GameObject texContainerObject = GameObject.Find("00_TextureContainer");

        texContainer = texContainerObject.GetComponentInChildren <TextureContainer>();

        if (lage == 19)
        {
            isHidden = false;
        }

        //texContainer = texContainerObject.GetComponent<TextureContainer>();

        LoadTexture();
    }
示例#15
0
        public void UpdateImage(int iconNum)
        {
            if (btnGenerateName.InvokeRequired)
            {
                this.Invoke((MethodInvoker)(() => { UpdateImage(iconNum); }));
                return;
            }

            prevbase.BackgroundImage = null;
            _iconNum = -1;

            TextureContainer retval = get_icons(iconNum);

            if (retval == null)
            {
            }
            else
            {
                textures = retval ?? new TextureContainer();
                foreach (Control child in flowLayoutPanel1.Controls)
                {
                    if (child is ImagePreviewPanel)
                    {
                        setBG(child as ImagePreviewPanel);
                    }
                }

                btnGenerateName.Visible = (textures.prevbase.tex0 != null);
                lblIconTex.Text         = "Icon no.: " + iconNum;

                var tex = textures.icon.tex0;
                var pal = tex == null ? null : textures.icon.tex0.GetPaletteNode();
                if (textures.prevbase.tex0 != null && textures.frontstname.tex0 != null)
                {
                    label1.Text = "P: " + textures.prevbase.tex0.ToSizeString()
                                  + ", F: " + textures.frontstname.tex0.ToSizeString()
                                  + ", icon: " + (pal == null ? "null" : pal.Colors + "c")
                                  + "\nmark: " + textures.selmap_mark.tex0.ToSizeString();
                    if (textures.selmap_mark.tex0 != null)
                    {
                        label1.Text += " " + textures.selmap_mark.tex0.Format;
                    }
                }

                _iconNum = iconNum;
            }
        }
示例#16
0
        public ModifyPAT0Dialog(TextureContainer tx)
        {
            InitializeComponent();
            textures     = tx;
            AcceptButton = btnOkay;

            if (textures.seriesicon.pat0 == null)
            {
                selchrBox.Enabled = false;
            }
            else
            {
                IEnumerable <string> i4 = from tex in textures.TEX0Folder.Children
                                          where tex is TEX0Node && ((TEX0Node)tex).Format == WiiPixelFormat.I4
                                          orderby !tex.Name.Contains("MenSelchrMark") &&
                                          !tex.Name.Contains("SeriesIcon"), tex.Name
                select tex.Name;
                selchrList           = i4.ToList();
                selchrBox.DataSource = selchrList;
                if (textures.seriesicon.tex0 != null)
                {
                    selchrBox.SelectedItem = textures.seriesicon.tex0.Name;
                }

                selchrBox.Enabled = true;
            }

            if (textures.selmap_mark.pat0 == null)
            {
                selmapBox.Enabled = false;
            }
            else
            {
                IEnumerable <string> ia4 = from tex in textures.TEX0Folder.Children
                                           where tex is TEX0Node && SelmapMarkFormats.Contains(((TEX0Node)tex).Format)
                                           orderby !tex.Name.Contains("MenSelmapMark"), tex.Name
                select tex.Name;
                selmapList           = ia4.ToList();
                selmapBox.DataSource = selmapList;
                if (textures.selmap_mark.tex0 != null)
                {
                    selmapBox.SelectedItem = textures.selmap_mark.tex0.Name;
                }

                selmapBox.Enabled = true;
            }
        }
示例#17
0
 public GameData()
 {
     Animations         = new List <AnimationBase>();
     Textures           = new TextureContainer();
     MapStatistics      = new MapStatistics();
     Sprites            = new List <SpriteBase>();
     DeadSprites        = new List <SpriteBase>();
     Focus              = null; //Init the focus to null to not follow any creatures
     FocusIndex         = -1;
     HighlightSprite    = false;
     SpriteMarkers      = false;
     ShowChart          = true;
     ShowControls       = true;
     ShowDebugData      = false;
     ShowSettingsPanel  = false;
     ResetGame          = false;
     BuildSettingsPanel = false;
 }
示例#18
0
        private TextureContainer get_icons(int iconNum)
        {
            if (common5 != null)
            {
                saveButton.Text = "Save common5";
            }
            else if (sc_selmap != null)
            {
                saveButton.Text = "Save sc_selmap";
            }
            else
            {
                return(null);
            }

            TextureContainer result = new TextureContainer(sc_selmap, iconNum);

            return(result);
        }
示例#19
0
 public override void Dispose()
 {
     if (TextureContainer != null)
     {
         //after unload->
         //OwnerActiveTextureUnit will set OwnerActiveTextureUnit property to null
         TextureContainer.UnloadGLBitmap();
     }
     ReleaseServerSideTexture();
     if (_memBitmap != null)
     {
         //notify unused here?
         if (_isOwner)
         {
             _memBitmap.Dispose();
         }
         _memBitmap = null; //***
     }
 }
        public void Add(GameObject go)
        {
            // containers
            VisitToCreateLightmap();
            VisitToCreateMesh_r(go);
            VisitToCreateMaterial_r(go);
            VisitToCreateTexture(containerTable.GetEnumerable <MaterialContainer>());

            // game object
            VisitToCreateGameObjectNode_r(go);

            // nodes - for component
            VisitToCreateNode_r <Camera, CameraNode>(go);
            VisitToCreateNode_r <Light, LightNode>(go);
            VisitToCreateRenderNode_r(go);
            VisitToCreateScriptNode_r(go);

            // script variable에서 참조하는 객체

            foreach (var node in graphNodeTable.GetEnumerable <ScriptNode>())
            {
                foreach (var val in node.VariableEnumerable)
                {
                    Material mtl = val.GetMaterial();
                    if (mtl && !containerTable.Contains <MaterialContainer>(mtl.GetInstanceID().ToString()))
                    {
                        var c = new MaterialContainer(mtl);
                        containerTable.Add(c.InstanceId, c);
                    }

                    Texture tex = val.GetTexture();
                    if (tex && !containerTable.Contains <TextureContainer>(tex.GetInstanceID().ToString()))
                    {
                        var c = new TextureContainer(tex);
                        containerTable.Add(c.InstanceId, c);
                    }
                }
            }
            // 새로운 material이 추가되면 연관된 texture가 생겼을지 모른다
            VisitToCreateTexture(containerTable.GetEnumerable <MaterialContainer>());
        }
示例#21
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    // Always dispose this first to ensure updates aren't happening while the project is being disposed
                    effectUpdateQueue.Dispose();

                    mapsetManager?.Dispose();
                    scriptManager.Dispose();
                    textureContainer.Dispose();
                    audioContainer.Dispose();
                }
                mapsetManager     = null;
                effectUpdateQueue = null;
                scriptManager     = null;
                textureContainer  = null;
                audioContainer    = null;
                disposedValue     = true;
            }
        }
示例#22
0
        public PlayerEntity(CharacterPlayer player)
        {
            this.player = player;
            TextComponent textComponent = new TextComponent(Graphics.Instance.BitmapFont, player._name, Vector2.Zero, Color.White);

            HealthtextComponent = new TextComponent(Graphics.Instance.BitmapFont, player.CurrentHealth.ToString(), Vector2.Zero, Color.White);
            SetTag(2);
            this.SetPosition(player.physicalPosition);
            AddComponent(textComponent).SetHorizontalAlign(HorizontalAlign.Center).SetVerticalAlign(VerticalAlign.Top).SetRenderLayer(-200);
            AddComponent(new PlayerComponent());
            AddComponent(HealthtextComponent).SetHorizontalAlign(HorizontalAlign.Right).SetVerticalAlign(VerticalAlign.Bottom).SetRenderLayer(-200);

            SpriteAnimation Idle     = TextureContainer.GetSpriteAtlasByName("Knight").GetAnimation("Idle");
            SpriteAnimation Movement = TextureContainer.GetSpriteAtlasByName("Knight").GetAnimation("Movement");

            SpriteAnimator ani = textComponent.AddComponent <SpriteAnimator>();

            ani.AddAnimation("Idle", Idle);
            ani.AddAnimation("Movement", Movement);
            ani.Play("Idle");
            this.SetScale(3.5f);
        }
示例#23
0
        protected virtual void Dispose(bool disposing)
        {
            if (!IsDisposed)
            {
                if (disposing)
                {
                    // Always dispose this first to ensure updates aren't happening while the project is being disposed
                    effectUpdateQueue.Dispose();

                    assetWatcher.Dispose();
                    MapsetManager?.Dispose();
                    scriptManager.Dispose();
                    TextureContainer.Dispose();
                    AudioContainer.Dispose();
                }
                assetWatcher      = null;
                MapsetManager     = null;
                effectUpdateQueue = null;
                scriptManager     = null;
                TextureContainer  = null;
                AudioContainer    = null;
                IsDisposed        = true;
            }
        }
示例#24
0
        private ActionResult Generate(string csv, string gctPath, ResourceNode sc_selmap, string relpath, ResourceNode info_pac, ResourceNode common2, string brstmPath)
        {
            Func <string, List <string> > split = s => {
                List <string> list    = new List <string>();
                StringBuilder current = new StringBuilder();
                bool          inQuote = false;
                foreach (char c in s)
                {
                    if (c == '"')
                    {
                        inQuote = !inQuote;
                    }
                    else if (c == ',' && !inQuote)
                    {
                        list.Add(current.ToString());
                        current.Clear();
                    }
                    else
                    {
                        current.Append(c);
                    }
                }
                list.Add(current.ToString());
                return(list);
            };

            List <CEPStage> stages    = new List <CEPStage>();
            IList <string>  firstLine = null;

            foreach (string line in System.IO.File.ReadAllLines(csv, Encoding.UTF8))
            {
                if (firstLine == null)
                {
                    firstLine = split(line);
                }
                else
                {
                    CEPStage s = new CEPStage();
                    int      i = 0;
                    foreach (string cell in split(line))
                    {
                        if (cell != "")
                        {
                            var prop = typeof(CEPStage).GetProperty(firstLine[i]);
                            if (prop?.PropertyType == typeof(bool))
                            {
                                prop.SetValue(s, bool.Parse(cell));
                            }
                            else
                            {
                                prop?.SetValue(s, cell);
                            }
                        }
                        i++;
                    }
                    stages.Add(s);
                }
            }

            byte[] gct = System.IO.File.ReadAllBytes(gctPath);
            var    sss = new BrawlManagerLib.CustomSSSCodeset(gct);

            foreach (CEPStage s in stages)
            {
                try {
                    string relname = StageIDMap.RelNameForPac(s.Filename, true);
                    using (var stream = new FileStream(Path.Combine(relpath, relname), FileMode.Open, FileAccess.Read)) {
                        stream.Seek(3, SeekOrigin.Begin);
                        s.ModuleBase = RelNames[stream.ReadByte()];
                    }
                } catch (FileNotFoundException) { }

                if (s.Alternate)
                {
                    continue;
                }
                int iconId          = sss.IconForStage(s.Stage.ID);
                TextureContainer tc = new TextureContainer(sc_selmap, iconId);
                if (tc.icon_tex0 != null)
                {
                    using (MemoryStream ms = new MemoryStream()) {
                        using (Bitmap b = tc.icon_tex0.GetImage(0)) {
                            b.Save(ms, ImageFormat.Png);
                            s.PngIcon = ms.ToArray();
                        }
                    }
                }
            }

            MSBinNode info = (MSBinNode)info_pac.FindChild("MiscData[140]", true);
            var       common2_titledata = new List <SongNameBar.SongIndexEntry>(0);

            foreach (ResourceNode child in common2.Children)
            {
                if (child is Common2MiscDataNode)
                {
                    SndBgmTitleDataNode sndBgmTitleData = child.Children.FirstOrDefault() as SndBgmTitleDataNode;
                    if (sndBgmTitleData != null)
                    {
                        common2_titledata = sndBgmTitleData.Children.Select(n => new SongNameBar.SongIndexEntry()
                        {
                            ID    = (ushort)((SndBgmTitleEntryNode)n).ID,
                            Index = ((SndBgmTitleEntryNode)n).SongTitleIndex
                        }).ToList();
                        break;
                    }
                }
            }

            List <string> brstms = Directory.EnumerateFiles(brstmPath)
                                   .Select(s => Path.GetFileNameWithoutExtension(s)).ToList();

            var sdsl = new StageDependentSongLoader(gct);

            foreach (CEPStage stage in stages)
            {
                Song song = sdsl.GetSong(stage.Stage.ID);
                if (song != null)
                {
                    stage.SongFilename = song.Filename;
                    stage.SongTitle    = info._strings[common2_titledata.Where(c => c.ID == song.ID).Select(c => c.Index).First()];
                    //brstms.RemoveAll(s => s == song.Filename);
                }
            }

            var expStages = stages.Where(s => s.Filename.Contains("CUSTOM"));

            return(View(new MainModel {
                Stages = stages.Except(expStages).Concat(expStages).ToList(),
                Songs = brstms.Select(b => {
                    var song = SongIDMap.Songs.SingleOrDefault(s => s.Filename == b);
                    return new CEPSong {
                        SongFilename = b,
                        SongTitle = info._strings[(
                                                      from c in common2_titledata
                                                      where c.ID == song.ID
                                                      select c.Index
                                                      ).SingleOrDefault()],
                        OriginalSongTitle = b.StartsWith("0000") ? null : song.DefaultName
                    };
                })
            }));
        }
示例#25
0
        private void ReloadIcons()
        {
            if (miscdata80 == null) return;
            CHR0Node chr0 = miscdata80.FindChild("AnmChr(NW4R)/MenSelmapPos_TopN__" + (MyMusic ? "1" : "0"), false) as CHR0Node;
            if (chr0 == null) return;

            icons = new Tuple<Image, RectangleF>[_numIcons + 1];

            CHR0EntryNode entry = chr0.FindChild("MenSelmapPos_TopN", false) as CHR0EntryNode;
            Vector3 offset = entry.GetAnimFrame(_numIcons + OFFSET).Translation;

            for (int i = 1; i <= _numIcons; i++) {
                entry = chr0.FindChild("pos" + i.ToString("D2"), false) as CHR0EntryNode;
                CHRAnimationFrame frame = entry.GetAnimFrame(_numIcons + OFFSET, true);
                float x = (BRAWLWIDTH / 2 + frame.Translation._x + offset._x) / BRAWLWIDTH;
                float y = (BRAWLHEIGHT / 2 - frame.Translation._y - offset._y) / BRAWLHEIGHT;
                float w = 6.4f * (frame.Scale._x) / BRAWLWIDTH;
                float h = 5.6f * (frame.Scale._y) / BRAWLHEIGHT;
                RectangleF r = new RectangleF(x, y, w, h);

                TextureContainer tc = new TextureContainer(miscdata80,
                    IconOrder != null && i <= IconOrder.Length ? IconOrder[i-1] : 100);
                if (tc.icon.tex0 == null) continue;
                Image image = tc.icon.tex0.GetImage(0);

                icons[i] = new Tuple<Image, RectangleF>(image, r);
            }

            var nexttex0 = miscdata80.FindChild("Textures(NW4R)/MenSelmapIcon_Change.1", false) as TEX0Node;
            if (nexttex0 != null) {
                float NEXTOFFSET = 10.8f;
                entry = chr0.FindChild("pos" + (_numIcons + 1).ToString("D2"), false) as CHR0EntryNode;
                CHRAnimationFrame frame2 = entry.GetAnimFrame(_numIcons + OFFSET, true);
                float x2 = (BRAWLWIDTH / 2 + frame2.Translation._x - NEXTOFFSET) / BRAWLWIDTH;
                float y2 = (BRAWLHEIGHT / 2 - frame2.Translation._y) / BRAWLHEIGHT;
                float w2 = 14.4f * (frame2.Scale._x) / BRAWLWIDTH;
                float h2 = 4.8f * (frame2.Scale._y) / BRAWLHEIGHT;
                RectangleF r2 = new RectangleF(x2, y2, w2, h2);
                Image image2 = nexttex0.GetImage(0);
                icons[0] = new Tuple<Image, RectangleF>(image2, r2); //pos00 is not used anyway, so let's overwrite it
            }

            this.Invalidate();
        }
示例#26
0
文件: IMGUI.cs 项目: schlash/Box-XNA
 private void AddTexture(Texture2D up, Texture2D down)
 {
     // Allocate a new texture container
     TextureContainer texture = new TextureContainer();
     texture.up = up;
     texture.down = down;
     // Add it to the list
     m_textures.Add(texture);
 }
 public ImageElem(TextureContainer c)
 {
     this.texcontainer = c;
     this.Name = c.FileName;
 }
示例#28
0
 public Skin(TextureContainer textureContainer)
 {
     TextureContainer = textureContainer;
 }
 public ImageElem(TextureContainer c)
 {
     this.texcontainer = c;
     this.Name         = c.FileName;
 }
示例#30
0
 public void Visit(TextureContainer n)
 {
     report.Info("## InstanceId: " + n.InstanceId);
 }
示例#31
0
        public override void Initialize()
        {
            base.Initialize();

            //Load Assets, always load textures before generating items so they can match texture and ID
            TextureContainer.LoadTextures();
            AbilityContainerClient.LoadAbilities();
            KeyBindContainer.SetKeyBinds();

            Entity e = CreateEntity("Wallpaper");

            e.AddComponent(new SpriteRenderer(TextureContainer.LoginWallpaper)).SetOrigin(new Vector2(0, 0));
            float h = (float)Screen.Height / (float)TextureContainer.LoginWallpaper.Height;
            float w = (float)Screen.Width / (float)TextureContainer.LoginWallpaper.Width;

            e.SetScale(new Vector2(w, h));
            Sprite textfieldTexture = TextureContainer.GetSpriteAtlasByName("UI").GetSprite("Plank_03");

            TextFieldStyle    textFields = TextFieldStyle.Create(Color.White, Color.White, Color.Black, Color.DarkGray);
            NinePatchDrawable drawable   = new NinePatchDrawable(textfieldTexture, 0, 0, 0, 0)
            {
                MinHeight = 20, MinWidth = 50
            };
            NinePatchDrawable drawablebutton = new NinePatchDrawable(TextureContainer.GetSpriteAtlasByName("UI").GetSprite("plank_15"), 0, 0, 0, 0)
            {
                MinHeight = 20, MinWidth = 50
            };
            NinePatchDrawable drawablehover = new NinePatchDrawable(TextureContainer.GetSpriteAtlasByName("UI").GetSprite("plank_18"), 0, 0, 0, 0)
            {
                MinHeight = 20, MinWidth = 50
            };

            textFields.Background = drawable;

            Label label = new Label("Menu").SetFontScale(5).SetFontColor(Color.MediumVioletRed);

            Table.Add(label);

            Label user = new Label("Username").SetFontScale(2).SetFontColor(Color.MediumVioletRed);

            Table.Row().SetPadTop(10);
            Table.Add(user).Pad(20);
            textFieldu = new TextField("", textFields);

            Table.Row().SetPadTop(10);
            Table.Add(textFieldu);

            Label pass = new Label("Password").SetFontScale(2).SetFontColor(Color.MediumVioletRed);

            Table.Row().SetPadTop(10);
            Table.Add(pass);
            textFieldp = new TextField("", textFields);
            Table.Row().SetPadTop(10);
            textFieldp.SetPasswordMode(true);
            Table.Add(textFieldp);

            TextButtonStyle textButtonStyle = new TextButtonStyle(drawablebutton, drawablehover, drawablehover);

            TextButton button = new TextButton("Login", textButtonStyle);

            button.Pad(10);
            button.PadLeft(20);
            button.PadRight(20);
            button.OnClicked += SendLogin;
            Table.Row().SetPadTop(10);
            Table.Add(button);

            TextButton buttonr = new TextButton("Register", textButtonStyle);

            buttonr.Pad(10);
            buttonr.PadLeft(20);
            buttonr.PadRight(20);
            buttonr.OnClicked += Sendregister;
            Table.Row().SetPadTop(10);
            Table.Add(buttonr);

            //var imGuiManager = new ImGuiManager();
            //Core.RegisterGlobalManager(imGuiManager);
            //imGuiManager.SetEnabled(false);
            //imGuiManager.ShowDemoWindow = true;
        }
示例#32
0
        public void UpdateImage(int iconNum)
        {
            if (btnGenerateName.InvokeRequired) {
                this.Invoke((MethodInvoker)(() => { UpdateImage(iconNum); }));
                return;
            }

            prevbase.BackgroundImage = null;
            _iconNum = -1;

            TextureContainer retval = get_icons(iconNum);
            if (retval == null) {

            } else {
                textures = retval ?? new TextureContainer();
                foreach (Control child in flowLayoutPanel1.Controls) {
                    if (child is ImagePreviewPanel) {
                        setBG(child as ImagePreviewPanel);
                    }
                }

                btnGenerateName.Visible = (textures.prevbase.tex0 != null);
                lblIconTex.Text = "Icon no.: " + iconNum;

                var tex = textures.icon.tex0;
                var pal = tex == null ? null : textures.icon.tex0.GetPaletteNode();
                if (textures.prevbase.tex0 != null && textures.frontstname.tex0 != null) {
                    label1.Text = "P: " + textures.prevbase.tex0.ToSizeString()
                        + ", F: " + textures.frontstname.tex0.ToSizeString()
                        + ", icon: " + (pal == null ? "null" : pal.Colors + "c")
                        + "\nmark: " + textures.selmap_mark.tex0.ToSizeString();
                    if (textures.selmap_mark.tex0 != null) {
                        label1.Text += " " + textures.selmap_mark.tex0.Format;
                    }
                }

                _iconNum = iconNum;
            }
        }
示例#33
0
        private void ReloadData()
        {
            if (sss.OtherCodesIgnoredInSameFile > 0) {
                MessageBox.Show(this, "More than one Custom SSS code found in the codeset. All but the last one will be ignored.",
                    this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            var screen1 = new List<StagePair>();
            var screen2 = new List<StagePair>();
            var definitions = new List<StagePair>();
            for (int i = 0; i < sss.sss3.Length; i += 2) {
                definitions.Add(new StagePair {
                    stage = sss.sss3[i],
                    icon = sss.sss3[i + 1],
                });
            }
            foreach (byte b in sss.sss1) {
                screen1.Add(definitions[b]);
            }
            foreach (byte b in sss.sss2) {
                screen2.Add(definitions[b]);
            }

            PairListModel model = new PairListModel();
            for (int i = 0; i < model.songsByStage.Length; i++) {
                Song s;
                model.songsByStage[i] = sss.SongLoaders.TryGetSong((byte)i, out s)
                    ? s
                    : null;
            }
            for (int i = 0; i < model.icons.Length; i++) {
                var tex = new TextureContainer(md80, i);
                if (tex.icon_tex0 != null) {
                    using (MemoryStream ms = new MemoryStream()) {
                        tex.icon_tex0.GetImage(0).Save(ms, ImageFormat.Png);
                        model.icons[i] = ms.ToArray();
                    }
                }
            }
            for (int i=0; i<definitions.Count; i++) {
                StagePair pair = definitions[i];
                model.pairs.Add(new ModelPair {
                    icon = pair.icon,
                    stage = pair.stage,
                    origId = i
                });
            }
            model.screen1 = sss.sss1;
            model.screen2 = sss.sss2;

            html = webBrowser1.DocumentText = RazorEngine.Engine.Razor.RunCompile(Resources.PairList, "PairList", typeof(PairListModel), model);
        }
示例#34
0
 public BallFactory(TextureContainer textureContainer)
 {
     _textureContainer = textureContainer;
 }
示例#35
0
 public TextureElem(TextureContainer c)
 {
     SetFilterMode(c.FilterMode);
     SetWrapMode(c.WrapMode);
     Anisotropy = c.AnisoLevel;
 }
示例#36
0
 private void reloadTextures()
 {
     textureContainer?.Dispose();
     textureContainer = new TextureContainerSeparate(null, TextureOptions.Default);
 }
示例#37
0
        IEnumerator getScreenshot()
        {
            SetVisibilityToShowOnScreenshot(true);
            SetVisibilityToHideOnScreenshot(false);

            yield return(new WaitForEndOfFrame());

            string screenShotPath = Application.persistentDataPath + "/" + ScreenshotName;


            if (takeFullScreen)
            {
                createdTexture = new Texture2D((int)width, (int)height, TextureFormat.ARGB32, false);
                createdTexture.ReadPixels(new Rect(0, 0, width, height), 0, 0, false);
            }
            else
            {
                if (isPortrait)
                {
                    createdTexture = new Texture2D((int)width, (int)width, TextureFormat.ARGB32, false);
                    createdTexture.ReadPixels(new Rect(0, (Screen.height - width) / 2f, width, width), 0, 0, false);
                }
                else
                {
                    createdTexture = new Texture2D((int)height, (int)height, TextureFormat.ARGB32, false);
                    createdTexture.ReadPixels(new Rect(0, (Screen.width - height) / 2f, height, height), 0, 0, false);
                }
            }

            createdTexture.Apply();



            SetVisibilityToShowOnScreenshot(false);
            SetVisibilityToHideOnScreenshot(true);

            DoFlash(() => {
                GameObject spriteGO = GameObject.Find("__screenshot__");

                TextureContainer tc = null;

                if (spriteGO == null)
                {
                    spriteGO = new GameObject();

                    tc = spriteGO.AddComponent <TextureContainer>();

                    spriteGO.name = "__screenshot__";
                }
                else
                {
                    tc = spriteGO.GetComponent <TextureContainer>();
                }

                DontDestroyOnLoad(spriteGO);

                tc.texture = createdTexture;


//				Destroy(createdTexture);

                if (OnScreenshotTaken != null)
                {
                    OnScreenshotTaken(createdTexture);
                }
            });

            yield return(0);
        }
示例#38
0
    private void SetGameInternal(GameType type, bool hasEnvironment)
    {
        var TextureContainer = new TextureContainer ();
        var BallFactory = new BallFactory (TextureContainer);
        var BallManager = new BallManager (BallFactory);
        var GameCore = new GameCore (BallManager);
        var EventFactory = new EventFactory (GameCore);
        var GameController = MakeController (type, GameCore, EventFactory);
        var Environment = new Environment (GameController, EventFactory);

        _container = new GameContainer (GameCore, GameController, Environment, hasEnvironment);
        HasErrors = false;
        Initialized = true;
    }
示例#39
0
        private TextureContainer get_icons(int iconNum)
        {
            if (common5 != null) {
                saveButton.Text = "Save common5";
            } else if (sc_selmap != null) {
                saveButton.Text = "Save sc_selmap";
            } else {
                return null;
            }

            TextureContainer result = new TextureContainer(sc_selmap, iconNum);
            return result;
        }