예제 #1
0
 public LimitedEntity(Textures texturename, Position2D pos, float timeToShow)
     : base(texturename, Helper.RandomString(20))
 {
     TimeLeft = timeToShow;
     Position = pos;
     Location = FadingWorldsGameWindow.Instance.GetVectorByPos(pos);
 }
예제 #2
0
 public static DemoModel Create(ISynchronizeInvoke syncObject)
 {
     var visualContext = new VisualContext();
     var shaders = new Shaders(visualContext, () => new ShaderFile(visualContext, syncObject));
     var textures = new Textures(visualContext);
     return new DemoModel(visualContext, shaders, textures, true);
 }
예제 #3
0
 public MovableEntity(Textures texturename, string id)
     : base(texturename, id)
 {
     RemoveWhenOutOfBounds = true;
     Velocity = new Vector2(0, 0);
     UseTarget = false;
 }
예제 #4
0
 public DrawDecisionModel(DrawDecision drawDecision, Textures textures)
     : base(drawDecision, textures)
 {
     OnSelected(Deck, s => {
         drawDecision.Draw();
         return true;
     });
 }
예제 #5
0
 public Entity(Textures tex, string id)
 {
     EntityType = EntityType.Object;
     IsBlocking = false;
     Id = id;
     SetTexture(tex);
     Angle = 0f;
     Position = new Position2D(1, 1);
     Location = new Vector2(FadingWorldsGameWindow.Instance.Screenwidth/2f, FadingWorldsGameWindow.Instance.Screenheight/2f);
 }
예제 #6
0
파일: Class1.cs 프로젝트: RikkiRu/wcfGmae
 public static void drawQuad(Textures t, double p1x, double p1y, double p2x, double p2y)
 {
     t.bind();
     GL.Begin(BeginMode.Quads);
     GL.TexCoord2(0, 0); GL.Vertex2(p1x, p1y);
     GL.TexCoord2(0, 1); GL.Vertex2(p1x, p2y);
     GL.TexCoord2(1, 1); GL.Vertex2(p2x, p2y);
     GL.TexCoord2(1, 0); GL.Vertex2(p2x, p1y);
     GL.End();
 }
예제 #7
0
        private MyApplication()
        {
            gameWindow.KeyDown += GameWindow_KeyDown;
            gameWindow.RenderFrame += game_RenderFrame;
            visualContext = new VisualContext();
            var textures = new Textures(visualContext);
            var shaders = new Shaders(visualContext, NewShaderFile);
            demo = new DemoModel(visualContext, shaders, textures, false);
            demo.TimeSource.OnTimeFinished += () => gameWindow.Close();

            var arguments = Environment.GetCommandLineArgs();
            if (3 > arguments.Length)
            {
                MessageBox.Show("DemoRecorder <configfile> <saveDirectory> [<resX> <resY> <frameRate>]"
                    + Environment.NewLine
                    + " Please give the demo config file name as application parameter followed by the render buffer resolution.");
                gameWindow.Close();
            }
            bufferWidth = gameWindow.Width;
            bufferHeight = gameWindow.Height;
            try
            {
                bufferWidth = int.Parse(arguments.ElementAt(3));
                bufferHeight = int.Parse(arguments.ElementAt(4));
            }
            catch
            {
                bufferWidth = gameWindow.Width;
                bufferHeight = gameWindow.Height;
            }
            try
            {
                frameRate = int.Parse(arguments.ElementAt(5));
            }
            catch
            {
                frameRate = 25;
            }
            try
            {
                DemoLoader.LoadFromFile(demo, arguments.ElementAt(1));
                saveDirectory = Directory.CreateDirectory(arguments.ElementAt(2)).FullName;
                saveDirectory += Path.DirectorySeparatorChar;
                saveDirectory += DateTime.Now.ToString("yyyyMMdd HHmmss");
                saveDirectory += Path.DirectorySeparatorChar;
                Directory.CreateDirectory(saveDirectory);
                fileNumber = 0;
            }
            catch (Exception e)
            {
                MessageBox.Show("Error loading demo '" + arguments.ElementAt(1) + '"'
                    + Environment.NewLine + e.Message);
                gameWindow.Close();
            }
        }
예제 #8
0
 public OtherPlayer(Textures texturename, string id)
     : base(texturename, id)
 {
     Health = 10;
     MaxHealth = 10;
     Mana = 0;
     MaxMana = 0;
     Level = 1;
     EntityType = EntityType.Player;
     RegenSpeed = 7;
 }
예제 #9
0
        private MyApplication()
        {
            gameWindow.Load += GameWindow_Load;
            gameWindow.KeyDown += GameWindow_KeyDown;
            gameWindow.RenderFrame += game_RenderFrame;
            visualContext = new VisualContext();
            var textures = new Textures(visualContext);
            var shaders = new Shaders(visualContext, NewShaderFile);
            demo = new DemoModel(visualContext, shaders, textures, false);
            demo.TimeSource.OnTimeFinished += () => gameWindow.Close();

            var arguments = Environment.GetCommandLineArgs();
            if (1 == arguments.Length)
            {
                MessageBox.Show("DemoPlayer <configfile> [<resX> <resY>]"
                    + Environment.NewLine
                    + " Please give the demo config file name you wish to play as application parameter followed by the render buffer resolution.");
                gameWindow.Close();
            }
            bufferWidth = gameWindow.Width;
            bufferHeight = gameWindow.Height;
            try
            {
                bufferWidth = int.Parse(arguments.ElementAt(2));
                bufferHeight = int.Parse(arguments.ElementAt(3));
            }
            catch
            {
                bufferWidth = gameWindow.Width;
                bufferHeight = gameWindow.Height;
            }
            try
            {
                DemoLoader.LoadFromFile(demo, arguments.ElementAt(1));
            }
            catch (Exception e)
            {
                MessageBox.Show("Error loading demo '" + arguments.ElementAt(1) + '"'
                    + Environment.NewLine + e.Message);
                gameWindow.Close();
            }
        }
예제 #10
0
파일: font.cs 프로젝트: RikkiRu/wcfGmae
        public font(string s, float x, float y, Color color, int size)
        {
            Bitmap bm = new Bitmap(100 * s.Length, 100);
            Graphics gr = Graphics.FromImage(bm);

            var font = new Font(new FontFamily(GenericFontFamilies.SansSerif), size, GraphicsUnit.Pixel);
            var meashures = gr.MeasureString(s, font);
            gr.Clear(Color.Transparent);

            Rectangle rect = new Rectangle(0, 0, bm.Width, bm.Height);

            Brush br = new SolidBrush(color);
            gr.DrawString(s, font, br, rect);

            labels = new Textures(bm);
            label_lengh = (meashures.Width) + x;
            label_x = x;
            label_y = y;
            label_height = (meashures.Height) / 2 + y;
            visible = false;
        }
예제 #11
0
        public override void LoadContent()
        {
            if (content == null)
                content = new ContentManager(ScreenManager.Game.Services, "Content");

            soundManager = new Sounds();
            levelBuilder = new LevelBuilder();
            textures = new Textures();

            soundManager.LoadSounds(content);
            textures.LoadTextures(content);

            hud = new HeadsUpDisplay(400, ScreenManager.Font);
            marimo = new Marimo(new Vector2(32, 192), ScreenManager.GetInput());
            world = new World(levelBuilder, marimo);

            font = content.Load<SpriteFont>("myFont");

            LevelBuilder.LoadLevelFile(Player.World + "-" + Player.Level);

            base.LoadContent();

            Sounds.Play(Sounds.Music.overworld);
        }
예제 #12
0
 public LivingEntity(Textures texturename, string id)
     : base(texturename, id)
 {
     IsBlocking = true;
 }
예제 #13
0
	// METHODS
	public static Textures createLump(byte[] data, mapType type) {
		int numElements = -1; // For Quake and Source, which use nonconstant struct lengths
		int[] offsets = new int[0]; // For Quake, which stores offsets to each texture definition structure, which IS a constant length
		int structLength = 0;
		switch (type) {
			case mapType.TYPE_NIGHTFIRE: 
				structLength = 64;
				break;
			case mapType.TYPE_QUAKE3: 
			case mapType.TYPE_RAVEN: 
			case mapType.TYPE_COD: 
			case mapType.TYPE_COD2: 
			case mapType.TYPE_COD4: 
				structLength = 72;
				break;
			case mapType.TYPE_QUAKE2: 
			case mapType.TYPE_DAIKATANA: 
			case mapType.TYPE_SOF: 
			case mapType.TYPE_STEF2: 
			case mapType.TYPE_STEF2DEMO: 
			case mapType.TYPE_FAKK: 
				structLength = 76;
				break;
			case mapType.TYPE_MOHAA: 
				structLength = 140;
				break;
			case mapType.TYPE_SIN: 
				structLength = 180;
				break;
			case mapType.TYPE_SOURCE17: 
			case mapType.TYPE_SOURCE18: 
			case mapType.TYPE_SOURCE19: 
			case mapType.TYPE_SOURCE20: 
			case mapType.TYPE_SOURCE21: 
			case mapType.TYPE_SOURCE22: 
			case mapType.TYPE_SOURCE23: 
			case mapType.TYPE_SOURCE27: 
			case mapType.TYPE_TACTICALINTERVENTION: 
			case mapType.TYPE_VINDICTUS: 
			case mapType.TYPE_DMOMAM: 
				numElements = 0;
				for (int i = 0; i < data.Length; i++) {
					if (data[i] == 0x00) {
						numElements++;
					}
				}
				break;
			case mapType.TYPE_QUAKE: 
				numElements = DataReader.readInt(data[0], data[1], data[2], data[3]);
				offsets = new int[numElements];
				for (int i = 0; i < numElements; i++) {
					offsets[i] = DataReader.readInt(data[((i + 1) * 4)], data[((i + 1) * 4) + 1], data[((i + 1) * 4) + 2], data[((i + 1) * 4) + 3]);
				}
				structLength = 40;
				break;
		}
		Textures lump;
		if (numElements == - 1) {
			int offset = 0;
			//elements = new Texture[data.Length / structLength];
			lump = new Textures(new List<Texture>(data.Length / structLength), data.Length, structLength);
			byte[] bytes = new byte[structLength];
			for (int i = 0; i < data.Length / structLength; i++) {
				for (int j = 0; j < structLength; j++) {
					bytes[j] = data[offset + j];
				}
				lump.Add(new Texture(bytes, type));
				offset += structLength;
			}
		} else {
			lump = new Textures(new List<Texture>(numElements), data.Length, structLength);
			if (offsets.Length != 0) {
				// Quake/GoldSrc
				for (int i = 0; i < numElements; i++) {
					int offset = offsets[i];
					byte[] bytes = new byte[structLength];
					for (int j = 0; j < structLength; j++) {
						bytes[j] = data[offset + j];
					}
					lump.Add(new Texture(bytes, type));
					offset += structLength;
				}
			} else {
				// Source
				int offset = 0;
				int current = 0;
				byte[] bytes = new byte[0];
				for (int i = 0; i < data.Length; i++) {
					if (data[i] == (byte) 0x00) {
						// They are null-terminated strings, of non-constant length (not padded)
						lump.Add(new Texture(bytes, type));
						bytes = new byte[0];
						current++;
					} else {
						byte[] newList = new byte[bytes.Length + 1];
						for (int j = 0; j < bytes.Length; j++) {
							newList[j] = bytes[j];
						}
						newList[bytes.Length] = data[i];
						bytes = newList;
					}
					offset++;
				}
			}
		}
		return lump;
	}
