示例#1
0
        public void btnSaveSettings_Click(object sender, EventArgs e)
        {
            //music
            if (optMOn.Checked == true)
            {
                C_Types.Options.Music = (byte)1;
                // start music playing
                C_Sound.PlayMusic(C_Maps.Map.Music.Trim());
            }
            else
            {
                C_Types.Options.Music = (byte)0;
                // stop music playing
                C_Sound.StopMusic();
                C_Sound.CurMusic = "";
            }

            //sound
            if (optSOn.Checked == true)
            {
                C_Types.Options.Sound = (byte)1;
            }
            else
            {
                C_Types.Options.Sound = (byte)0;
                C_Sound.StopSound();
            }

            //screensize
            C_Types.Options.ScreenSize = System.Convert.ToByte(cmbScreenSize.SelectedIndex);

            if (chkHighEnd.Checked)
            {
                C_Types.Options.HighEnd = (byte)1;
            }
            else
            {
                C_Types.Options.HighEnd = (byte)0;
            }

            if (chkNpcBars.Checked)
            {
                C_Types.Options.ShowNpcBar = (byte)1;
            }
            else
            {
                C_Types.Options.ShowNpcBar = (byte)0;
            }

            // save to config.ini
            C_DataBase.SaveOptions();

            //reload options
            C_DataBase.LoadOptions();

            C_General.RePositionGui();

            this.Visible = false;
        }
示例#2
0
        public static void GetPing()
        {
            ByteStream buffer = new ByteStream(4);

            C_Variables.PingStart = C_General.GetTickCount();

            buffer.WriteInt32((System.Int32)Packets.ClientPackets.CCheckPing);
            C_NetworkConfig.Socket.SendData(buffer.Data, buffer.Head);

            buffer.Dispose();
        }
示例#3
0
        internal static void SendCraftIt(string recipeName, int amount)
        {
            ByteStream buffer      = new ByteStream(4);
            int        i           = 0;
            int        recipeindex = 0;

            recipeindex = GetRecipeIndex(recipeName);

            if (recipeindex <= 0)
            {
                return;
            }

            //check,check, double check

            //we dont even know the damn recipe xD
            if (C_Types.Player[C_Variables.Myindex].RecipeLearned[recipeindex] == 0)
            {
                return;
            }

            //enough ingredients
            for (i = 1; i <= Constants.MAX_INGREDIENT; i++)
            {
                if (Recipe[recipeindex].Ingredients[i].ItemNum > 0 && C_Quest.HasItem(C_Variables.Myindex, Recipe[recipeindex].Ingredients[i].ItemNum) < (amount * Recipe[recipeindex].Ingredients[i].Value))
                {
                    C_Text.AddText(Strings.Get("crafting", "notenough"), (System.Int32)Enums.ColorType.Red);
                    return;
                }
            }

            //all seems fine...

            buffer.WriteInt32((System.Int32)Packets.ClientPackets.CStartCraft);

            buffer.WriteInt32(recipeindex);
            buffer.WriteInt32(amount);

            C_NetworkConfig.Socket.SendData(buffer.Data, buffer.Head);

            buffer.Dispose();

            CraftTimer        = C_General.GetTickCount();
            CraftTimerEnabled = true;

            BtnCraftEnabled       = false;
            BtnCraftStopEnabled   = false;
            BtnCraftStopEnabled   = false;
            NudCraftAmountEnabled = false;
            LstRecipeEnabled      = false;
            ChkKnownOnlyEnabled   = false;
        }
示例#4
0
文件: C_Pets.cs 项目: goossin/toclone
        public static void SendUsePetSkill(int skill)
        {
            ByteStream buffer = new ByteStream(4);

            buffer.WriteInt32((System.Int32)Packets.ClientPackets.CPetSkill);
            buffer.WriteInt32(skill);

            C_NetworkConfig.Socket.SendData(buffer.Data, buffer.Head);
            buffer.Dispose();

            PetSkillBuffer      = skill;
            PetSkillBufferTimer = C_General.GetTickCount();
        }
