Exemple #1
0
		public static void DrawShop()
		{
			int i = 0;
			int x = 0;
			int y = 0;
			int itemnum = 0;
			int itempic = 0;
			string amount = "";
			Rectangle rec = new Rectangle();
			Rectangle recPos = new Rectangle();
			SFML.Graphics.Color colour = new SFML.Graphics.Color();
			
			if (!C_Variables.InGame || C_UpdateUI.PnlShopVisible == false)
			{
				return;
			}
			
			//first render panel
			C_Graphics.RenderSprite(C_Graphics.ShopPanelSprite, C_Graphics.GameWindow, C_UpdateUI.ShopWindowX, C_UpdateUI.ShopWindowY, 0, 0, C_Graphics.ShopPanelGfxInfo.Width, C_Graphics.ShopPanelGfxInfo.Height);
			
			if (Types.Shop[InShop].Face > 0)
			{
				//render face
				if (C_Graphics.FacesGfxInfo[Types.Shop[InShop].Face].IsLoaded == false)
				{
					C_Graphics.LoadTexture(Types.Shop[InShop].Face, (byte) 7);
				}
				
				//seeying we still use it, lets update timer
				ref var with_1 = ref C_Graphics.FacesGfxInfo[Types.Shop[InShop].Face];
				with_1.TextureTimer = C_General.GetTickCount() + 100000;
				C_Graphics.RenderSprite(C_Graphics.FacesSprite[Types.Shop[InShop].Face], C_Graphics.GameWindow, C_UpdateUI.ShopWindowX + C_UpdateUI.ShopFaceX, C_UpdateUI.ShopWindowY + C_UpdateUI.ShopFaceY, 0, 0, C_Graphics.FacesGfxInfo[Types.Shop[InShop].Face].Width, C_Graphics.FacesGfxInfo[Types.Shop[InShop].Face].Height);
			}
        internal static void DrawResource(int resource, int dx, int dy, Rectangle rec)
        {
            if (resource < 1 || resource > C_Graphics.NumResources)
            {
                return;
            }
            int x = 0;
            int y = 0;
            int width;
            int height;

            x      = C_Graphics.ConvertMapX(dx);
            y      = C_Graphics.ConvertMapY(dy);
            width  = rec.Right - rec.Left;
            height = rec.Bottom - rec.Top;

            if (rec.Width < 0 || rec.Height < 0)
            {
                return;
            }

            if (C_Graphics.ResourcesGfxInfo[resource].IsLoaded == false)
            {
                C_Graphics.LoadTexture(resource, (byte)5);
            }

            //seeying we still use it, lets update timer
            ref var with_1 = ref C_Graphics.ResourcesGfxInfo[resource];
        internal static void DrawFog()
        {
            int fogNum = 0;

            fogNum = CurrentFog;
            if (fogNum <= 0 || fogNum > C_Graphics.NumFogs)
            {
                return;
            }

            if (C_Graphics.FogGfxInfo[fogNum].IsLoaded == false)
            {
                C_Graphics.LoadTexture(fogNum, (byte)8);
            }

            //seeying we still use it, lets update timer
            C_Graphics.FogGfxInfo[fogNum].TextureTimer = C_General.GetTickCount() + 100000;

            C_Graphics.FogGfx[fogNum].Repeated = true;
            C_Graphics.FogGfx[fogNum].Smooth   = true;

            C_Graphics.FogSprite[fogNum].Color       = new Color(255, 255, 255, (byte)CurrentFogOpacity);
            C_Graphics.FogSprite[fogNum].TextureRect = new IntRect(0, 0, (int)C_Graphics.GameWindow.Size.X + 200, (int)C_Graphics.GameWindow.Size.Y + 200);
            C_Graphics.FogSprite[fogNum].Position    = new Vector2f((float)((FogOffsetX * 2.5) - 50), (float)((FogOffsetY * 3.5) - 50));
            C_Graphics.FogSprite[fogNum].Scale       = new Vector2f((float)((C_Graphics.GameWindow.Size.X + 200) / C_Graphics.FogGfxInfo[fogNum].Width), (float)((C_Graphics.GameWindow.Size.Y + 200) / C_Graphics.FogGfxInfo[fogNum].Height));

            C_Graphics.GameWindow.Draw(C_Graphics.FogSprite[fogNum]);
        }
Exemple #4
0
        public static void DrawHotbar()
        {
            int       i      = 0;
            int       num    = 0;
            int       pic    = 0;
            Rectangle rec    = new Rectangle();
            Rectangle recPos = new Rectangle();

            C_Graphics.RenderSprite(C_Graphics.HotBarSprite, C_Graphics.GameWindow, C_UpdateUI.HotbarX, C_UpdateUI.HotbarY, 0, 0, C_Graphics.HotBarGfxInfo.Width, C_Graphics.HotBarGfxInfo.Height);

            for (i = 1; i <= MaxHotbar; i++)
            {
                if (C_Types.Player[C_Variables.Myindex].Hotbar[i].SType == 1)
                {
                    num = C_Variables.PlayerSkills[C_Types.Player[C_Variables.Myindex].Hotbar[i].Slot];

                    if (num > 0)
                    {
                        pic = Types.Skill[num].Icon;

                        if (C_Graphics.SkillIconsGfxInfo[pic].IsLoaded == false)
                        {
                            C_Graphics.LoadTexture(pic, (byte)9);
                        }

                        //seeying we still use it, lets update timer
                        ref var with_1 = ref C_Graphics.SkillIconsGfxInfo[pic];
                        with_1.TextureTimer = C_General.GetTickCount() + 100000;

                        rec.Y      = 0;
                        rec.Height = 32;
                        rec.X      = 0;
                        rec.Width  = 32;

                        if (!(C_Variables.SkillCd[i] == 0))
                        {
                            rec.X     = 32;
                            rec.Width = 32;
                        }

                        recPos.Y      = C_UpdateUI.HotbarY + HotbarTop;
                        recPos.Height = C_Constants.PicY;
                        recPos.X      = C_UpdateUI.HotbarX + HotbarLeft + ((HotbarOffsetX + 32) * (i - 1));
                        recPos.Width  = C_Constants.PicX;

                        C_Graphics.RenderSprite(C_Graphics.SkillIconsSprite[pic], C_Graphics.GameWindow, recPos.X, recPos.Y, rec.X, rec.Y, rec.Width, rec.Height);
                    }
                }
Exemple #5
0
        internal static void DrawFog()
        {
            int fogNum = 0;

            fogNum = CurrentFog;
            if (fogNum <= 0 || fogNum > C_Graphics.NumFogs)
            {
                return;
            }

            if (C_Graphics.FogGfxInfo[fogNum].IsLoaded == false)
            {
                C_Graphics.LoadTexture(fogNum, (byte)8);
            }

            //seeying we still use it, lets update timer
            ref var with_1 = ref C_Graphics.FogGfxInfo[fogNum];
Exemple #6
0
        public static void DrawBank()
        {
            int       i       = 0;
            int       x       = 0;
            int       y       = 0;
            int       itemnum = 0;
            string    amount  = "";
            Rectangle sRect   = new Rectangle();
            Rectangle dRect   = new Rectangle();
            int       sprite  = 0;

            SFML.Graphics.Color colour = new SFML.Graphics.Color();

            //first render panel
            C_Graphics.RenderSprite(C_Graphics.BankPanelSprite, C_Graphics.GameWindow, C_UpdateUI.BankWindowX, C_UpdateUI.BankWindowY, 0, 0, C_Graphics.BankPanelGfxInfo.Width, C_Graphics.BankPanelGfxInfo.Height);

            //Headertext
            C_Text.DrawText(C_UpdateUI.BankWindowX + 140, C_UpdateUI.BankWindowY + 6, "Your Bank", SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow, (byte)15);

            //close
            C_Text.DrawText(C_UpdateUI.BankWindowX + 140, C_UpdateUI.BankWindowY + C_Graphics.BankPanelGfxInfo.Height - 20, "Close Bank", SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow, (byte)15);

            for (i = 1; i <= Constants.MAX_BANK; i++)
            {
                itemnum = C_GameLogic.GetBankItemNum((byte)i);
                if (itemnum > 0 && itemnum <= Constants.MAX_ITEMS)
                {
                    sprite = Types.Item[itemnum].Pic;

                    if (C_Graphics.ItemsGfxInfo[sprite].IsLoaded == false)
                    {
                        C_Graphics.LoadTexture(sprite, (byte)4);
                    }

                    //seeying we still use it, lets update timer
                    ref var with_1 = ref C_Graphics.ItemsGfxInfo[sprite];
                    with_1.TextureTimer = C_General.GetTickCount() + 100000;

                    sRect.Y      = 0;
                    sRect.Height = C_Constants.PicY;
                    sRect.X      = 0;
                    sRect.Width  = C_Constants.PicX;

                    dRect.Y      = C_UpdateUI.BankWindowY + C_UpdateUI.BankTop + ((C_UpdateUI.BankOffsetY + 32) * ((i - 1) / C_UpdateUI.BankColumns));
                    dRect.Height = C_Constants.PicY;
                    dRect.X      = C_UpdateUI.BankWindowX + C_UpdateUI.BankLeft + ((C_UpdateUI.BankOffsetX + 32) * ((i - 1) % C_UpdateUI.BankColumns));
                    dRect.Width  = C_Constants.PicX;

                    C_Graphics.RenderSprite(C_Graphics.ItemsSprite[sprite], C_Graphics.GameWindow, dRect.X, dRect.Y, sRect.X, sRect.Y, sRect.Width, sRect.Height);

                    // If item is a stack - draw the amount you have
                    if (C_GameLogic.GetBankItemValue((byte)i) > 1)
                    {
                        y = dRect.Top + 22;
                        x = dRect.Left - 4;

                        amount = System.Convert.ToString(C_GameLogic.GetBankItemValue((byte)i));
                        colour = SFML.Graphics.Color.White;
                        // Draw currency but with k, m, b etc. using a convertion function
                        if (long.Parse(amount) < 1000000)
                        {
                            colour = SFML.Graphics.Color.White;
                        }
                        else if (long.Parse(amount) > 1000000 && long.Parse(amount) < 10000000)
                        {
                            colour = SFML.Graphics.Color.Yellow;
                        }
                        else if (long.Parse(amount) > 10000000)
                        {
                            colour = SFML.Graphics.Color.Green;
                        }

                        C_Text.DrawText(x, y, C_GameLogic.ConvertCurrency(System.Convert.ToInt32(amount)), colour, SFML.Graphics.Color.Black, C_Graphics.GameWindow);
                    }
                }
            }
Exemple #7
0
        public static void DrawTrade()
        {
            int       i       = 0;
            int       x       = 0;
            int       y       = 0;
            int       itemnum = 0;
            int       itempic = 0;
            string    amount  = "";
            Rectangle rec     = new Rectangle();
            Rectangle recPos  = new Rectangle();

            SFML.Graphics.Color colour = new SFML.Graphics.Color();

            amount = System.Convert.ToString(0);
            colour = SFML.Graphics.Color.White;

            if (!C_Variables.InGame)
            {
                return;
            }

            //first render panel
            C_Graphics.RenderSprite(C_Graphics.TradePanelSprite, C_Graphics.GameWindow, C_UpdateUI.TradeWindowX, C_UpdateUI.TradeWindowY, 0, 0, C_Graphics.TradePanelGfxInfo.Width, C_Graphics.TradePanelGfxInfo.Height);

            //Headertext
            C_Text.DrawText(C_UpdateUI.TradeWindowX + 70, C_UpdateUI.TradeWindowY + 6, "Your Offer", SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow, (byte)15);

            C_Text.DrawText(C_UpdateUI.TradeWindowX + 260, C_UpdateUI.TradeWindowY + 6, C_UpdateUI.Tradername + "'s Offer.", SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow, (byte)15);

            for (i = 1; i <= Constants.MAX_INV; i++)
            {
                // blt your own offer
                itemnum = C_Player.GetPlayerInvItemNum(C_Variables.Myindex, TradeYourOffer[i].Num);

                if (itemnum > 0 && itemnum <= Constants.MAX_ITEMS)
                {
                    itempic = Types.Item[itemnum].Pic;

                    if (itempic > 0 && itempic <= C_Graphics.NumItems)
                    {
                        if (C_Graphics.ItemsGfxInfo[itempic].IsLoaded == false)
                        {
                            C_Graphics.LoadTexture(itempic, (byte)4);
                        }

                        //seeying we still use it, lets update timer
                        ref var with_1 = ref C_Graphics.ItemsGfxInfo[itempic];
                        with_1.TextureTimer = C_General.GetTickCount() + 100000;

                        rec.Y      = 0;
                        rec.Height = C_Constants.PicY;
                        rec.X      = 0;
                        rec.Width  = C_Constants.PicX;

                        recPos.Y      = C_UpdateUI.TradeWindowY + C_UpdateUI.OurTradeY + C_UpdateUI.InvTop + ((C_UpdateUI.InvOffsetY + 32) * ((i - 1) / C_UpdateUI.InvColumns));
                        recPos.Height = C_Constants.PicY;
                        recPos.X      = C_UpdateUI.TradeWindowX + C_UpdateUI.OurTradeX + C_UpdateUI.InvLeft + ((C_UpdateUI.InvOffsetX + 32) * ((i - 1) % C_UpdateUI.InvColumns));
                        recPos.Width  = C_Constants.PicX;

                        C_Graphics.RenderSprite(C_Graphics.ItemsSprite[itempic], C_Graphics.GameWindow, recPos.X, recPos.Y, rec.X, rec.Y, rec.Width, rec.Height);

                        // If item is a stack - draw the amount you have
                        if (TradeYourOffer[i].Value >= 1)
                        {
                            y = recPos.Top + 22;
                            x = recPos.Left - 4;

                            // Draw currency but with k, m, b etc. using a convertion function
                            if (double.Parse(amount) < 1000000)
                            {
                                colour = SFML.Graphics.Color.White;
                            }
                            else if (double.Parse(amount) > 1000000 && long.Parse(amount) < 10000000)
                            {
                                colour = SFML.Graphics.Color.Yellow;
                            }
                            else if (double.Parse(amount) > 10000000)
                            {
                                colour = SFML.Graphics.Color.Green;
                            }

                            amount = System.Convert.ToString(TradeYourOffer[i].Value);
                            C_Text.DrawText(x, y, C_GameLogic.ConvertCurrency(System.Convert.ToInt32(amount)), colour, SFML.Graphics.Color.Black, C_Graphics.GameWindow);
                        }
                    }
                }
            }
Exemple #8
0
        internal static void DrawCraftPanel()
        {
            int       i        = 0;
            int       y        = 0;
            Rectangle rec      = new Rectangle();
            int       pgbvalue = 0;

            for (i = 1; i <= Constants.MAX_RECIPE; i++)
            {
                if (RecipeNames[i] == null)
                {
                    RecipeNames[i] = "";
                }
            }

            //first render panel
            C_Graphics.RenderSprite(C_Graphics.CraftSprite, C_Graphics.GameWindow, C_UpdateUI.CraftPanelX, C_UpdateUI.CraftPanelY, 0, 0, C_Graphics.CraftGfxInfo.Width, C_Graphics.CraftGfxInfo.Height);

            y = 10;

            //draw recipe names
            for (i = 1; i <= Constants.MAX_RECIPE; i++)
            {
                if (RecipeNames[i].Trim().Length > 0)
                {
                    C_Text.DrawText(C_UpdateUI.CraftPanelX + 12, C_UpdateUI.CraftPanelY + y, RecipeNames[i].Trim(), SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow);
                    y = y + 20;
                }
            }

            //progress bar
            pgbvalue = (int)(((double)CraftProgressValue / 100) * 100);

            rec.Y      = 0;
            rec.Height = C_Graphics.ProgBarGfxInfo.Height;
            rec.X      = 0;
            rec.Width  = (int)((double)pgbvalue * C_Graphics.ProgBarGfxInfo.Width / 100);

            C_Graphics.RenderSprite(C_Graphics.ProgBarSprite, C_Graphics.GameWindow, C_UpdateUI.CraftPanelX + 410, C_UpdateUI.CraftPanelY + 417, rec.X, rec.Y, rec.Width, rec.Height);

            //amount controls
            C_Graphics.RenderSprite(C_Graphics.CharPanelMinSprite, C_Graphics.GameWindow, C_UpdateUI.CraftPanelX + 340, C_UpdateUI.CraftPanelY + 422, 0, 0, C_Graphics.CharPanelMinGfxInfo.Width, C_Graphics.CharPanelMinGfxInfo.Height);

            C_Text.DrawText(C_UpdateUI.CraftPanelX + 367, C_UpdateUI.CraftPanelY + 418, Microsoft.VisualBasic.Strings.Trim(CraftAmountValue.ToString()), SFML.Graphics.Color.Black, SFML.Graphics.Color.White, C_Graphics.GameWindow);

            C_Graphics.RenderSprite(C_Graphics.CharPanelPlusSprite, C_Graphics.GameWindow, C_UpdateUI.CraftPanelX + 392, C_UpdateUI.CraftPanelY + 422, 0, 0, C_Graphics.CharPanelPlusGfxInfo.Width, C_Graphics.CharPanelPlusGfxInfo.Height);

            if (SelectedRecipe == 0)
            {
                return;
            }

            if (PicProductindex > 0)
            {
                if (C_Graphics.ItemsGfxInfo[PicProductindex].IsLoaded == false)
                {
                    C_Graphics.LoadTexture(PicProductindex, (byte)4);
                }

                //seeying we still use it, lets update timer
                C_Graphics.ItemsGfxInfo[PicProductindex].TextureTimer = C_General.GetTickCount() + 100000;

                C_Graphics.RenderSprite(C_Graphics.ItemsSprite[PicProductindex], C_Graphics.GameWindow, C_UpdateUI.CraftPanelX + 267, C_UpdateUI.CraftPanelY + 20, 0, 0, C_Graphics.ItemsGfxInfo[PicProductindex].Width, C_Graphics.ItemsGfxInfo[PicProductindex].Height);

                C_Text.DrawText(C_UpdateUI.CraftPanelX + 310, C_UpdateUI.CraftPanelY + 20, LblProductNameText.Trim(), SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow);

                C_Text.DrawText(C_UpdateUI.CraftPanelX + 310, C_UpdateUI.CraftPanelY + 35, LblProductAmountText.Trim(), SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow);
            }

            y = 107;

            for (i = 1; i <= Constants.MAX_INGREDIENT; i++)
            {
                if (PicMaterialIndex[i] > 0)
                {
                    if (C_Graphics.ItemsGfxInfo[PicMaterialIndex[i]].IsLoaded == false)
                    {
                        C_Graphics.LoadTexture(PicMaterialIndex[i], (byte)4);
                    }

                    //seeying we still use it, lets update timer
                    ref var with_3 = ref C_Graphics.ItemsGfxInfo[PicMaterialIndex[i]];
                    with_3.TextureTimer = C_General.GetTickCount() + 100000;

                    C_Graphics.RenderSprite(C_Graphics.ItemsSprite[PicMaterialIndex[i]], C_Graphics.GameWindow, C_UpdateUI.CraftPanelX + 275, C_UpdateUI.CraftPanelY + y, 0, 0, C_Graphics.ItemsGfxInfo[PicMaterialIndex[i]].Width, C_Graphics.ItemsGfxInfo[PicMaterialIndex[i]].Height);

                    C_Text.DrawText(C_UpdateUI.CraftPanelX + 315, C_UpdateUI.CraftPanelY + y, LblMaterialName[i].Trim(), SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow);

                    C_Text.DrawText(C_UpdateUI.CraftPanelX + 315, C_UpdateUI.CraftPanelY + y + 15, LblMaterialAmount[i].Trim(), SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow);

                    y = y + 63;
                }
            }