예제 #14
0
 public MapTile(int XSheetCoordinate, int YSheetCoordinate, ref Textures.TextureSheet UsedTextureSheet)
 {
     _textureSheetTile.X = XSheetCoordinate;
     _textureSheetTile.Y = YSheetCoordinate;
     _usedTextureSheet = UsedTextureSheet;
 }
예제 #15
0
        private static void DrawItems(Hero v, bool forEnemy)
        {
            var pos = HUDInfo.GetHPbarPosition(v);

            if (pos.IsZero)
            {
                return;
            }
            List <Item> items;

            try
            {
                if (!Members.ItemDictionary.TryGetValue(v.Handle, out items))
                {
                    return;
                }
            }
            catch (Exception)
            {
                Printer.Print("[ItemOverlay][DrawItems]: " + v.StoredName());
                return;
            }

            var count        = 0;
            var itemBoxSizeY = (float)(_defSize / 1.24);
            var newSize      = new Vector2(_defSize / (float)0.54, itemBoxSizeY);
            var halfSize     = HUDInfo.GetHPBarSizeX() / 2;
            var maxSizeX     = Math.Max((float)items.Count / 2 * newSize.X + _defSize / (float)2.6, halfSize);

            pos -= new Vector2(-halfSize + maxSizeX * (float)0.8, _defSize + _defSize + Extra);
            if (DangeItems && forEnemy)
            {
                items = items.Where(Check).ToList();
                if (DangOldMethod)
                {
                    DrawOldMethod(v, items);
                    return;
                }
            }
            foreach (var item in items)
            {
                try
                {
                    var tex = Textures.GetItemTexture(item.StoredName());
                    if (item is Bottle)
                    {
                        var bottletype = item as Bottle;
                        if (bottletype.StoredRune != RuneType.None)
                        {
                            tex =
                                Textures.GetTexture(
                                    $"materials/ensage_ui/items/{item.Name.Replace("item_", "") + "_" + bottletype.StoredRune}.vmat");
                        }
                    }
                    var extraPos   = new Vector2(_defSize / (float)0.60 * count, 0);
                    var itemPos    = pos + extraPos;
                    var normalSize = newSize / (float)1.5 + new Vector2(_defSize / (float)2.5 + 1, _defSize / (float)1.5 + 1);
                    var normalPos  = itemPos - new Vector2(2, 2);
                    Drawing.DrawRect(normalPos, newSize / (float)1.5 + new Vector2(_defSize / (float)2.4 + 1, _defSize / (float)1.3 + 1), Color.Black);
                    Drawing.DrawRect(itemPos, newSize + _defSize / (float)2.6, tex);
                    DrawState(item, normalPos, normalSize, v.Mana);
                    count++;
                }
                catch (Exception)
                {
                    // ignored
                }
            }
        }
예제 #16
0
 public GraphicElts(Textures texture, Point position, Microsoft.Xna.Framework.Graphics.Color couleurXNA)
 {
     this.texture = texture;
     this.position = position;
     this.couleur = new Color(couleurXNA.R, couleurXNA.G, couleurXNA.B, couleurXNA.A);
 }
예제 #17
0
 private void onKeyDownInsert(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         int index;
         if (Utils.ConvertStringToInt(InsertText.Text, out index, 0, 0xFFF))
         {
             if (Textures.TestTexture(index))
                 return;
             contextMenuStrip1.Close();
             using (OpenFileDialog dialog = new OpenFileDialog())
             {
                 dialog.Multiselect = false;
                 dialog.Title = String.Format("Choose image file to insert at 0x{0:X}", index);
                 dialog.CheckFileExists = true;
                 dialog.Filter = "Image files (*.tif;*.tiff;*.bmp)|*.tif;*.tiff;*.bmp";
                 if (dialog.ShowDialog() == DialogResult.OK)
                 {
                     Bitmap bmp = new Bitmap(dialog.FileName);
                     if (((bmp.Width == 64) && (bmp.Height == 64)) || ((bmp.Width == 128) && (bmp.Height == 128)))
                     {
                         if (dialog.FileName.Contains(".bmp"))
                             bmp = Utils.ConvertBmp(bmp);
                         Textures.Replace(index, bmp);
                         FiddlerControls.Events.FireTextureChangeEvent(this, index);
                         bool done = false;
                         for (int i = 0; i < TextureList.Count; ++i)
                         {
                             if (index < TextureList[i])
                             {
                                 TextureList.Insert(i, index);
                                 vScrollBar.Value = i / refMarker.col + 1;
                                 done = true;
                                 break;
                             }
                         }
                         if (!done)
                         {
                             TextureList.Add(index);
                             vScrollBar.Value = TextureList.Count / refMarker.col + 1;
                         }
                         selected = index;
                         GraphicLabel.Text = String.Format("Graphic: 0x{0:X4} ({0}) [{1}x{1}]", selected, Textures.GetTexture(selected));
                         pictureBox.Invalidate();
                         Options.ChangedUltimaClass["Texture"] = true;
                     }
                     else
                         MessageBox.Show("Height or Width Invalid", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                 }
             }
         }
     }
 }
예제 #18
0
        protected override void Draw(GameTime Time)
        {
            Performance.Draw(Time);
            GraphicsDevice.Clear(Color.CornflowerBlue);

            Profiler.Start("Game Draw");
            switch (State)
            {
                #region MainMenu
            case States.MainMenu:
                Globe.Batches[0].Draw(Textures.Get("cog"), Screen.ViewportBounds);
                break;
                #endregion

                #region MapEditor
            case States.MapEditor:
                Globe.Batches[0].Begin(SpriteSortMode.BackToFront, Camera.View);
                Map.Draw();
                Globe.Batches[0].End();
                Globe.Batches[0].DrawRectangle(new Rectangle(16, (int)((Screen.ViewportHeight / 2f) - (11 * Tile.Height)), 52, (22 * Tile.Height)), (Color.Gray * .75f), (Color.Black * .75f));
                Vector2 UIPos = new Vector2(32, 0);
                for (int i = -10; i <= 20; i++)
                {
                    float Opacity = (1 - (Math.Abs(i) * .05f));
                    UIPos.Y = ((Screen.ViewportHeight / 2f) + (i * (Tile.Height + 5)));
                    ushort ID = (ushort)Math.Max(0, Math.Min(ushort.MaxValue, (EditorForeTile + i)));
                    if ((ID > 0) && (ID <= Mod.Fore.Values.Count))
                    {
                        if (Textures.Exists("Tiles.Fore." + ID))
                        {
                            Textures.Draw(("Tiles.Fore." + ID), UIPos, null, (Color.White * Opacity), 0, Origin.Center, 1);
                        }
                        if (Mod.Fore[ID].Frames > 0)
                        {
                            if (Mod.Fore[ID].Animation == null)
                            {
                                Mod.Fore[ID].Animation = new Animation(("Tiles.Fore." + ID + "-"), Mod.Fore[ID].Frames, true, Mod.Fore[ID].Speed);
                            }
                            else
                            {
                                Mod.Fore[ID].Animation.Update(Time);
                            }
                            Textures.Draw(Mod.Fore[ID].Animation.Texture(), UIPos, null, (Color.White * Opacity), 0, Origin.Center, 1);
                        }
                    }
                }
                UIPos = new Vector2(52, 0);
                for (int i = -10; i <= 20; i++)
                {
                    float Opacity = (1 - (Math.Abs(i) * .05f));
                    UIPos.Y = ((Screen.ViewportHeight / 2f) + (i * (Tile.Height + 5)));
                    ushort ID = (ushort)Math.Max(0, Math.Min(ushort.MaxValue, (EditorBackTile + i)));
                    if ((ID > 0) && (ID <= Mod.Back.Values.Count))
                    {
                        if (Textures.Exists("Tiles.Back." + ID))
                        {
                            Textures.Draw(("Tiles.Back." + ID), UIPos, null, (Color.White * Opacity), 0, Origin.Center, 1);
                        }
                        if (Mod.Back[ID].Frames > 0)
                        {
                            if (Mod.Back[ID].Animation == null)
                            {
                                Mod.Back[ID].Animation = new Animation(("Tiles.Back." + ID + "-"), Mod.Back[ID].Frames, true, Mod.Back[ID].Speed);
                            }
                            else
                            {
                                Mod.Back[ID].Animation.Update(Time);
                            }
                            Textures.Draw(Mod.Back[ID].Animation.Texture(), UIPos, null, (Color.White * Opacity), 0, Origin.Center, 1);
                        }
                    }
                }
                break;
                #endregion

                #region Game
            case States.Game:
                Globe.Batches[0].Begin(SpriteSortMode.BackToFront, Camera.View);
                Map.Draw();
                for (byte i = 0; i < Players.Length; i++)
                {
                    if (Players[i] != null)
                    {
                        Players[i].Draw();
                    }
                }
                Globe.Batches[0].End();
                break;
                #endregion
            }
            Profiler.Stop("Game Draw");

            //Performance.Draw(Fonts.Get("Default/ExtraSmall"), new Vector2(5, (Screen.ViewportHeight - 35)), Origin.None, Color.White, Color.Black);
            //Profiler.Draw(430);

            Batch.EndAll();
            base.Draw(Time);
        }
예제 #19
0
        private void DrawingOnOnDraw(EventArgs args)
        {
            string text = "";

            if (!RoshIsAlive)
            {
                if (RoshanMinutes < 8)
                {
                    text =
                        $"Roshan: {7 - RoshanMinutes}:{59 - RoshanSeconds:0.} - {10 - RoshanMinutes}:{59 - RoshanSeconds:0.}";
                }
                else if (RoshanMinutes == 8)
                {
                    text =
                        $"Roshan: {8 - RoshanMinutes}:{59 - RoshanSeconds:0.} - {10 - RoshanMinutes}:{59 - RoshanSeconds:0.}";
                }
                else if (RoshanMinutes == 9)
                {
                    text =
                        $"Roshan: {9 - RoshanMinutes}:{59 - RoshanSeconds:0.} - {10 - RoshanMinutes}:{59 - RoshanSeconds:0.}";
                }
                else
                {
                    text = $"Roshan: {0}:{59 - RoshanSeconds:0.}";
                    if (59 - RoshanSeconds <= 1)
                    {
                        RoshIsAlive = true;
                    }
                }
            }
            var textClr    = Color.White;
            var outLineClr = RoshIsAlive ? Color.YellowGreen : Color.Red;
            var endText    = RoshIsAlive ? "Roshan alive" : Math.Abs(DeathTime) < 0.01f ? "Roshan death" : text;
            var textSize   = new Vector2(TextSize);
            var textPos    = new Vector2(PosX, PosY);

            DrawText(textPos, textSize, endText, textClr, outLineClr, true);
            if (AegisEvent)
            {
                try
                {
                    text = $"Aegis Timer: {4 - AegisMinutes}:{59 - AegisSeconds:0.}";
                    if (Aegis != null)
                    {
                        if (Aegis.Owner != null)
                        {
                            DrawTextWithIcon(textPos + new Vector2(1, TextSize.Value.Value), textSize, text, textClr,
                                             Color.YellowGreen, Textures.GetHeroTexture(Aegis.Owner.Name));
                        }
                        else
                        {
                            DrawText(textPos + new Vector2(1, TextSize.Value.Value), textSize, text, textClr,
                                     Color.YellowGreen);
                        }
                    }
                }
                catch (Exception e)
                {
                }

                //DrawText(textPos + new Vector2(0, TextSize.Value.Value), textSize, text, textClr, Color.YellowGreen);

                /*Drawing.DrawText(text, new Vector2(PosX, PosY + TextSize.Value.Value), new Vector2(TextSize), Color.YellowGreen,
                 *  FontFlags.DropShadow | FontFlags.AntiAlias);*/
            }
        }