示例#5
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);
                    }
                }
示例#6
0
        /// <summary>
        /// On load, get GUI ready.
        /// </summary>
        public void Frmmenu_Load(object sender, EventArgs e)
        {
            Strings.Init(0, "English");

            LoadMenuGraphics();

            pnlLoad.Width  = 730;
            pnlLoad.Height = 550;

            Width         = 730;
            pnlLogin.Top  = pnlMainMenu.Top;
            pnlLogin.Left = pnlMainMenu.Left;

            pnlNewChar.Top  = pnlMainMenu.Top;
            pnlNewChar.Left = pnlMainMenu.Left;

            pnlRegister.Top  = pnlMainMenu.Top;
            pnlRegister.Left = pnlMainMenu.Left;

            pnlCredits.Top  = pnlMainMenu.Top;
            pnlCredits.Left = pnlMainMenu.Left;

            pnlIPConfig.Top  = pnlMainMenu.Top;
            pnlIPConfig.Left = pnlMainMenu.Left;

            pnlCharSelect.Top  = pnlMainMenu.Top;
            pnlCharSelect.Left = pnlMainMenu.Left;

            UI_MainMenu.Initialize();

            if (C_General.Started == false)
            {
                C_General.Startup();
            }

            C_NetworkConfig.Connect();
        }
 private static void Socket_ConnectionLost()
 {
     MessageBox.Show("Connection was terminated! Returning to Main Menu");
     DestroyNetwork();
     C_General.DestroyGame(true);
 }
示例#8
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);
                    }
                }
            }
示例#9
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);
                        }
                    }
                }
            }