예제 #20
0
 public ShootingRange(Texture2D texture, Rectangle rectangle, DifficultyType difficulty, Textures textures)
     : base(texture, rectangle)
 {
     this.Score      = AccuracyTrainerStateConstants.Score;
     this.Hits       = AccuracyTrainerStateConstants.Hits;
     this.Stage      = AccuracyTrainerStateConstants.Stage;
     this.stageTimer = AccuracyTrainerStateConstants.Score;
     this.difficulty = difficulty;
     this.textures   = textures;
     this.InitializeTargets();
 }
예제 #21
0
        private void LoadAnim(MaterialAnim anim)
        {
            Initialize();

            MaterialAnim = anim;
            FrameCount   = MaterialAnim.FrameCount;
            Text         = GetString(anim.Name);

            if (anim.TextureNames != null)
            {
                foreach (var name in anim.TextureNames)
                {
                    Textures.Add(name);
                }
            }

            foreach (var matanim in anim.MaterialAnimDataList)
            {
                var mat = new MaterialAnimEntry(matanim.Name);
                mat.MaterialAnimData = matanim;
                Materials.Add(mat);

                foreach (var param in matanim.ParamAnimInfos)
                {
                    FSHU.BfresParamAnim paramInfo = new FSHU.BfresParamAnim(param.Name);
                    mat.Params.Add(paramInfo);

                    paramInfo.Type = AnimationType.ShaderParam;

                    //There is no better way to determine if the param is a color type afaik
                    if (anim.Name.Contains(ColorAnimType) || param.Name.Contains("color"))
                    {
                        paramInfo.Type = AnimationType.Color;
                    }
                    else if (anim.Name.Contains(TextureSrtAnimType))
                    {
                        paramInfo.Type = AnimationType.TexturePattern;
                    }
                    else if (anim.Name.Contains(ShaderParamAnimType))
                    {
                        paramInfo.Type = AnimationType.ShaderParam;
                    }

                    //Get constant anims
                    for (int constant = 0; constant < param.ConstantCount; constant++)
                    {
                        int index = constant + param.BeginConstant;

                        Animation.KeyGroup keyGroup = new Animation.KeyGroup();
                        keyGroup.Keys.Add(new Animation.KeyFrame()
                        {
                            InterType = InterpolationType.CONSTANT,
                            Frame     = 0,
                            Value     = matanim.Constants[index].Value,
                        });

                        paramInfo.Values.Add(new Animation.KeyGroup()
                        {
                            AnimDataOffset = matanim.Constants[index].AnimDataOffset,
                            Keys           = keyGroup.Keys,
                        });
                    }

                    for (int curve = 0; curve < param.FloatCurveCount + param.IntCurveCount; curve++)
                    {
                        int index = curve + param.BeginCurve;

                        Animation.KeyGroup keyGroup = CurveHelper.CreateTrack(matanim.Curves[index]);
                        keyGroup.AnimDataOffset = matanim.Curves[index].AnimDataOffset;

                        paramInfo.Values.Add(new Animation.KeyGroup()
                        {
                            AnimDataOffset = keyGroup.AnimDataOffset,
                            Keys           = keyGroup.Keys,
                        });
                    }
                }

                foreach (TexturePatternAnimInfo SamplerInfo in matanim.TexturePatternAnimInfos)
                {
                    BfresSamplerAnim sampler = new BfresSamplerAnim(SamplerInfo.Name, this, mat);
                    mat.Samplers.Add(sampler);


                    int  textureIndex = 0;
                    uint animOffset   = 0;

                    if (SamplerInfo.BeginConstant != 65535)
                    {
                        animOffset   = matanim.Constants[SamplerInfo.BeginConstant].AnimDataOffset;
                        textureIndex = matanim.Constants[SamplerInfo.BeginConstant].Value;

                        var group = new Animation.KeyGroup();
                        group.AnimDataOffset = animOffset;
                        group.Keys.Add(new Animation.KeyFrame()
                        {
                            Frame = 0, Value = textureIndex
                        });
                        group.Constant = true;

                        sampler.group = group;
                    }
                    if (SamplerInfo.CurveIndex != 65535)
                    {
                        int index = (int)SamplerInfo.CurveIndex;

                        Animation.KeyGroup keyGroup = CurveHelper.CreateTrack(matanim.Curves[index]);
                        keyGroup.AnimDataOffset = matanim.Curves[index].AnimDataOffset;
                        sampler.group           = new KeyGroup()
                        {
                            AnimDataOffset = keyGroup.AnimDataOffset,
                            Keys           = keyGroup.Keys,
                        };
                    }
                }
            }
        }
예제 #22
0
        private void InitWorlds()
        {
            const int ButtonSize    = 60;
            const int StarsPerWorld = 2;
            const int WorldsPerRow  = 5;

            List <World> worlds     = new List <World>();
            int          worldcount = 0;

            while (File.Exists($"{World.BasePath}{worldcount:000}.wld"))
            {
                World item = World.LoadFromFile($"{worldcount:000}");
                worlds.Add(item);
                worldcount++;
            }

            // Get stars
            bool[,] stars = new bool[worldcount, StarsPerWorld];
            int totalStars = 0;

            bool[] showWorld = new bool[worldcount];

            for (int i = 0; i < worldcount; i++)
            {
                stars[i, 0] = worlds[i].AllCompleted;
                totalStars += worlds[i].AllCompleted ? 1 : 0;
                stars[i, 1] = worlds[i].AllPerfect;
                totalStars += worlds[i].AllPerfect ? 1 : 0;
            }

            // Decide if world is shown
            for (int i = 0; i < worldcount; i++)
            {
                if (i > 1)
                {
                    for (int j = 0; j < 3; j++)
                    {
                        for (int k = 0; k < StarsPerWorld; k++)
                        {
                            if (stars[i - j, k])
                            {
                                showWorld[i] = true;
                                break;
                            }
                        }
                    }
                }
                else
                {
                    showWorld[i] = true;
                }
            }

            Frame worldFrame = new Frame
            {
                Color       = Color.Transparent,
                Constraints = new UIConstraints(
                    new CenterConstraint(),
                    new PixelConstraint(180),
                    new PixelConstraint((showWorld.Count(x => x) / WorldsPerRow < 1 ? showWorld.Count(x => x) % WorldsPerRow : WorldsPerRow) * (ButtonSize + 20) + 20),
                    new PixelConstraint((ButtonSize + 20) * (showWorld.Count(x => x) / WorldsPerRow + 1) + 20))
            };

            // Make buttons
            int count = 0;

            for (int i = 0; i < worldcount; i++)
            {
                if (showWorld[i])
                {
                    Button button = new Button((ButtonSize + 20) * (count % WorldsPerRow) + 20, (ButtonSize + 20) * (count / WorldsPerRow) + 20, ButtonSize, ButtonSize);

                    for (int j = 0; j < StarsPerWorld; j++)
                    {
                        UI.Image image = new UI.Image(Textures.Get("Icons"), new RectangleF(stars[i, j] ? 10 : 0, 0, 10, 10));
                        image.SetConstraints(new UIConstraints(
                                                 ButtonSize * (j + 1) / (StarsPerWorld + 1) - 10,
                                                 ButtonSize - 15, 20, 20));

                        button.AddChild(image);
                    }

                    if (i < 10)
                    {
                        button.Shortcut = (Key)(110 + i);
                    }

                    if (i > 0)
                    {
                        button.Enabled = worlds[i - 1].AllCompleted || worlds[i - 1].AllPerfect;
                    }

                    int world = i;
                    button.OnLeftClick += (sender) => { NewGame(world); };

                    TextBlock text = new TextBlock((i + 1).ToRoman().ToLower(), 3);
                    text.Constraints = new UIConstraints(new CenterConstraint(), new CenterConstraint(), new PixelConstraint((int)text.TextWidth), new PixelConstraint((int)text.TextHeight));
                    button.AddChild(text);
                    worldFrame.AddChild(button);

                    count++;
                }
            }

            ui.Add(worldFrame);
        }
예제 #23
0
 private void SwapToNextTexture()
 {
     textureToUse = (Textures)(((int)textureToUse + 1) % (Enum.GetValues(typeof(AtlasManager.Textures)).Length));
     Debug.Log(textureToUse);
     spRenderer.sprite = atlas.GetSprite(textureToUse.ToString());
 }
예제 #24
0
 public static bool SearchGraphic(int graphic)
 {
     for (int i = 0; i < refMarker.TextureList.Count; ++i)
     {
         if (refMarker.TextureList[i] == graphic)
         {
             refMarker.selected = graphic;
             refMarker.vScrollBar.Value = i / refMarker.col + 1;
             refMarker.GraphicLabel.Text = String.Format("Graphic: 0x{0:X4} ({0}) [{1}x{1}]", graphic, Textures.GetTexture(graphic));
             refMarker.pictureBox.Invalidate();
             return true;
         }
     }
     return false;
 }
예제 #25
0
 public Item(Textures tex, string id)
     : base(tex, id)
 {
 }
예제 #26
0
 public override int GetRandomColor(ICoreClientAPI capi, BlockPos pos, BlockFacing facing, int rndIndex = -1)
 {
     return(capi.World.ApplyColorMapOnRgba(ClimateColorMapForMap, SeasonColorMapForMap, capi.BlockTextureAtlas.GetRandomColor(Textures.Last().Value.Baked.TextureSubId, rndIndex), pos.X, pos.Y, pos.Z));
     //return base.GetRandomColor(capi, pos, facing);
 }
예제 #27
0
 public override void LoadContent(ContentManager content)
 {
     Textures.LoadContent(content);
     CellGraphics.LoadContent(content);
     fpsCounter.LoadContent(content);
 }
예제 #28
0
파일: Hosts.cs 프로젝트: leezer3/OpenBVE
		/// <summary>Loads a texture and returns the texture data.</summary>
		/// <param name="path">The path to the file or folder that contains the texture.</param>
		/// <param name="parameters">The parameters that specify how to process the texture.</param>
		/// <param name="texture">Receives the texture.</param>
		/// <returns>Whether loading the texture was successful.</returns>
		public virtual bool LoadTexture(string path, TextureParameters parameters, out Textures.Texture texture) {
			texture = null;
			return false;
		}
예제 #29
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="applyShaders"></param>
        internal void PlatformApplyState(bool applyShaders)
        {
            if (_scissorRectangleDirty)
            {
                var scissorRect = _scissorRectangle;
                if (!IsRenderTargetBound)
                {
                    scissorRect.Y = _viewport.Height - scissorRect.Y - scissorRect.Height;
                }
                GL.Scissor(scissorRect.X, scissorRect.Y, scissorRect.Width, scissorRect.Height);
                GraphicsExtensions.CheckGLError();
                _scissorRectangleDirty = false;
            }

            if (!applyShaders)
            {
                return;
            }

            if (_indexBufferDirty)
            {
                if (_indexBuffer != null)
                {
                    GL.BindBuffer(BufferTarget.ElementArrayBuffer, _indexBuffer.ibo);
                    GraphicsExtensions.CheckGLError();
                }
                _indexBufferDirty = false;
            }

            if (_vertexBuffersDirty)
            {
                if (_vertexBuffers.Count > 0)
                {
                    GL.BindBuffer(BufferTarget.ArrayBuffer, _vertexBuffers.Get(0).VertexBuffer.vbo);
                    GraphicsExtensions.CheckGLError();
                }
                _vertexBuffersDirty = false;
            }
            if (_vertexShader == null)
            {
                throw new InvalidOperationException("A Vertex Shader Must Be Set!");
            }
            if (_pixelShader == null)
            {
                throw new InvalidOperationException("A Pixel Shader Must Be Set!");
            }
            if (_vertexShaderDirty || _pixelShaderDirty)
            {
                ActivateShaderProgram();
                if (_vertexShaderDirty)
                {
                    unchecked
                    {
                        _graphicsMetrics._vertexShaderCount++;
                    }
                }

                if (_pixelShaderDirty)
                {
                    unchecked
                    {
                        _graphicsMetrics._pixelShaderCount++;
                    }
                }
                _vertexShaderDirty = _pixelShaderDirty = false;
            }

            _vertexConstantBuffers.SetConstantBuffers(this, _shaderProgram);
            _pixelConstantBuffers.SetConstantBuffers(this, _shaderProgram);

            Textures.SetTextures(this);
            SamplerStates.PlatformSetSamplers(this);
        }
예제 #30
0
 public GraphicElts(Textures texture, Point position)
 {
     this.texture = texture;
     this.position = position;
     this.couleur = Structure.Color.White;
 }
예제 #31
0
파일: Block.cs 프로젝트: JSuttor/Manage
 public Block()
 {
     textures     = Textures.Instance;
     biomeTexture = textures.water;
     p1           = Player.Instance;
 }
예제 #32
0
 private void OnMouseClick(object sender, MouseEventArgs e)
 {
     pictureBox.Focus();
     int x = e.X / (64 - 1);
     int y = e.Y / (64 - 1);
     int index = GetIndex(x, y);
     if (index >= 0)
     {
         if (selected != index)
         {
             selected = index;
             GraphicLabel.Text = String.Format("Graphic: 0x{0:X4} ({0}) [{1}x{1}]", selected, Textures.GetTexture(selected).Width);
             pictureBox.Invalidate();
         }
     }
 }
예제 #33
0
        public void ReplaceWith(ModelPack other)
        {
            if (Textures == null || other.Textures == null)
            {
                Textures = other.Textures;
            }
            else
            {
                Textures.ReplaceWith(other.Textures);
            }

            if (Materials == null || other.Materials == null)
            {
                Materials = other.Materials;
            }
            else
            {
                Materials.ReplaceWith(other.Materials);
            }

            if (Model == null || other.Model == null)
            {
                Model = other.Model;
            }
            else
            {
                Model.ReplaceWith(other.Model);
            }

            if (other.AnimationPack != null)
            {
                if (AnimationPack == null)
                {
                    AnimationPack = other.AnimationPack;
                }
                else
                {
                    // TODO
                }
            }

            if (other.ChunkType000100F8 != null)
            {
                if (ChunkType000100F8 == null)
                {
                    ChunkType000100F8 = other.ChunkType000100F8;
                }
                else
                {
                    // TODO
                }
            }

            if (other.ChunkType000100F9 != null)
            {
                if (ChunkType000100F9 == null)
                {
                    ChunkType000100F9 = other.ChunkType000100F9;
                }
                else
                {
                    // TODO
                }
            }
        }
예제 #34
0
        public override void ReadContents(MainForm.UpdateStatusDelegate UpdateDelegate = null)
        {
            var DataSection = GetSectionData(0);
            var GPUSection  = GetSectionData(1);

            DataSection.BaseStream.Seek(Header.TocOffset + 4, System.IO.SeekOrigin.Begin);

            SubObjects = new Caff_SubObject[Header.FileCount];
            for (int i = 0; i < Header.TocEntryCount; i++)
            {
                if (UpdateDelegate != null)
                {
                    float percent = (100.0f / Header.TocEntryCount) * i;
                    UpdateDelegate((int)percent, "Reading Caf TOC...");
                }
                int            tmpEntryID = IO.ReadBig32(DataSection) - 1;
                Caff_SubObject tmpSubObj  = SubObjects[tmpEntryID];
                if (tmpSubObj == null)
                {
                    tmpSubObj = new Caff_SubObject();
                    SubObjects[tmpEntryID] = tmpSubObj;
                }

                int tmpOffset    = IO.ReadBig32(DataSection);
                int tmpSize      = IO.ReadBig32(DataSection);
                int tmpSectionID = IO.ReadByte(DataSection);
                int tmpUnk4      = IO.ReadByte(DataSection);
                tmpSubObj.SetSection(tmpSectionID - 1, tmpOffset, tmpSize, tmpUnk4);
            }

                        #if VERBOSE_LOGGING
            using (var fs = new FileStream(FileName + ".txt", FileMode.OpenOrCreate))
            {
                using (var ss = new StreamWriter(fs))
                {
                    int subObjID = 0;
                    foreach (var tmpSubObj in SubObjects)
                    {
                        var tmpDataSection   = tmpSubObj.GetSectionInfo(0);
                        var tmpGPUSection    = tmpSubObj.GetSectionInfo(1);
                        var tmpStreamSection = tmpSubObj.GetSectionInfo(2);
                        ss.WriteLine(string.Format("SubObject {0}", subObjID));
                        if (tmpDataSection.Offset != -1)
                        {
                            ss.WriteLine(string.Format("\t.data: Offset: 0x{0:X}, Size: 0x{1:X}", tmpDataSection.Offset, tmpDataSection.Size));
                        }
                        if (tmpGPUSection.Offset != -1)
                        {
                            ss.WriteLine(string.Format("\t.gpu: Offset: 0x{0:X}, Size: 0x{1:X}", tmpGPUSection.Offset, tmpGPUSection.Size));
                        }
                        if (tmpStreamSection.Offset != -1)
                        {
                            ss.WriteLine(string.Format("\t.stream: Offset: 0x{0:X}, Size: 0x{1:X}", tmpStreamSection.Offset, tmpStreamSection.Size));
                        }
                        subObjID++;
                    }
                }
            }
                        #endif

            //var tmpXPR = new XPRFile();
            string baseDir      = System.IO.Path.GetDirectoryName(FileName);
            string baseFileName = System.IO.Path.GetFileNameWithoutExtension(FileName);

            int tmpSubObjID = 0;
            foreach (var tmpSubObj in SubObjects)
            {
                if (UpdateDelegate != null)
                {
                    float percent = (100.0f / SubObjects.Length) * tmpSubObjID;
                    UpdateDelegate((int)percent, "Reading Contents...");
                }
                var tmpDataSectionInfo = tmpSubObj.GetSectionInfo(0);
                var tmpGPUSectionInfo  = tmpSubObj.GetSectionInfo(1);
                if (tmpDataSectionInfo.Offset != -1)
                {
                    DataSection.BaseStream.Seek(tmpDataSectionInfo.Offset, SeekOrigin.Begin);
                    var tmpTypeStr = IO.ReadString(DataSection);
                    if (tmpTypeStr == "texture")
                    {
                        var tmpTexture = new Texture();
                        DataSection.BaseStream.Seek(tmpDataSectionInfo.Offset, SeekOrigin.Begin);
                        if (tmpGPUSectionInfo.Offset != -1)
                        {
                            GPUSection.BaseStream.Seek(tmpGPUSectionInfo.Offset, SeekOrigin.Begin);
                        }
                        else
                        {
                            Logger.LogError(string.Format("Texture Block at 0x{0:X} has no GPU Section Data.\n", tmpDataSectionInfo.Offset));
                            continue;
                        }

                        if (tmpTexture.Read(DataSection, GPUSection))
                        {
                            Textures.Add(tmpTexture);
                            var tmpNode = tmpTexture.ToNode(Textures.Count - 1);
                            tmpNode.Tag = new TreeNodeTag(this, Textures.Count - 1, TreeNodeTag.OBJECT_TYPE_TEXTURE, 0, TreeNodeTag.NodeType.Main);
                            TreeViewNode.Nodes.Add(tmpNode);
                        }
                    }
                    else if (tmpTypeStr == "rendergraph")
                    {
                        var tmpRenderGraph = new RenderGraph(this, RenderGraphs.Count);
                        DataSection.BaseStream.Seek(tmpDataSectionInfo.Offset, SeekOrigin.Begin);
                        if (tmpGPUSectionInfo.Offset != -1)
                        {
                            GPUSection.BaseStream.Seek(tmpGPUSectionInfo.Offset, SeekOrigin.Begin);
                        }
                        else
                        {
                            Logger.LogError(string.Format("RenderGraph Block at 0x{0:X} has no GPU Section.\n", tmpDataSectionInfo.Offset));
                            continue;
                        }

                        if (tmpRenderGraph.Read(DataSection, GPUSection, tmpDataSectionInfo.Size, tmpGPUSectionInfo.Size))
                        {
                            RenderGraphs.Add(tmpRenderGraph);
                            var tmpNode = tmpRenderGraph.ToNode(RenderGraphs.Count - 1);
                            tmpNode.Tag = new TreeNodeTag(this, RenderGraphs.Count - 1, TreeNodeTag.OBJECT_TYPE_RENDERGRAPH, 0, TreeNodeTag.NodeType.Main);
                            TreeViewNode.Nodes.Add(tmpNode);
                        }
                    }
                }
                tmpSubObjID++;
            }

            //tmpXPR.Write(System.IO.Path.Combine(baseDir, string.Format("{0}.xpr", baseFileName)));
            DataSection.Close();
            GPUSection.Close();
        }