示例#10
0
        public static void CheckAttack()
        {
            int        attackspeed = 0;
            int        x           = 0;
            int        y           = 0;
            ByteStream buffer      = new ByteStream(4);

            if (C_UpdateUI.VbKeyControl)
            {
                if (C_EventSystem.InEvent == true)
                {
                    return;
                }
                if (C_Variables.SkillBuffer > 0)
                {
                    return;                     // currently casting a skill, can't attack
                }
                if (C_Variables.StunDuration > 0)
                {
                    return;                     // stunned, can't attack
                }

                // speed from weapon
                if (GetPlayerEquipment(C_Variables.Myindex, Enums.EquipmentType.Weapon) > 0)
                {
                    attackspeed = Types.Item[GetPlayerEquipment(C_Variables.Myindex, Enums.EquipmentType.Weapon)].Speed * 1000;
                }
                else
                {
                    attackspeed = 1000;
                }

                if (C_Types.Player[C_Variables.Myindex].AttackTimer + attackspeed < C_General.GetTickCount())
                {
                    if (C_Types.Player[C_Variables.Myindex].Attacking == 0)
                    {
                        ref var with_1 = ref C_Types.Player[C_Variables.Myindex];
                        with_1.Attacking   = (byte)1;
                        with_1.AttackTimer = C_General.GetTickCount();

                        C_NetworkSend.SendAttack();
                    }
                }

                if (C_Types.Player[C_Variables.Myindex].Dir == (byte)Enums.DirectionType.Up)
                {
                    x = GetPlayerX(C_Variables.Myindex);
                    y = GetPlayerY(C_Variables.Myindex) - 1;
                }
                else if (C_Types.Player[C_Variables.Myindex].Dir == (byte)Enums.DirectionType.Down)
                {
                    x = GetPlayerX(C_Variables.Myindex);
                    y = GetPlayerY(C_Variables.Myindex) + 1;
                }
                else if (C_Types.Player[C_Variables.Myindex].Dir == (byte)Enums.DirectionType.Left)
                {
                    x = GetPlayerX(C_Variables.Myindex) - 1;
                    y = GetPlayerY(C_Variables.Myindex);
                }
                else if (C_Types.Player[C_Variables.Myindex].Dir == (byte)Enums.DirectionType.Right)
                {
                    x = GetPlayerX(C_Variables.Myindex) + 1;
                    y = GetPlayerY(C_Variables.Myindex);
                }

                if (C_General.GetTickCount() > C_Types.Player[C_Variables.Myindex].EventTimer)
                {
                    for (var i = 1; i <= C_Maps.Map.CurrentEvents; i++)
                    {
                        if (C_Maps.Map.MapEvents[(int)i].Visible == 1)
                        {
                            if (C_Maps.Map.MapEvents[(int)i].X == x && C_Maps.Map.MapEvents[(int)i].Y == y)
                            {
                                buffer = new ByteStream(4);
                                buffer.WriteInt32((System.Int32)Packets.ClientPackets.CEvent);
                                buffer.WriteInt32(System.Convert.ToInt32(i));
                                C_NetworkConfig.Socket.SendData(buffer.Data, buffer.Head);
                                buffer.Dispose();
                                C_Types.Player[C_Variables.Myindex].EventTimer = C_General.GetTickCount() + 200;
                            }
                        }
                    }
                }
            }
示例#11
0
        internal static void DrawChatBubble(int index)
        {
            List <string> theArray = default(List <string>);
            int           x        = 0;
            int           y        = 0;
            int           i        = 0;
            int           maxWidth = 0;
            int           x2       = 0;
            int           y2       = 0;

            if (C_Variables.ChatBubble[index].TargetType == (byte)Enums.TargetType.Player)
            {
                // it's a player
                if (C_Player.GetPlayerMap((C_Variables.ChatBubble[index].Target)) == C_Player.GetPlayerMap(C_Variables.Myindex))
                {
                    // it's on our map - get co-ords
                    x = C_Graphics.ConvertMapX((C_Types.Player[C_Variables.ChatBubble[index].Target].X * 32) + C_Types.Player[C_Variables.ChatBubble[index].Target].XOffset) + 16;
                    y = C_Graphics.ConvertMapY((C_Types.Player[C_Variables.ChatBubble[index].Target].Y * 32) + C_Types.Player[C_Variables.ChatBubble[index].Target].YOffset) - 40;
                }
            }
            else if (C_Variables.ChatBubble[index].TargetType == (byte)Enums.TargetType.Npc)
            {
                // it's on our map - get co-ords
                x = C_Graphics.ConvertMapX((C_Maps.MapNpc[C_Variables.ChatBubble[index].Target].X * 32) + C_Maps.MapNpc[C_Variables.ChatBubble[index].Target].XOffset) + 16;
                y = C_Graphics.ConvertMapY((C_Maps.MapNpc[C_Variables.ChatBubble[index].Target].Y * 32) + C_Maps.MapNpc[C_Variables.ChatBubble[index].Target].YOffset) - 40;
            }
            else if (C_Variables.ChatBubble[index].TargetType == (byte)Enums.TargetType.Event)
            {
                x = C_Graphics.ConvertMapX((C_Maps.Map.MapEvents[C_Variables.ChatBubble[index].Target].X * 32) + C_Maps.Map.MapEvents[C_Variables.ChatBubble[index].Target].XOffset) + 16;
                y = C_Graphics.ConvertMapY((C_Maps.Map.MapEvents[C_Variables.ChatBubble[index].Target].Y * 32) + C_Maps.Map.MapEvents[C_Variables.ChatBubble[index].Target].YOffset) - 40;
            }
            // word wrap the text
            theArray = WordWrap(System.Convert.ToString(C_Variables.ChatBubble[index].Msg), C_Constants.ChatBubbleWidth, WrapMode.Font, WrapType.Smart, 13);
            // find max width
            for (i = 0; i <= theArray.Count - 1; i++)
            {
                if (GetTextWidth(theArray[i]) > maxWidth)
                {
                    maxWidth = GetTextWidth(theArray[i]);
                }
            }
            // calculate the new position
            x2 = x - (maxWidth / 2);
            y2 = y - (theArray.Count * 12);

            // render bubble - top left
            C_Graphics.RenderTextures(C_Graphics.ChatBubbleGfx, C_Graphics.GameWindow, x2 - 9, y2 - 5, 0, 0, 9, 5, 9, 5);
            // top right
            C_Graphics.RenderTextures(C_Graphics.ChatBubbleGfx, C_Graphics.GameWindow, x2 + maxWidth, y2 - 5, 119, 0, 9, 5, 9, 5);
            // top
            C_Graphics.RenderTextures(C_Graphics.ChatBubbleGfx, C_Graphics.GameWindow, x2, y2 - 5, 10, 0, maxWidth, 5, 5, 5);
            // bottom left
            C_Graphics.RenderTextures(C_Graphics.ChatBubbleGfx, C_Graphics.GameWindow, x2 - 9, y, 0, 19, 9, 6, 9, 6);
            // bottom right
            C_Graphics.RenderTextures(C_Graphics.ChatBubbleGfx, C_Graphics.GameWindow, x2 + maxWidth, y, 119, 19, 9, 6, 9, 6);
            // bottom - left half
            C_Graphics.RenderTextures(C_Graphics.ChatBubbleGfx, C_Graphics.GameWindow, x2, y, 10, 19, System.Convert.ToSingle((maxWidth / 2) - 5), 6, 9, 6);
            // bottom - right half
            C_Graphics.RenderTextures(C_Graphics.ChatBubbleGfx, C_Graphics.GameWindow, x2 + (maxWidth / 2) + 6, y, 10, 19, System.Convert.ToSingle((maxWidth / 2) - 5), 6, 9, 6);
            // left
            C_Graphics.RenderTextures(C_Graphics.ChatBubbleGfx, C_Graphics.GameWindow, x2 - 9, y2, 0, 6, 9, theArray.Count * 12, 9, 1);
            // right
            C_Graphics.RenderTextures(C_Graphics.ChatBubbleGfx, C_Graphics.GameWindow, x2 + maxWidth, y2, 119, 6, 9, theArray.Count * 12, 9, 1);
            // center
            C_Graphics.RenderTextures(C_Graphics.ChatBubbleGfx, C_Graphics.GameWindow, x2, y2, 9, 5, maxWidth, theArray.Count * 12, 1, 1);
            // little pointy bit
            C_Graphics.RenderTextures(C_Graphics.ChatBubbleGfx, C_Graphics.GameWindow, x - 5, y, 58, 19, 11, 11, 11, 11);

            // render each line centralised
            for (i = 0; i <= theArray.Count - 1; i++)
            {
                DrawText((int)(x - ((double)GetTextWidth(theArray[i]) / 2)), y2, theArray[i], C_Graphics.ToSfmlColor(System.Drawing.ColorTranslator.FromOle(Information.QBColor((int)(C_Variables.ChatBubble[index].Colour)))), Color.Black, C_Graphics.GameWindow);
                y2 = y2 + 12;
            }
            // check if it's timed out - close it if so
            if (C_Variables.ChatBubble[index].Timer + 5000 < C_General.GetTickCount())
            {
                C_Variables.ChatBubble[index].Active = false;
            }
        }
示例#12
0
 /// <summary>
 /// Handles Exit button press.
 /// </summary>
 public void BtnExit_Click(object sender, EventArgs e)
 {
     C_Sound.PlaySound("Click.ogg");
     C_General.DestroyGame();
 }
示例#13
0
 /// <summary>
 /// clean up and close the game.
 /// </summary>
 public void FrmMenu_Disposed(object sender, EventArgs e)
 {
     C_General.DestroyGame();
 }
示例#14
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;
                }
            }