예제 #35
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            // Load the object Textures into the Texture Dictionary
            Textures.Add("_copterGraphics", this.Content.Load <Texture2D>("copter_body"));
            Textures.Add("_copterGraphics1", this.Content.Load <Texture2D>("copter_body"));
            Textures.Add("_copterGraphics2", this.Content.Load <Texture2D>("copter_body"));
            Textures.Add("_copterGraphics3", this.Content.Load <Texture2D>("copter_white (1)"));

            Textures.Add("_gameBack1", this.Content.Load <Texture2D>("bg"));                      // bg is another background
            Textures.Add("_borderBlocksGraphics1", this.Content.Load <Texture2D>("log (1)"));     // log (1) is another texture
            Textures.Add("_midBlocksGraphics1", this.Content.Load <Texture2D>("obstacle2"));      // obstacle2 is another texture

            Textures.Add("_gameBack2", this.Content.Load <Texture2D>("gameBack2"));               // bg is another background
            Textures.Add("_borderBlocksGraphics2", this.Content.Load <Texture2D>("block2"));      // log (1) is another texture
            Textures.Add("_midBlocksGraphics2", this.Content.Load <Texture2D>("midblock2"));

            Textures.Add("_gameBack3", this.Content.Load <Texture2D>("gameBack1"));                      // bg is another background
            Textures.Add("_borderBlocksGraphics3", this.Content.Load <Texture2D>("strip2"));             // log (1) is another texture
            Textures.Add("_midBlocksGraphics3", this.Content.Load <Texture2D>("obstacle"));

            Textures.Add("_gameBack", this.Content.Load <Texture2D>("bg"));                      // bg is another background
            Textures.Add("_borderBlocksGraphics", this.Content.Load <Texture2D>("log (1)"));     // log (1) is another texture
            Textures.Add("_midBlocksGraphics", this.Content.Load <Texture2D>("obstacle2"));      // obstacle2 is another texture


            Textures.Add("_smokeGraphics", this.Content.Load <Texture2D>("smoke"));
            Textures.Add("_pause", this.Content.Load <Texture2D>("Pause"));
            Textures.Add("_play", this.Content.Load <Texture2D>("Play"));


            Textures.Add("_wingsGraphics1", this.Content.Load <Texture2D>("1"));
            Textures.Add("_wingsGraphics2", this.Content.Load <Texture2D>("2"));
            Textures.Add("_wingsGraphics3", this.Content.Load <Texture2D>("3"));
            Textures.Add("_wingsGraphics4", this.Content.Load <Texture2D>("4"));
            Textures.Add("_logoGraphics", this.Content.Load <Texture2D>("logo"));

            Textures.Add("_aboutGraphics", this.Content.Load <Texture2D>("about_page"));
            Textures.Add("_high1", this.Content.Load <Texture2D>("high_score_page"));
            Textures.Add("_high2", this.Content.Load <Texture2D>("high_score_page_1"));

            Textures.Add("_gameNameGraphics", this.Content.Load <Texture2D>("gameName"));
            Textures.Add("_background", this.Content.Load <Texture2D>("blank"));
            Textures.Add("_clickOnGraphics", this.Content.Load <Texture2D>("up"));
            Textures.Add("_clickOffGraphics", this.Content.Load <Texture2D>("down"));
            Textures.Add("_play1", this.Content.Load <Texture2D>("Play2"));
            Textures.Add("_about1", this.Content.Load <Texture2D>("about"));
            Textures.Add("_custom1", this.Content.Load <Texture2D>("maps"));
            Textures.Add("_bg1", this.Content.Load <Texture2D>("bg1"));
            Textures.Add("_bg2", this.Content.Load <Texture2D>("bg2"));
            Textures.Add("_bg3", this.Content.Load <Texture2D>("bg3"));
            Textures.Add("_bg4", this.Content.Load <Texture2D>("bg4"));
            Textures.Add("_note", this.Content.Load <Texture2D>("sorrynote"));

            Textures.Add("_border1.1", this.Content.Load <Texture2D>("Slow"));
            Textures.Add("_border1.2", this.Content.Load <Texture2D>("Medium"));
            Textures.Add("_border1.3", this.Content.Load <Texture2D>("Fast"));
            Textures.Add("_border2.1", this.Content.Load <Texture2D>("Slow_click"));
            Textures.Add("_border2.2", this.Content.Load <Texture2D>("Medium_click"));
            Textures.Add("_border2.3", this.Content.Load <Texture2D>("Fast_click"));
            Textures.Add("_border3.1", this.Content.Load <Texture2D>("Robotics"));
            Textures.Add("_border3.2", this.Content.Load <Texture2D>("Forest"));
            Textures.Add("_border3.3", this.Content.Load <Texture2D>("Rocks"));
            Textures.Add("_border4.1", this.Content.Load <Texture2D>("Robotics_click"));
            Textures.Add("_border4.2", this.Content.Load <Texture2D>("Forest_click"));
            Textures.Add("_border4.3", this.Content.Load <Texture2D>("Rocks_click"));


            Textures.Add("_copter_img", this.Content.Load <Texture2D>("copter_img"));
            Fonts.Add("_miramonteFont", this.Content.Load <SpriteFont>("Miramonte"));
            Textures.Add("_copterImg", this.Content.Load <Texture2D>("copter_img"));
            //   _blast = Content.Load<SoundEffect>("sound1");
            _ifClicked[8] = 1;
            _ifClicked[4] = 1;


            //    go.Visibility = Visibility.Collapsed;

            //  topscorer.Visibility = Visibility.Collapsed;

            // Resets the Game to its original state
            ResetGame();
        }
예제 #36
0
 public void Attach(Textures.Texture2D texture, FramebufferTarget target, FramebufferAttachment attachment, FramebufferTextureTarget textureTarget)
 {
     _gl.FramebufferTexture2D((uint)target, (uint)attachment, (uint) textureTarget, texture.Handle, 0);   
 }
예제 #37
0
        public static void OnDraw(EventArgs args)
        {
            if (!Checker)
            {
                return;
            }
            var refresh = Members.System.ToList();

            foreach (var heroModifier in refresh.Where(x => x.Owner == null || !x.Owner.IsValid || !x.Owner.IsAlive))
            {
                Members.System.Remove(heroModifier);
            }
            foreach (var heroModifier in Members.System)
            {
                var target     = heroModifier.Owner;
                var modList    = heroModifier.Modifiers;
                var isHero     = heroModifier.IsHero;
                var maxCounter = isHero
                    ? Members.Menu.Item("Counter.Hero").GetValue <Slider>().Value
                    : Members.Menu.Item("Counter.Creep").GetValue <Slider>().Value;
                if (isHero)
                {
                    if (!Members.Menu.Item("Enable.Heroes").GetValue <bool>())
                    {
                        continue;
                    }
                }
                else
                {
                    if (!Members.Menu.Item("Enable.Creeps").GetValue <bool>())
                    {
                        continue;
                    }
                }
                var counter = 0;
                var extra   = isHero ? 0 : 5;
                var hudPos  = HUDInfo.GetHPbarPosition(target);
                if (hudPos.IsZero)
                {
                    continue;
                }
                var startPos = hudPos + new Vector2(0, HUDInfo.GetHpBarSizeY() * 2 + extra) +
                               new Vector2(Members.Menu.Item("ExtraPos.X").GetValue <Slider>().Value,
                                           Members.Menu.Item("ExtraPos.Y").GetValue <Slider>().Value);
                var size = new Vector2(Members.Menu.Item("Settings.IconSize").GetValue <Slider>().Value,
                                       Members.Menu.Item("Settings.IconSize").GetValue <Slider>().Value);
                foreach (var modifier in modList.Where(x => x != null && x.IsValid && !Members.BlackList.Contains(x.Name)))
                {
                    if (counter >= maxCounter)
                    {
                        continue;
                    }
                    var remTime = modifier.RemainingTime;

                    /*if (remTime<=1)
                     *  continue;*/
                    var itemPos = startPos;
                    if (DrawVerticallyIcon)
                    {
                        itemPos += new Vector2(2, -2 + size.X * counter);
                    }
                    else
                    {
                        itemPos += new Vector2(-2 + size.X * counter, 2);
                    }
                    if (DrawRoundIcon)
                    {
                        Drawing.DrawRect(itemPos, size,
                                         Textures.GetTexture(
                                             $"materials/ensage_ui/modifier_textures/Round/{modifier.TextureName}.vmat"));
                    }
                    else
                    {
                        Drawing.DrawRect(itemPos, size,
                                         Textures.GetTexture(
                                             $"materials/ensage_ui/modifier_textures/{modifier.TextureName}.vmat"));
                        Drawing.DrawRect(itemPos, size,
                                         Color.Black, true);
                    }
                    var timer    = Math.Min(remTime + 0.1, 99).ToString("0.0");
                    var textSize = Drawing.MeasureText(timer, "Arial",
                                                       new Vector2(
                                                           (float)(size.Y * Members.Menu.Item("Settings.TextSize").GetValue <Slider>().Value / 100),
                                                           size.Y / 2), FontFlags.AntiAlias);
                    var textPos = itemPos + new Vector2(0, size.Y - textSize.Y);
                    Drawing.DrawRect(textPos - new Vector2(0, 0),
                                     new Vector2(textSize.X, textSize.Y),
                                     new Color(0, 0, 0, 200));
                    var clr = remTime >= 1 ? Color.White : ChangeColor ? Color.Red : Color.White;
                    Drawing.DrawText(
                        timer,
                        textPos,
                        new Vector2(textSize.Y, 0),
                        clr,
                        FontFlags.AntiAlias | FontFlags.StrikeOut);
                    counter++;
                }
            }
        }
예제 #38
0
 void Awake()
 {
     textures = this;
 }
예제 #39
0
 protected override void Initialize()
 {
     Textures.LoadTextures(this.Content);
     uilayer.Add(new Button("Save", 5, 5, Textures.SAVE_ICON));
     spriteBatch = new SpriteBatch(GraphicsDevice);
 }
예제 #40
0
        private void DrawingOnOnDraw(EventArgs args)
        {
            var pos           = new Vector2(PosX.Value.Value, PosY.Value.Value);
            var startPosition = pos;
            var size          = new Vector2(SizeX * 10, SizeY * 10);

            if (CanMove)
            {
                if (CanMoveWindow(ref pos, size, true))
                {
                    PosX.Item.SetValue(new Slider((int)pos.X, 1, 2500));
                    PosY.Item.SetValue(new Slider((int)pos.Y, 1, 2500));
                }
            }

            var stageSize    = new Vector2(size.X / 7f, size.Y / 5f);
            var itemSize     = new Vector2(stageSize.X / .7f, stageSize.Y);
            var emptyTexture = Textures.GetTexture("materials/ensage_ui/items/emptyitembg.vmat");

            foreach (var heroC in Config.Main.Updater.EnemyHeroes)
            {
                if (heroC.DontDraw)
                {
                    continue;
                }
                var hero     = heroC.Hero;
                var startPos = new Vector2(pos.X, pos.Y);
                Drawing.DrawRect(pos, stageSize, Textures.GetHeroTexture(hero.StoredName()));
                pos += new Vector2(stageSize.X, 0);
                for (var i = 0; i < 6; i++)
                {
                    AbilityHolder item = null;
                    try
                    {
                        item = heroC.Items[i];
                    }
                    catch (Exception)
                    {
                        // ignored
                    }
                    if (item == null || !item.IsValid)
                    {
                        Drawing.DrawRect(pos, itemSize, emptyTexture);
                    }
                    else
                    {
                        var bottletype = item.Item as Bottle;
                        if (bottletype != null && bottletype.StoredRune != RuneType.None)
                        {
                            var itemTexture =
                                Textures.GetTexture(
                                    $"materials/ensage_ui/items/{item.Name.Replace("item_", "") + "_" + bottletype.StoredRune}.vmat");
                            Drawing.DrawRect(pos, itemSize, itemTexture);
                        }
                        else
                        {
                            Drawing.DrawRect(pos, itemSize, Textures.GetItemTexture(item.Name));
                        }

                        if (item.AbilityState == AbilityState.OnCooldown)
                        {
                            var cooldown = item.Cooldown + 1;
                            var cdText   = ((int)cooldown).ToString();
                            DrawItemCooldown(cdText, pos, stageSize);
                        }
                    }

                    Drawing.DrawRect(pos, stageSize, Color.White, true);
                    pos += new Vector2(stageSize.X, 0);
                }
                pos = new Vector2(startPos.X, startPos.Y + itemSize.Y);
            }
            Drawing.DrawRect(startPosition, size, Color.White, true);
        }
예제 #41
0
        private void DrawingOnOnDraw(EventArgs args)
        {
            Vector2 startPos = new Vector2(PosX.Value.Value, PosY.Value.Value);
            var     size     = new Vector2(Size * 5 * _main.Invoker.AbilityInfos.Count, Size * 5);

            if (Movable)
            {
                var tempSize = new Vector2(200, 200);
                if (CanMoveWindow(ref startPos, tempSize, true))
                {
                    PosX.Item.SetValue(new Slider((int)startPos.X, 0, 2000));
                    PosY.Item.SetValue(new Slider((int)startPos.Y, 0, 2000));
                    return;
                }
            }
            var pos                  = startPos;
            var iconSize             = new Vector2(Size * 5);
            var selectedComboPos     = new Vector2();
            var selectedComboCounter = 0;

            foreach (var combo in Combos)
            {
                var selectedAbility = combo.AbilityInfos[combo.CurrentAbility].Ability;
                var clickStartPos   = pos;
                var count           = combo.AbilityCount;

                foreach (var info in combo.AbilityInfos)
                {
                    var ability = info.Ability;
                    var isItem  = info.Ability is Item;
                    if (!_main.AbilitiesInCombo.Value.IsEnabled(ability.Name) && !isItem)
                    {
                        count--;
                        continue;
                    }
                    var texture = isItem
                        ? Textures.GetItemTexture(ability.StoredName())
                        : Textures.GetSpellTexture(ability.StoredName());
                    Drawing.DrawRect(pos, isItem ? new Vector2(iconSize.X * 1.5f, iconSize.Y) : iconSize, texture);
                    var cd = ability.Cooldown;
                    if (cd > 0)
                    {
                        var text = ((int)(cd + 1)).ToString(CultureInfo.InvariantCulture);
                        Drawing.DrawText(
                            text,
                            pos, size / 10,
                            Color.White,
                            FontFlags.AntiAlias | FontFlags.StrikeOut);
                    }
                    if (_main.Invoker.Mode.CanExecute && !Game.IsKeyDown(0x11) && selectedAbility.Equals(ability) &&
                        combo.Id == _main.Invoker.SelectedCombo)
                    {
                        Drawing.DrawRect(pos, iconSize, new Color(0, 155, 255, 125));
                    }
                    pos += new Vector2(iconSize.X, 0);
                }
                var clickSize = new Vector2(iconSize.X * count, iconSize.Y);
                if (combo.Id == _main.Invoker.SelectedCombo && selectedComboPos.IsZero)
                {
                    selectedComboPos     = pos;
                    selectedComboCounter = count;
                }

                combo.Update(clickStartPos, clickSize);

                pos.X  = startPos.X;
                pos.Y += iconSize.Y;
            }

            var sizeX = iconSize.X * selectedComboCounter;

            Drawing.DrawRect(selectedComboPos - new Vector2(sizeX, 0) - 1, new Vector2(sizeX, iconSize.Y) + 2,
                             new Color(0, 255, 0, 255), true);
        }
예제 #42
0
 /// <inheritdoc/>
 protected override void Dispose(Boolean disposing)
 {
     Textures.Dispose();
     base.Dispose(disposing);
 }