示例#15
0
        public void FrmMainGame_Load(object sender, EventArgs e)
        {
            C_General.RePositionGui();

            FrmAdmin.Default.Visible = false;
        }
 private static void Socket_CrashReport(string err)
 {
     MessageBox.Show("There was a network error -> Report: " + err);
     DestroyNetwork();
     C_General.DestroyGame();
 }
示例#17
0
 /// <summary>
 /// Handles CreateCharacter button press.
 /// </summary>
 public void BtnCreateCharacter_Click(object sender, EventArgs e)
 {
     C_General.MenuState(C_Constants.MenuStateAddchar);
 }
示例#18
0
        public static void DrawActionMsg(int index)
        {
            int x    = 0;
            int y    = 0;
            int i    = 0;
            int time = 0;

            // how long we want each message to appear
            switch (C_Types.ActionMsg[index].Type)
            {
            case (int)Enums.ActionMsgType.Static:
                time = 1500;

                if (C_Types.ActionMsg[index].Y > 0)
                {
                    x = (int)(C_Types.ActionMsg[index].X + Conversion.Int(C_Constants.PicX / 2) - ((Microsoft.VisualBasic.Strings.Trim(C_Types.ActionMsg[index].Message).Length / 2) * 8));
                    y = C_Types.ActionMsg[index].Y - Conversion.Int(C_Constants.PicY / 2) - 2;
                }
                else
                {
                    x = (int)(C_Types.ActionMsg[index].X + Conversion.Int(C_Constants.PicX / 2) - ((Microsoft.VisualBasic.Strings.Trim(C_Types.ActionMsg[index].Message).Length / 2) * 8));
                    y = C_Types.ActionMsg[index].Y - Conversion.Int(C_Constants.PicY / 2) + 18;
                }
                break;

            case (int)Enums.ActionMsgType.Scroll:
                time = 1500;

                if (C_Types.ActionMsg[index].Y > 0)
                {
                    x = (int)(C_Types.ActionMsg[index].X + Conversion.Int(C_Constants.PicX / 2) - ((Microsoft.VisualBasic.Strings.Trim(C_Types.ActionMsg[index].Message).Length / 2) * 8));
                    y = (int)(C_Types.ActionMsg[index].Y - Conversion.Int(C_Constants.PicY / 2) - 2 - (C_Types.ActionMsg[index].Scroll * 0.6));
                    C_Types.ActionMsg[index].Scroll = C_Types.ActionMsg[index].Scroll + 1;
                }
                else
                {
                    x = (int)(C_Types.ActionMsg[index].X + Conversion.Int(C_Constants.PicX / 2) - ((Microsoft.VisualBasic.Strings.Trim(C_Types.ActionMsg[index].Message).Length / 2) * 8));
                    y = (int)(C_Types.ActionMsg[index].Y - Conversion.Int(C_Constants.PicY / 2) + 18 + (C_Types.ActionMsg[index].Scroll * 0.6));
                    C_Types.ActionMsg[index].Scroll = C_Types.ActionMsg[index].Scroll + 1;
                }
                break;

            case (int)Enums.ActionMsgType.Screen:
                time = 3000;

                // This will kill any action screen messages that there in the system
                for (i = byte.MaxValue; i >= 1; i--)
                {
                    if (C_Types.ActionMsg[i].Type == (int)Enums.ActionMsgType.Screen)
                    {
                        if (i != index)
                        {
                            C_GameLogic.ClearActionMsg((byte)index);
                            index = i;
                        }
                    }
                }
                x = (int)((FrmGame.Default.picscreen.Width / 2) - ((Microsoft.VisualBasic.Strings.Trim(C_Types.ActionMsg[index].Message).Length / 2) * 8));
                y = 425;
                break;
            }

            x = C_Graphics.ConvertMapX(x);
            y = C_Graphics.ConvertMapY(y);

            if (C_General.GetTickCount() < C_Types.ActionMsg[index].Created + time)
            {
                DrawText(x, y, C_Types.ActionMsg[index].Message, GetSfmlColor((byte)(C_Types.ActionMsg[index].Color)), Color.Black, C_Graphics.GameWindow);
            }
            else
            {
                C_GameLogic.ClearActionMsg((byte)index);
            }
        }