예제 #43
0
        public static void Draw(EventArgs args)
        {
            if (!Checker.IsActive())
            {
                return;
            }
            if (!Members.Menu.Item("showmemore.Enable").GetValue <bool>())
            {
                return;
            }
            if (Members.Menu.Item("Cour.Enable").GetValue <bool>())
            {
                foreach (var courier in Manager.BaseManager.GetViableCouriersList())
                {
                    var pos = Helper.WorldToMinimap(courier.Position);
                    if (pos.IsZero)
                    {
                        continue;
                    }
                    var    courType = courier.IsFlying ? "courier_flying" : "courier";
                    string name     = $"materials/ensage_ui/other/{courType}.vmat";
                    Drawing.DrawRect(pos - new Vector2(7, 7), new Vector2(15, 15), Drawing.GetTexture(name));
                }
            }
            if (Members.Menu.Item("apparition.Enable").GetValue <bool>() && AAunit != null && AAunit.IsValid)
            {
                try
                {
                    var aapos = Drawing.WorldToScreen(AAunit.Position);
                    if (!aapos.IsZero)
                    {
                        var myHeroPos = Drawing.WorldToScreen(Members.MyHero.Position);
                        if (!myHeroPos.IsZero)
                        {
                            Drawing.DrawLine(Drawing.WorldToScreen(Members.MyHero.Position), aapos, Color.AliceBlue);
                            const string name = "materials/ensage_ui/spellicons/ancient_apparition_ice_blast.vmat";
                            Drawing.DrawRect(aapos, new Vector2(50, 50), Drawing.GetTexture(name));
                        }
                    }
                }
                catch (Exception)
                {
                    Printer.Print("[Draw]: Apparation");
                }
            }
            if (Members.Menu.Item("tinker.Enable").GetValue <bool>())
            {
                try
                {
                    if (Members.Tinker != null && Members.Tinker.IsValid)
                    {
                        var baseList =
                            Manager.BaseManager.GetBaseList()
                            .Where(x => x.IsAlive && x.HasModifier("modifier_tinker_march_thinker"));
                        foreach (var unit in baseList)
                        {
                            var realPos = unit.Position;
                            var pos     = Drawing.WorldToScreen(realPos);
                            var texture = Textures.GetSpellTexture("tinker_march_of_the_machines");
                            if (pos.X > 0 && pos.Y > 0)
                            {
                                Drawing.DrawRect(pos, new Vector2(50, 50), texture);
                            }
                            var pos2 = Helper.WorldToMinimap(realPos);
                            Drawing.DrawRect(pos2 - new Vector2(10, 10), new Vector2(10, 10), texture);
                        }
                    }
                }
                catch (Exception)
                {
                    Printer.Print("[Draw]: Tinker");
                }
            }
            if (Members.Menu.Item("tech.Enable").GetValue <bool>())
            {
                try
                {
                    if (Members.Techies != null && Members.Techies.IsValid)
                    {
                        var baseList =
                            ObjectManager.GetEntities <Unit>()
                            .Where(x => x.IsAlive && x.ClassID == ClassID.CDOTA_NPC_TechiesMines && x.Team != Members.MyHero.Team && !Bombs.Contains(x));
                        foreach (var unit in baseList)
                        {
                            Bombs.Add(unit);
                        }
                        foreach (var bomb in Bombs)
                        {
                            if (!bomb.IsValid)
                            {
                                continue;
                            }
                            if (bomb.IsVisible)
                            {
                                continue;
                            }
                            var realPos = bomb.Position;
                            var pos     = Drawing.WorldToScreen(realPos);
                            var texture = bomb.Spellbook.Spell1 != null
                                ? Textures.GetTexture("materials/ensage_ui/other/npc_dota_techies_remote_mine.vmat")
                                : Textures.GetTexture("materials/ensage_ui/other/npc_dota_techies_land_mine.vmat");

                            if (pos.X > 0 && pos.Y > 0)
                            {
                                Drawing.DrawRect(pos, new Vector2(50, 50), texture);
                            }
                            var pos2 = Helper.WorldToMinimap(realPos);
                            Drawing.DrawRect(pos2 - new Vector2(15, 15), new Vector2(15, 15), texture);
                        }
                    }
                }
                catch (Exception)
                {
                    Printer.Print("[Draw]: Techies");
                }
            }
            if (Members.Menu.Item("scan.Enable").GetValue <bool>())
            {
                if (Members.ScanEnemy != null && Members.ScanEnemy.IsValid)
                {
                    try
                    {
                        var position = Members.ScanEnemy.Position;
                        var w2S      = Drawing.WorldToScreen(position);
                        if (!w2S.IsZero)
                        {
                            Drawing.DrawText(
                                "Scan Ability " +
                                Members.ScanEnemy.FindModifier("modifier_radar_thinker").RemainingTime.ToString("F1"),
                                w2S,
                                new Vector2(15, 15),
                                Color.White,
                                FontFlags.AntiAlias | FontFlags.StrikeOut);
                        }
                    }
                    catch (Exception)
                    {
                        Printer.Print("[Draw]: scan");
                    }
                }
            }
            if (Members.Menu.Item("charge.Enable").GetValue <bool>() && Members.BaraIsHere)
            {
                try
                {
                    foreach (var v in Manager.HeroManager.GetAllyViableHeroes())
                    {
                        var mod = v.HasModifier("modifier_spirit_breaker_charge_of_darkness_vision");
                        if (mod)
                        {
                            if (Equals(Members.MyHero, v))
                            {
                                Drawing.DrawRect(new Vector2(0, 0), new Vector2(Drawing.Width, Drawing.Height),
                                                 new Color(Members.Menu.Item("charge" + ".Red").GetValue <Slider>().Value,
                                                           Members.Menu.Item("charge" + ".Green").GetValue <Slider>().Value,
                                                           Members.Menu.Item("charge" + ".Blue").GetValue <Slider>().Value,
                                                           Members.Menu.Item("charge" + ".Alpha").GetValue <Slider>().Value));
                            }
                            if (!InSys.Contains(v))
                            {
                                Helper.GenerateSideMessage(v.Name.Replace("npc_dota_hero_", ""),
                                                           "spirit_breaker_charge_of_darkness");
                                InSys.Add(v);
                                //effect322 = new ParticleEffect("particles/units/heroes/hero_spirit_breaker/spirit_breaker_charge_target.vpcf", v, ParticleAttachment.OverheadFollow);
                                //v.AddParticleEffect("particles/units/heroes/hero_spirit_breaker/spirit_breaker_charge_target.vpcf");
                            }
                            else
                            {
                                var pos = HUDInfo.GetHPbarPosition(v);
                                if (!pos.IsZero && BaraDrawRect)
                                {
                                    Drawing.DrawRect(pos - new Vector2(50, 0), new Vector2(30, 30),
                                                     Textures.GetSpellTexture("spirit_breaker_charge_of_darkness"));
                                    Drawing.DrawRect(pos - new Vector2(50, 0), new Vector2(30, 30),
                                                     Color.Red, true);
                                }
                            }
                        }
                        else
                        {
                            if (InSys.Contains(v))
                            {
                                InSys.Remove(v);
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    Printer.Print("[Draw]: charge " + e.Message);
                }
            }
            if (Members.Menu.Item("lifestealer.Enable").GetValue <bool>() && Members.LifeStealer != null && Members.LifeStealer.IsValid && !Members.LifeStealer.IsVisible)
            {
                try
                {
                    const string modname = "modifier_life_stealer_infest_effect";
                    if (LifeStealerBox)
                    {
                        foreach (var t in Manager.HeroManager.GetEnemyViableHeroes().Where(x => x.HasModifier(modname)))
                        {
                            var size3  = new Vector2(10, 20) + new Vector2(13, -6);
                            var w2SPos = HUDInfo.GetHPbarPosition(t);
                            if (w2SPos.IsZero)
                            {
                                continue;
                            }
                            var name = "materials/ensage_ui/miniheroes/" +
                                       Members.LifeStealer.StoredName().Replace("npc_dota_hero_", "") + ".vmat";
                            Drawing.DrawRect(w2SPos - new Vector2(size3.X / 2, size3.Y / 2), size3,
                                             Drawing.GetTexture(name));
                        }
                    }
                    if (Members.Menu.Item("lifestealer.creeps.Enable").GetValue <bool>())
                    {
                        foreach (var t in Creeps.All.Where(x => x != null && x.IsAlive && x.HasModifier(modname)))
                        {
                            var size3  = new Vector2(10, 20) + new Vector2(13, -6);
                            var w2SPos = HUDInfo.GetHPbarPosition(t);
                            if (w2SPos.IsZero)
                            {
                                continue;
                            }
                            var name = "materials/ensage_ui/miniheroes/" +
                                       Members.LifeStealer.StoredName().Replace("npc_dota_hero_", "") + ".vmat";
                            Drawing.DrawRect(w2SPos - new Vector2(size3.X / 2, size3.Y / 2), size3,
                                             Drawing.GetTexture(name));
                        }
                    }
                }
                catch (Exception)
                {
                    Printer.Print("[Draw]: lifestealer");
                }
            }
            if (Members.Menu.Item("blur.Enable").GetValue <bool>() && Members.PAisHere != null && Members.PAisHere.IsValid)
            {
                try
                {
                    var mod = Members.PAisHere.HasModifier("modifier_phantom_assassin_blur_active");
                    if (mod && Members.PAisHere.StoredName() == "npc_dota_hero_phantom_assassin")
                    {
                        var size3 = new Vector2(10, 20) + new Vector2(13, -6);
                        var w2M   = Helper.WorldToMinimap(Members.PAisHere.NetworkPosition);
                        var name  = "materials/ensage_ui/miniheroes/" +
                                    Members.PAisHere.StoredName().Replace("npc_dota_hero_", "") + ".vmat";
                        Drawing.DrawRect(w2M - new Vector2(size3.X / 2, size3.Y / 2), size3,
                                         Drawing.GetTexture(name));
                    }
                }
                catch (Exception)
                {
                    Printer.Print("[Draw]: phantom assasin");
                }
            }
        }
예제 #44
0
 public Sprite(ContentManager theContentManager, string theAssetName, Textures tex)
 {
     _spriteIndex = (int)tex;
     _mSpriteTexture = theContentManager.Load<Texture2D>(theAssetName);
     _size = new Rectangle(PosX*32, PosY*32, 32, 32);
 }
예제 #45
0
        private bool LoadTextures(Device device, string[] textureFileNames)
        {
            for (var i = 0; i < textureFileNames.Length; i++)
                textureFileNames[i] = SystemConfiguration.DataFilePath + textureFileNames[i];

            // Create the texture object.
            TextureCollection = new Textures();

            // Initialize the texture object.
            if (!TextureCollection.Initialize(device, textureFileNames))
                return false;

            return true;
        }
예제 #46
0
 public void addElement(Textures texture, Point position, Color color)
 {
     this.elts.Add(new GraphicElts(texture, position, color));
 }
예제 #47
0
 internal void SetTexture(Textures tex)
 {
     Sprite = new Sprite(FadingWorldsGameWindow.Instance.Content, "sprites", tex);
 }
예제 #48
0
파일: Hosts.cs 프로젝트: leezer3/OpenBVE
		/// <summary>Registers a texture and returns a handle to the texture.</summary>
		/// <param name="texture">The texture data.</param>
		/// <param name="parameters">The parameters that specify how to process the texture.</param>
		/// <param name="handle">Receives the handle to the texture.</param>
		/// <returns>Whether loading the texture was successful.</returns>
		public virtual bool RegisterTexture(Textures.Texture texture, TextureParameters parameters, out TextureHandle handle) {
			handle = null;
			return false;
		}
예제 #49
0
 private void onClickFindNext(object sender, EventArgs e)
 {
     int id, i;
     if (selected > -1)
     {
         id = selected + 1;
         i = TextureList.IndexOf(selected) + 1;
     }
     else
     {
         id = 1;
         i = 0;
     }
     for (; i < TextureList.Count; ++i, ++id)
     {
         if (id < TextureList[i])
         {
             selected = TextureList[i];
             vScrollBar.Value = i / refMarker.col + 1;
             GraphicLabel.Text = String.Format("Graphic: 0x{0:X4} ({0}) [{1}x{1}", selected, Textures.GetTexture(selected));
             pictureBox.Invalidate();
             break;
         }
     }
 }
예제 #50
0
 public Block(Textures tex, Position2D pos)
     : base(tex, Helper.RandomString(20))
 {
     Position = pos;
     Entities = new EntityCollection();
 }
예제 #51
0
        internal void PreSave()
        {
            Version = SaveVersion();

            if (MatVisibilityAnims == null)
            {
                MatVisibilityAnims = new ResDict <MaterialAnim>();
            }

            for (int i = 0; i < Models.Count; i++)
            {
                for (int s = 0; s < Models[i].Shapes.Count; s++)
                {
                    Models[i].Shapes[s].VertexBuffer = Models[i].VertexBuffers[Models[i].Shapes[s].VertexBufferIndex];

                    //Link texture sections for wii u texture refs
                    if (Textures != null)
                    {
                        foreach (var texRef in Models[i].Materials[Models[i].Shapes[s].MaterialIndex].TextureRefs)
                        {
                            if (Textures.ContainsKey(texRef.Name))
                            {
                                texRef.Texture = Textures[texRef.Name];
                            }
                        }
                    }
                }
            }

            for (int i = 0; i < SkeletalAnims.Count; i++)
            {
                int curveIndex = 0;
                SkeletalAnims[i].BakedSize = 0;
                for (int s = 0; s < SkeletalAnims[i].BoneAnims.Count; s++)
                {
                    SkeletalAnims[i].BoneAnims[s].BeginCurve = curveIndex;
                    curveIndex += SkeletalAnims[i].BoneAnims[s].Curves.Count;

                    foreach (var curve in SkeletalAnims[i].BoneAnims[s].Curves)
                    {
                        SkeletalAnims[i].BakedSize += curve.CalculateBakeSize(IsPlatformSwitch);
                    }
                }
            }

            // Update ShapeAnim instances.
            foreach (ShapeAnim anim in ShapeAnims.Values)
            {
                int curveIndex = 0;
                int infoIndex  = 0;
                anim.BakedSize = 0;
                foreach (VertexShapeAnim subAnim in anim.VertexShapeAnims)
                {
                    subAnim.BeginCurve        = curveIndex;
                    subAnim.BeginKeyShapeAnim = infoIndex;
                    curveIndex += subAnim.Curves.Count;
                    infoIndex  += subAnim.KeyShapeAnimInfos.Count;

                    foreach (var curve in subAnim.Curves)
                    {
                        anim.BakedSize += curve.CalculateBakeSize(IsPlatformSwitch);
                    }
                }
            }

            foreach (var anim in TexPatternAnims.Values)
            {
                int curveIndex = 0;
                int infoIndex  = 0;
                anim.BakedSize = 0;
                foreach (var subAnim in anim.MaterialAnimDataList)
                {
                    if (subAnim.Curves.Count > 0)
                    {
                        subAnim.TexturePatternCurveIndex = curveIndex;
                    }
                    subAnim.InfoIndex = infoIndex;
                    curveIndex       += subAnim.Curves.Count;
                    infoIndex        += subAnim.PatternAnimInfos.Count;

                    foreach (var curve in subAnim.Curves)
                    {
                        anim.BakedSize += curve.CalculateBakeSize(IsPlatformSwitch);
                    }
                }
            }

            foreach (var anim in TexSrtAnims.Values)
            {
                int curveIndex = 0;
                int infoIndex  = 0;
                anim.BakedSize = 0;
                foreach (var subAnim in anim.MaterialAnimDataList)
                {
                    if (subAnim.Curves.Count > 0)
                    {
                        subAnim.TexturePatternCurveIndex = curveIndex;
                    }
                    subAnim.InfoIndex = infoIndex;
                    curveIndex       += subAnim.Curves.Count;
                    infoIndex        += subAnim.PatternAnimInfos.Count;

                    foreach (var curve in subAnim.Curves)
                    {
                        anim.BakedSize += curve.CalculateBakeSize(IsPlatformSwitch);
                    }
                }
            }

            foreach (var anim in ColorAnims.Values)
            {
                int curveIndex = 0;
                int infoIndex  = 0;
                anim.BakedSize = 0;
                foreach (var subAnim in anim.MaterialAnimDataList)
                {
                    if (subAnim.Curves.Count > 0)
                    {
                        subAnim.TexturePatternCurveIndex = curveIndex;
                    }
                    subAnim.InfoIndex = infoIndex;
                    curveIndex       += subAnim.Curves.Count;
                    infoIndex        += subAnim.PatternAnimInfos.Count;

                    foreach (var curve in subAnim.Curves)
                    {
                        anim.BakedSize += curve.CalculateBakeSize(IsPlatformSwitch);
                    }
                }
            }

            foreach (var anim in ShaderParamAnims.Values)
            {
                int curveIndex = 0;
                int infoIndex  = 0;
                anim.BakedSize = 0;
                foreach (var subAnim in anim.MaterialAnimDataList)
                {
                    if (subAnim.Curves.Count > 0)
                    {
                        subAnim.ShaderParamCurveIndex = curveIndex;
                    }
                    subAnim.InfoIndex = infoIndex;
                    curveIndex       += subAnim.Curves.Count;
                    infoIndex        += subAnim.ParamAnimInfos.Count;

                    foreach (var curve in subAnim.Curves)
                    {
                        anim.BakedSize += curve.CalculateBakeSize(IsPlatformSwitch);
                    }
                }
            }

            foreach (var anim in MatVisibilityAnims.Values)
            {
                int curveIndex = 0;
                int infoIndex  = 0;
                anim.BakedSize = 0;
                foreach (var subAnim in anim.MaterialAnimDataList)
                {
                    if (subAnim.Curves.Count > 0)
                    {
                        subAnim.VisalCurveIndex = curveIndex;
                    }
                    curveIndex += subAnim.Curves.Count;

                    foreach (var curve in subAnim.Curves)
                    {
                        anim.BakedSize += curve.CalculateBakeSize(IsPlatformSwitch);
                    }
                }
            }

            foreach (var anim in BoneVisibilityAnims.Values)
            {
                anim.BakedSize = 0;
                foreach (var curve in anim.Curves)
                {
                    anim.BakedSize += curve.CalculateBakeSize(IsPlatformSwitch);
                }
            }

            if (IsPlatformSwitch)
            {
                MaterialAnims.Clear();
                foreach (var anim in TexPatternAnims.Values)
                {
                    MaterialAnims.Add(anim.Name, anim);
                }

                foreach (var anim in ShaderParamAnims.Values)
                {
                    MaterialAnims.Add(anim.Name, anim);
                }

                foreach (var anim in TexSrtAnims.Values)
                {
                    MaterialAnims.Add(anim.Name, anim);
                }

                foreach (var anim in ColorAnims.Values)
                {
                    MaterialAnims.Add(anim.Name, anim);
                }

                foreach (var anim in MatVisibilityAnims.Values)
                {
                    MaterialAnims.Add(anim.Name, anim);
                }

                for (int i = 0; i < MaterialAnims.Count; i++)
                {
                    MaterialAnims[i].signature = "FMAA";
                }
            }
        }
예제 #52
0
 public void RequireTexture(string name) => Textures.Add(name);
예제 #53
0
 public void Merge(ResourceCollector collector)
 {
     Textures.UnionWith(collector.Textures);
     AddedRenderables.UnionWith(collector.AddedRenderables);
     RemovedRenderables.UnionWith(collector.RemovedRenderables);
 }
예제 #54
0
 public GraphicElts(Textures texture, Point position, Color couleur)
 {
     this.texture = texture;
     this.position = position;
     this.couleur = couleur;
 }
예제 #55
0
    // METHODS
    public static Textures createLump(byte[] data, mapType type)
    {
        int numElements = -1;            // For Quake and Source, which use nonconstant struct lengths

        int[] offsets      = new int[0]; // For Quake, which stores offsets to each texture definition structure, which IS a constant length
        int   structLength = 0;

        switch (type)
        {
        case mapType.TYPE_NIGHTFIRE:
            structLength = 64;
            break;

        case mapType.TYPE_QUAKE3:
        case mapType.TYPE_RAVEN:
        case mapType.TYPE_COD:
        case mapType.TYPE_COD2:
        case mapType.TYPE_COD4:
            structLength = 72;
            break;

        case mapType.TYPE_QUAKE2:
        case mapType.TYPE_DAIKATANA:
        case mapType.TYPE_SOF:
        case mapType.TYPE_STEF2:
        case mapType.TYPE_STEF2DEMO:
        case mapType.TYPE_FAKK:
            structLength = 76;
            break;

        case mapType.TYPE_MOHAA:
            structLength = 140;
            break;

        case mapType.TYPE_SIN:
            structLength = 180;
            break;

        case mapType.TYPE_SOURCE17:
        case mapType.TYPE_SOURCE18:
        case mapType.TYPE_SOURCE19:
        case mapType.TYPE_SOURCE20:
        case mapType.TYPE_SOURCE21:
        case mapType.TYPE_SOURCE22:
        case mapType.TYPE_SOURCE23:
        case mapType.TYPE_SOURCE27:
        case mapType.TYPE_TACTICALINTERVENTION:
        case mapType.TYPE_VINDICTUS:
        case mapType.TYPE_DMOMAM:
            numElements = 0;
            for (int i = 0; i < data.Length; i++)
            {
                if (data[i] == 0x00)
                {
                    numElements++;
                }
            }
            break;

        case mapType.TYPE_QUAKE:
            numElements = DataReader.readInt(data[0], data[1], data[2], data[3]);
            offsets     = new int[numElements];
            for (int i = 0; i < numElements; i++)
            {
                offsets[i] = DataReader.readInt(data[((i + 1) * 4)], data[((i + 1) * 4) + 1], data[((i + 1) * 4) + 2], data[((i + 1) * 4) + 3]);
            }
            structLength = 40;
            break;
        }
        Textures lump;

        if (numElements == -1)
        {
            int offset = 0;
            //elements = new Texture[data.Length / structLength];
            lump = new Textures(new List <Texture>(data.Length / structLength), data.Length, structLength);
            byte[] bytes = new byte[structLength];
            for (int i = 0; i < data.Length / structLength; i++)
            {
                for (int j = 0; j < structLength; j++)
                {
                    bytes[j] = data[offset + j];
                }
                lump.Add(new Texture(bytes, type));
                offset += structLength;
            }
        }
        else
        {
            lump = new Textures(new List <Texture>(numElements), data.Length, structLength);
            if (offsets.Length != 0)
            {
                // Quake/GoldSrc
                for (int i = 0; i < numElements; i++)
                {
                    int    offset = offsets[i];
                    byte[] bytes  = new byte[structLength];
                    for (int j = 0; j < structLength; j++)
                    {
                        bytes[j] = data[offset + j];
                    }
                    lump.Add(new Texture(bytes, type));
                    offset += structLength;
                }
            }
            else
            {
                // Source
                int    offset  = 0;
                int    current = 0;
                byte[] bytes   = new byte[0];
                for (int i = 0; i < data.Length; i++)
                {
                    if (data[i] == (byte)0x00)
                    {
                        // They are null-terminated strings, of non-constant length (not padded)
                        lump.Add(new Texture(bytes, type));
                        bytes = new byte[0];
                        current++;
                    }
                    else
                    {
                        byte[] newList = new byte[bytes.Length + 1];
                        for (int j = 0; j < bytes.Length; j++)
                        {
                            newList[j] = bytes[j];
                        }
                        newList[bytes.Length] = data[i];
                        bytes = newList;
                    }
                    offset++;
                }
            }
        }
        return(lump);
    }
예제 #56
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        public void ChangePlatform(bool isSwitch, int alignment,
                                   byte versionA, byte versionB, byte versionC, byte versionD, PlatformConverters.ConverterHandle handle)
        {
            if (IsPlatformSwitch && isSwitch || (!IsPlatformSwitch && !isSwitch))
            {
                return;
            }

            //Shaders cannot be converted, remove them
            for (int i = 0; i < ExternalFiles.Count; i++)
            {
                if (ExternalFiles.Keys.ElementAt(i).Contains(".bfsha"))
                {
                    ExternalFiles.RemoveAt(i);
                }
            }

            if (!IsPlatformSwitch && isSwitch)
            {
                ConvertTexturesToBntx(Textures.Values.ToList());
            }
            else
            {
                List <TextureShared> textures = new List <TextureShared>();
                foreach (var tex in this.Textures.Values)
                {
                    var textureU = new WiiU.Texture();
                    textureU.FromSwitch((Switch.SwitchTexture)tex);
                    textures.Add(textureU);
                }
                Textures.Clear();
                foreach (var tex in textures)
                {
                    Textures.Add(tex.Name, tex);
                }

                foreach (var mdl in Models.Values)
                {
                    foreach (var mat in mdl.Materials.Values)
                    {
                        mat.RenderState = new RenderState();
                    }
                }

                for (int i = 0; i < ExternalFiles.Count; i++)
                {
                    if (ExternalFiles.Keys.ElementAt(i).Contains(".bntx"))
                    {
                        ExternalFiles.RemoveAt(i);
                    }
                }
            }

            //Order to read the existing data
            ByteOrder byteOrder = IsPlatformSwitch ? ByteOrder.LittleEndian : ByteOrder.BigEndian;
            //Order to set the target data
            ByteOrder targetOrder = isSwitch ? ByteOrder.LittleEndian : ByteOrder.BigEndian;

            IsPlatformSwitch = isSwitch;
            DataAlignment    = alignment;
            VersionMajor     = versionA;
            VersionMajor2    = versionB;
            VersionMinor     = versionC;
            VersionMinor2    = versionD;
            this.ByteOrder   = targetOrder;

            foreach (var model in Models.Values)
            {
                UpdateVertexBufferByteOrder(model, byteOrder, targetOrder);
                foreach (var shp in model.Shapes.Values)
                {
                    foreach (var mesh in shp.Meshes)
                    {
                        mesh.UpdateIndexBufferByteOrder(targetOrder);
                    }
                }
                foreach (var mat in model.Materials.Values)
                {
                    if (IsPlatformSwitch)
                    {
                        PlatformConverters.MaterialConverter.ConvertToSwitchMaterial(mat, handle);
                    }
                    else
                    {
                        PlatformConverters.MaterialConverter.ConvertToWiiUMaterial(mat, handle);
                    }
                }
            }

            if (IsPlatformSwitch)
            {
                foreach (var anim in ShaderParamAnims.Values)
                {
                    anim.Name = $"{anim.Name}_fsp";
                }

                foreach (var anim in TexSrtAnims.Values)
                {
                    anim.Name = $"{anim.Name}_fts";
                }

                foreach (var anim in ColorAnims.Values)
                {
                    anim.Name = $"{anim.Name}_fcl";
                }

                foreach (var anim in TexPatternAnims.Values)
                {
                    anim.Name = $"{anim.Name}_ftp";
                }

                foreach (var anim in MatVisibilityAnims.Values)
                {
                    anim.Name = $"{anim.Name}_fvs";
                }
            }
            else
            {
                this.TexPatternAnims    = new ResDict <MaterialAnim>();
                this.ShaderParamAnims   = new ResDict <MaterialAnim>();
                this.ColorAnims         = new ResDict <MaterialAnim>();
                this.TexSrtAnims        = new ResDict <MaterialAnim>();
                this.MatVisibilityAnims = new ResDict <MaterialAnim>();
            }
        }
예제 #57
0
        private static void Drawing_OnDraw(EventArgs args)
        {
            if (!Checker.IsActive())
            {
                return;
            }
            if (!IsEnable)
            {
                return;
            }
            List <Hero> selectedHeroes = null;

            switch (SelectedIndex)
            {
            case 0:
                selectedHeroes = Manager.HeroManager.GetViableHeroes();
                break;

            case 1:
                selectedHeroes = Manager.HeroManager.GetAllyViableHeroes();
                break;

            case 2:
                selectedHeroes = Manager.HeroManager.GetEnemyViableHeroes();
                break;
            }
            if (selectedHeroes == null)
            {
                return;
            }
            foreach (var v in selectedHeroes)
            {
                try
                {
                    var pos = HUDInfo.GetHPbarPosition(v);
                    if (pos.IsZero)
                    {
                        continue;
                    }
                    var spells = Manager.HeroManager.GetAbilityList(v);
                    pos += new Vector2(0, HUDInfo.GetHPBarSizeX());
                    pos += new Vector2(ExtraX, ExtraY);
                    var counter = 0;
                    var size    = new Vector2(IconSize, IconSize);
                    foreach (var ability in spells)
                    {
                        var itemPos = pos + new Vector2(-2 + size.X * counter, 2);
                        Drawing.DrawRect(itemPos, size,
                                         Textures.GetSpellTexture(ability.StoredName()));
                        Drawing.DrawRect(itemPos, size,
                                         Color.Black, true);
                        var abilityState = ability.AbilityState;
                        if (abilityState == AbilityState.NotEnoughMana)
                        {
                            Drawing.DrawRect(itemPos, size,
                                             new Color(0, 0, 155, 155));
                            var neededMana = ((int)Math.Min(Math.Abs(v.Mana - ability.ManaCost), 99)).ToString(
                                CultureInfo.InvariantCulture);
                            var textSize = Drawing.MeasureText(neededMana, "Arial",
                                                               new Vector2(
                                                                   (float)(size.Y * TextSize),
                                                                   size.Y / 2), FontFlags.AntiAlias);
                            var textPos = itemPos + new Vector2(/*size.X-textSize.X*/ 1, 0);
                            Drawing.DrawRect(textPos - new Vector2(0, 0),
                                             new Vector2(textSize.X, textSize.Y),
                                             new Color(0, 0, 0, 200));
                            Drawing.DrawText(
                                neededMana,
                                textPos,
                                new Vector2(textSize.Y, 0),
                                Color.White,
                                FontFlags.AntiAlias | FontFlags.StrikeOut);
                        }
                        if (abilityState != AbilityState.NotLearned)
                        {
                            var level       = ability.Level;
                            var levelString = level.ToString();
                            var textSize    = Drawing.MeasureText(levelString, "Arial",
                                                                  new Vector2(
                                                                      (float)(size.Y * TextSizeLevel),
                                                                      size.Y / 2), FontFlags.AntiAlias);
                            var textPos = itemPos + new Vector2(1, size.Y - textSize.Y);
                            Drawing.DrawRect(textPos - new Vector2(0, 0),
                                             new Vector2(textSize.X, textSize.Y),
                                             new Color(0, 0, 0, 240));
                            Drawing.DrawText(
                                levelString,
                                textPos,
                                new Vector2(textSize.Y, 0),
                                Color.White,
                                FontFlags.AntiAlias | FontFlags.StrikeOut);
                        }
                        else
                        {
                            Drawing.DrawRect(itemPos, size,
                                             new Color(0, 0, 0, 150));
                        }
                        if (abilityState == AbilityState.OnCooldown)
                        {
                            var remTime  = ability.Cooldown;
                            var cooldown = Math.Min(remTime + 0.1, 99).ToString("0.0");
                            var textSize = Drawing.MeasureText(cooldown, "Arial",
                                                               new Vector2(
                                                                   (float)(size.Y * TextSize),
                                                                   size.Y / 2), FontFlags.AntiAlias);
                            var textPos = itemPos + new Vector2(0, 0);
                            Drawing.DrawRect(textPos - new Vector2(1, 0),
                                             new Vector2(textSize.X, textSize.Y),
                                             new Color(0, 0, 0, 200));
                            Drawing.DrawText(
                                cooldown,
                                textPos,
                                new Vector2(textSize.Y, 0),
                                Color.White,
                                FontFlags.AntiAlias | FontFlags.StrikeOut);
                        }


                        counter++;
                    }
                }
                catch (Exception e)
                {
                    Printer.Print($"[AbilityOverlay]: {v.StoredName()} : {e.HelpLink}");
                }
            }
        }