コード例 #1
0
        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];
コード例 #2
0
ファイル: C_Weather.cs プロジェクト: xFuRiiOuS/OrionPlusSharp
        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]);
        }
コード例 #3
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);
			}
コード例 #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);
                    }
                }
コード例 #5
0
ファイル: C_Weather.cs プロジェクト: goossin/toclone
        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];
コード例 #6
0
        internal static void DestroyGame(bool restart = false)
        {
            //SendLeaveGame()
            // break out of GameLoop
            if (restart)
            {
                RestartGame();
            }
            else
            {
                C_Variables.InGame = false;

                C_Graphics.DestroyGraphics();
                C_UpdateUI.GameDestroyed = true;
                C_NetworkConfig.DestroyNetwork();
                Application.Exit();
                ProjectData.EndApp();
            }
        }
コード例 #7
0
ファイル: C_Weather.cs プロジェクト: xFuRiiOuS/OrionPlusSharp
        internal static void DrawWeather()
        {
            int i          = 0;
            int spriteLeft = 0;

            for (i = 1; i <= MaxWeatherParticles; i++)
            {
                if (System.Convert.ToBoolean(WeatherParticle[i].InUse))
                {
                    if (WeatherParticle[i].Type == (int)Enums.WeatherType.Storm)
                    {
                        spriteLeft = 0;
                    }
                    else
                    {
                        spriteLeft = WeatherParticle[i].Type - 1;
                    }

                    C_Graphics.RenderSprite(C_Graphics.WeatherSprite, C_Graphics.GameWindow, C_Graphics.ConvertMapX(WeatherParticle[i].X), C_Graphics.ConvertMapY(WeatherParticle[i].Y), spriteLeft * 32, 0, 32, 32);
                }
            }
        }
コード例 #8
0
ファイル: C_Text.cs プロジェクト: goossin/toclone
        internal static void DrawNpcName(int mapNpcNum)
        {
            int   textX     = 0;
            int   textY     = 0;
            Color color     = new Color();
            Color backcolor = new Color();
            int   npcNum    = 0;

            npcNum = C_Maps.MapNpc[mapNpcNum].Num;

            if (Types.Npc[npcNum].Behaviour == ((byte)0))              // attack on sight
            {
                color     = SFML.Graphics.Color.Red;
                backcolor = SFML.Graphics.Color.Black;
            }             // attack when attacked + guard
            else if ((Types.Npc[npcNum].Behaviour == ((byte)1)) || (Types.Npc[npcNum].Behaviour == ((byte)4)))
            {
                color     = SFML.Graphics.Color.Green;
                backcolor = SFML.Graphics.Color.Black;
            }             // friendly + shopkeeper + quest
            else if (((Types.Npc[npcNum].Behaviour == ((byte)2)) || (Types.Npc[npcNum].Behaviour == ((byte)3))) || (Types.Npc[npcNum].Behaviour == ((byte)5)))
            {
                color     = SFML.Graphics.Color.Yellow;
                backcolor = SFML.Graphics.Color.Black;
            }

            textX = System.Convert.ToInt32(C_Graphics.ConvertMapX(C_Maps.MapNpc[mapNpcNum].X * C_Constants.PicX) + C_Maps.MapNpc[mapNpcNum].XOffset + (C_Constants.PicX / 2) - (double)GetTextWidth(Types.Npc[npcNum].Name.Trim()) / 2);
            if (Types.Npc[npcNum].Sprite <1 || Types.Npc[npcNum].Sprite> C_Graphics.NumCharacters)
            {
                textY = C_Graphics.ConvertMapY(C_Maps.MapNpc[mapNpcNum].Y * C_Constants.PicY) + C_Maps.MapNpc[mapNpcNum].YOffset - 16;
            }
            else
            {
                textY = System.Convert.ToInt32(C_Graphics.ConvertMapY(C_Maps.MapNpc[mapNpcNum].Y * C_Constants.PicY) + C_Maps.MapNpc[mapNpcNum].YOffset - ((double)C_Graphics.CharacterGfxInfo[Types.Npc[npcNum].Sprite].Height / 4) + 16);
            }

            // Draw name
            DrawText(textX, textY, Types.Npc[npcNum].Name.Trim(), color, backcolor, C_Graphics.GameWindow);
        }
コード例 #9
0
ファイル: C_Text.cs プロジェクト: goossin/toclone
        internal static void DrawEventName(int index)
        {
            int    textX     = 0;
            int    textY     = 0;
            Color  color     = new Color();
            Color  backcolor = new Color();
            string name      = "";

            color     = SFML.Graphics.Color.Yellow;
            backcolor = SFML.Graphics.Color.Black;

            name = C_Maps.Map.MapEvents[index].Name.Trim();

            // calc pos
            textX = System.Convert.ToInt32(C_Graphics.ConvertMapX(C_Maps.Map.MapEvents[index].X * C_Constants.PicX) + C_Maps.Map.MapEvents[index].XOffset + (C_Constants.PicX / 2) - GetTextWidth(name.Trim()) / 2);
            if (C_Maps.Map.MapEvents[index].GraphicType == 0)
            {
                textY = C_Graphics.ConvertMapY(C_Maps.Map.MapEvents[index].Y * C_Constants.PicY) + C_Maps.Map.MapEvents[index].YOffset - 16;
            }
            else if (C_Maps.Map.MapEvents[index].GraphicType == 1)
            {
                if (C_Maps.Map.MapEvents[index].GraphicNum <1 || C_Maps.Map.MapEvents[index].GraphicNum> C_Graphics.NumCharacters)
                {
                    textY = C_Graphics.ConvertMapY(C_Maps.Map.MapEvents[index].Y * C_Constants.PicY) + C_Maps.Map.MapEvents[index].YOffset - 16;
                }
                else
                {
                    // Determine location for text
                    textY = System.Convert.ToInt32(C_Graphics.ConvertMapY(C_Maps.Map.MapEvents[index].Y * C_Constants.PicY) + C_Maps.Map.MapEvents[index].YOffset - (C_Graphics.CharacterGfxInfo[C_Maps.Map.MapEvents[index].GraphicNum].Height / 4) + 16);
                }
            }
            else if (C_Maps.Map.MapEvents[index].GraphicType == 2)
            {
                if (C_Maps.Map.MapEvents[index].GraphicY2 > 0)
                {
                    textX = textX + (C_Maps.Map.MapEvents[index].GraphicY2 * C_Constants.PicY) / 2 - 16;
                    textY = C_Graphics.ConvertMapY(C_Maps.Map.MapEvents[index].Y * C_Constants.PicY) + C_Maps.Map.MapEvents[index].YOffset - (C_Maps.Map.MapEvents[index].GraphicY2 * C_Constants.PicY) + 16;
                }
                else
                {
                    textY = C_Graphics.ConvertMapY(C_Maps.Map.MapEvents[index].Y * C_Constants.PicY) + C_Maps.Map.MapEvents[index].YOffset - 32 + 16;
                }
            }

            // Draw name
            DrawText(textX, textY, name.Trim(), color, backcolor, C_Graphics.GameWindow);

            //For i = 1 To MaxQuests
            //    'check if the npc is the starter to any quest: [!] symbol
            //    'can accept the quest as a new one
            //    If Player(MyIndex).PlayerQuest(i).Status = QuestStatusType.NotStarted OrElse Player(MyIndex).PlayerQuest(i).Status = QuestStatusType.Repeatable OrElse (Player(MyIndex).PlayerQuest(i).Status = QuestStatusType.Completed AndAlso Quest(i).Repeat = 1) Then
            //        'the npc gives this quest
            //        If Map.MapEvents(Index).questnum = i Then
            //            Name = "[!]"
            //            TextX = ConvertMapX(Map.MapEvents(Index).X * PicX) + Map.MapEvents(Index).XOffset + (PicX \ 2) - GetTextWidth((Trim$("[!]"))) + 8
            //            TextY = TextY - 16
            //            If Quest(i).Repeat = 1 Then
            //                DrawText(TextX, TextY, Trim$(Name), Color.White, backcolor, GameWindow)
            //            Else
            //                DrawText(TextX, TextY, Trim$(Name), color, backcolor, GameWindow)
            //            End If
            //            Exit For
            //        End If
            //    ElseIf Player(MyIndex).PlayerQuest(i).Status = QuestStatusType.Started Then
            //        If Map.MapEvents(Index).questnum = i Then
            //            Name = "[*]"
            //            TextX = ConvertMapX(Map.MapEvents(Index).X * PicX) + Map.MapEvents(Index).XOffset + (PicX \ 2) - GetTextWidth((Trim$("[*]"))) + 8
            //            TextY = TextY - 16
            //            DrawText(TextX, TextY, Trim$(Name), color, backcolor, GameWindow)
            //            Exit For
            //        End If
            //    End If
            //Next
        }
コード例 #10
0
        public static void UpdateUi()
        {
            if (ReloadFrmMain == true)
            {
                ReloadFrmMain = false;
            }

            if (C_Variables.UpdateNews == true)
            {
                FrmMenu.Default.lblNews.Text = C_Variables.News;
                FrmMenu.Default.Text         = C_Constants.GameName;
                FrmGame.Default.Text         = C_Constants.GameName;
                C_Variables.UpdateNews       = false;
            }

            if (PnlRegisterVisible != FrmMenu.Default.pnlRegister.Visible)
            {
                FrmMenu.Default.pnlRegister.Visible = PnlRegisterVisible;
                FrmMenu.Default.pnlRegister.BringToFront();
            }

            if (DrawChar == true)
            {
                FrmMenu.Default.DrawCharacter();
                DrawChar = false;
            }

            if (PnlCharCreateVisible != FrmMenu.Default.pnlNewChar.Visible)
            {
                FrmMenu.Default.pnlNewChar.Visible = PnlCharCreateVisible;
                FrmMenu.Default.pnlNewChar.BringToFront();
                DrawChar = true;
            }

            if (Lblnextcharleft != FrmMenu.Default.lblNextChar.Left)
            {
                FrmMenu.Default.lblNextChar.Left = Lblnextcharleft;
            }

            if (!ReferenceEquals(Cmbclass, null))
            {
                FrmMenu.Default.cmbClass.Items.Clear();

                for (var i = 1; i <= (Cmbclass.Length - 1); i++)
                {
                    FrmMenu.Default.cmbClass.Items.Add(Cmbclass[(int)i]);
                }

                FrmMenu.Default.cmbClass.SelectedIndex = 0;

                FrmMenu.Default.rdoMale.Checked = true;

                FrmMenu.Default.txtCharName.Focus();

                Cmbclass = null;
            }

            if (PnlLoginVisible != FrmMenu.Default.pnlLogin.Visible)
            {
                FrmMenu.Default.pnlLogin.Visible = PnlLoginVisible;
                if (PnlLoginVisible)
                {
                    FrmMenu.Default.txtLogin.Focus();
                }
            }

            if (PnlCreditsVisible != FrmMenu.Default.pnlCredits.Visible)
            {
                FrmMenu.Default.pnlCredits.Visible = PnlCreditsVisible;
            }

            if (Frmmenuvisible != FrmMenu.Default.Visible)
            {
                FrmMenu.Default.Visible = Frmmenuvisible;
            }

            if (DrawCharSelect)
            {
                FrmMenu.Default.DrawCharacterSelect();
                DrawCharSelect = false;
            }

            if (PnlCharSelectVisible != FrmMenu.Default.pnlCharSelect.Visible)
            {
                FrmMenu.Default.pnlCharSelect.Visible = PnlCharSelectVisible;
                if (PnlCharSelectVisible)
                {
                    DrawCharSelect = true;
                }
            }

            if (Frmmaingamevisible != FrmGame.Default.Visible)
            {
                FrmGame.Default.Visible = Frmmaingamevisible;
            }

            if (C_Crafting.InitCrafting == true)
            {
                C_Crafting.CraftingInit();
                C_Crafting.InitCrafting = false;
            }

            if (NeedToOpenShop == true)
            {
                C_GameLogic.OpenShop(NeedToOpenShopNum);
                NeedToOpenShop    = false;
                NeedToOpenShopNum = 0;
                PnlShopVisible    = true;
            }

            if (NeedToOpenBank == true)
            {
                C_Banks.InBank = System.Convert.ToInt32(true);
                PnlBankVisible = true;
                C_Banks.DrawBank();
                NeedToOpenBank = false;
            }

            if (NeedToOpenTrade == true)
            {
                C_Trade.InTrade = true;
                PnlTradeVisible = true;

                NeedToOpenTrade = false;
            }

            if (NeedtoCloseTrade == true)
            {
                C_Trade.InTrade = false;
                PnlTradeVisible = false;

                NeedtoCloseTrade = false;
            }

            if (NeedtoUpdateTrade == true)
            {
                C_Trade.DrawTrade();
                NeedtoUpdateTrade = false;
            }

            if (UpdateCharacterPanel == true)
            {
                UpdateCharacterPanel = false;
            }

            if (Pnlloadvisible != FrmMenu.Default.pnlLoad.Visible)
            {
                FrmMenu.Default.pnlLoad.Visible = Pnlloadvisible;
            }

            if (UpdateMapnames == true)
            {
                int x = 0;

                FrmAdmin.Default.lstMaps.Items.Clear();

                for (x = 1; x <= Constants.MAX_MAPS; x++)
                {
                    FrmAdmin.Default.lstMaps.Items.Add(x.ToString());
                    FrmAdmin.Default.lstMaps.Items[x - 1].SubItems.Add(C_Types.MapNames[x]);
                }

                UpdateMapnames = false;
            }

            if (Adminvisible == true)
            {
                FrmAdmin.Default.Visible = !FrmAdmin.Default.Visible;
                Adminvisible             = false;
            }

            if (C_Quest.UpdateQuestChat == true)
            {
                C_Variables.DialogMsg1 = "Quest: " + Microsoft.VisualBasic.Strings.Trim(C_Quest.Quest[C_Quest.QuestNum].Name);
                C_Variables.DialogMsg2 = C_Quest.QuestMessage;

                C_Variables.DialogType = C_Constants.DialogueTypeQuest;

                if (C_Quest.QuestNumForStart > 0 && C_Quest.QuestNumForStart <= C_Quest.MaxQuests)
                {
                    C_Quest.QuestAcceptTag = C_Quest.QuestNumForStart;
                }

                C_Variables.UpdateDialog = true;

                C_Quest.UpdateQuestChat = false;
            }

            if (C_Quest.UpdateQuestWindow == true)
            {
                C_Quest.LoadQuestlogBox();
                C_Quest.UpdateQuestWindow = false;
            }

            if (C_Variables.UpdateDialog == true)
            {
                if (C_Variables.DialogType == C_Constants.DialogueTypeBuyhome || C_Variables.DialogType == C_Constants.DialogueTypeVisit)                 //house offer & visit
                {
                    C_Variables.DialogButton1Text = "Accept";
                    C_Variables.DialogButton2Text = "Decline";
                    DialogPanelVisible            = true;
                }
                else if (C_Variables.DialogType == C_Constants.DialogueTypeParty || C_Variables.DialogType == C_Constants.DialogueTypeTrade)
                {
                    C_Variables.DialogButton1Text = "Accept";
                    C_Variables.DialogButton2Text = "Decline";
                    DialogPanelVisible            = true;
                }
                else if (C_Variables.DialogType == C_Constants.DialogueTypeQuest)
                {
                    C_Variables.DialogButton1Text = "Accept";
                    C_Variables.DialogButton2Text = "Ok";
                    if (C_Quest.QuestAcceptTag > 0)
                    {
                        C_Variables.DialogButton2Text = "Decline";
                    }
                    DialogPanelVisible = true;
                }

                C_Variables.UpdateDialog = false;
            }

            if (C_EventSystem.EventChat == true)
            {
                PnlEventChatVisible     = true;
                C_EventSystem.EventChat = false;
            }

            if (C_Variables.ShowRClick == true)
            {
                RClickname       = C_Types.Player[C_Variables.MyTarget].Name;
                RClickX          = C_Graphics.ConvertMapX(C_Variables.CurX * C_Constants.PicX);
                RClickY          = C_Graphics.ConvertMapY(C_Variables.CurY * C_Constants.PicY);
                PnlRClickVisible = true;

                C_Variables.ShowRClick = false;
            }

            if (InitMapEditor == true)
            {
                FrmEditor_MapEditor.Default.MapEditorInit();
                InitMapEditor = false;
            }

            if (InitMapProperties == true)
            {
                FrmEditor_MapEditor.Default.MapPropertiesInit();
                InitMapProperties = false;
            }

            if (C_EventSystem.InitEventEditorForm == true)
            {
                FrmEditor_Events.Default.InitEventEditorForm();

                // populate form
                // set the tabs
                if (FrmEditor_Events.Default.tabPages != null && FrmEditor_Events.Default.tabPages.TabPages != null)
                {
                    FrmEditor_Events.Default.tabPages.TabPages.Clear();

                    for (var i = 1; i <= C_EventSystem.TmpEvent.PageCount; i++)
                    {
                        FrmEditor_Events.Default.tabPages.TabPages.Add(Conversion.Str(i));
                    }
                    // items
                    FrmEditor_Events.Default.cmbHasItem.Items.Clear();
                    FrmEditor_Events.Default.cmbHasItem.Items.Add("None");
                    for (var i = 1; i <= Constants.MAX_ITEMS; i++)
                    {
                        FrmEditor_Events.Default.cmbHasItem.Items.Add(i + ": " + Microsoft.VisualBasic.Strings.Trim(Types.Item[(int)i].Name));
                    }
                    // variables
                    FrmEditor_Events.Default.cmbPlayerVar.Items.Clear();
                    FrmEditor_Events.Default.cmbPlayerVar.Items.Add("None");
                    for (var i = 1; i <= C_EventSystem.MaxVariables; i++)
                    {
                        FrmEditor_Events.Default.cmbPlayerVar.Items.Add(i + ". " + C_EventSystem.Variables[(int)i]);
                    }
                    // variables
                    FrmEditor_Events.Default.cmbPlayerSwitch.Items.Clear();
                    FrmEditor_Events.Default.cmbPlayerSwitch.Items.Add("None");
                    for (var i = 1; i <= C_EventSystem.MaxSwitches; i++)
                    {
                        FrmEditor_Events.Default.cmbPlayerSwitch.Items.Add(i + ". " + C_EventSystem.Switches[(int)i]);
                    }
                    // name
                    FrmEditor_Events.Default.txtName.Text = C_EventSystem.TmpEvent.Name;
                    // enable delete button
                    if (C_EventSystem.TmpEvent.PageCount > 1)
                    {
                        FrmEditor_Events.Default.btnDeletePage.Enabled = true;
                    }
                    else
                    {
                        FrmEditor_Events.Default.btnDeletePage.Enabled = false;
                    }
                    FrmEditor_Events.Default.btnPastePage.Enabled = false;
                    // Load page 1 to start off with
                    C_EventSystem.CurPageNum = 1;
                    C_EventSystem.EventEditorLoadPage(C_EventSystem.CurPageNum);

                    FrmEditor_Events.Default.nudShowTextFace.Maximum    = C_Graphics.NumFaces;
                    FrmEditor_Events.Default.nudShowChoicesFace.Maximum = C_Graphics.NumFaces;
                    // show the editor
                    FrmEditor_Events.Default.Show();

                    C_EventSystem.InitEventEditorForm = false;
                }
            }

            if (OptionsVisible == true)
            {
                // show in GUI
                if (C_Types.Options.Music == 1)
                {
                    FrmOptions.Default.optMOn.Checked = true;
                }
                else
                {
                    FrmOptions.Default.optMOff.Checked = true;
                }

                if (C_Types.Options.Music == 1)
                {
                    FrmOptions.Default.optSOn.Checked = true;
                }
                else
                {
                    FrmOptions.Default.optSOff.Checked = true;
                }

                FrmOptions.Default.lblVolume.Text   = "Volume: " + System.Convert.ToString(C_Types.Options.Volume);
                FrmOptions.Default.scrlVolume.Value = (int)C_Types.Options.Volume;

                FrmOptions.Default.cmbScreenSize.SelectedIndex = C_Types.Options.ScreenSize;

                if (C_Types.Options.VSync == 1)
                {
                    FrmOptions.Default.chkVSync.Checked = true;
                }
                else
                {
                    FrmOptions.Default.chkVSync.Checked = false;
                }

                if (C_Types.Options.UnlockFPS == 1)
                {
                    FrmOptions.Default.checkBox1.Checked = true;
                }
                else
                {
                    FrmOptions.Default.checkBox1.Checked = false;
                }

                if (C_Types.Options.ShowNpcBar == 1)
                {
                    FrmOptions.Default.chkNpcBars.Checked = true;
                }
                else
                {
                    FrmOptions.Default.chkNpcBars.Checked = false;
                }

                FrmOptions.Default.Visible = true;
                OptionsVisible             = false;
            }
        }
コード例 #11
0
        internal static void DrawQuestLog()
        {
            int i = 0;
            int y = 0;

            y = 10;

            //first render panel
            C_Graphics.RenderSprite(C_Graphics.QuestSprite, C_Graphics.GameWindow, QuestLogX, QuestLogY, 0, 0, C_Graphics.QuestGfxInfo.Width, C_Graphics.QuestGfxInfo.Height);

            //draw quest names
            for (i = 1; i <= MaxActivequests; i++)
            {
                if (QuestNames[i].Trim().Length > 0)
                {
                    C_Text.DrawText(QuestLogX + 7, QuestLogY + y, QuestNames[i].Trim(), SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow);
                    y = y + 20;
                }
            }

            if (SelectedQuest <= 0)
            {
                return;
            }

            //quest log text
            y = 0;
            foreach (string str in C_Text.WordWrap(QuestTaskLogText.Trim(), 35, C_Text.WrapMode.Characters, C_Text.WrapType.BreakWord, 13))
            {
                //description
                C_Text.DrawText(QuestLogX + 204, QuestLogY + 30 + y, str, SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow);
                y = y + 15;
            }

            y = 0;
            foreach (string str in C_Text.WordWrap(ActualTaskText.Trim(), 40, C_Text.WrapMode.Characters, C_Text.WrapType.BreakWord, 13))
            {
                //description
                C_Text.DrawText(QuestLogX + 204, QuestLogY + 147 + y, str, SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow);
                y = y + 15;
            }

            y = 0;
            foreach (string str in C_Text.WordWrap(QuestDialogText.Trim(), 40, C_Text.WrapMode.Characters, C_Text.WrapType.BreakWord, 13))
            {
                //description
                C_Text.DrawText(QuestLogX + 204, QuestLogY + 218 + y, str, SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow);
                y = y + 15;
            }
            C_Text.DrawText(QuestLogX + 280, QuestLogY + 263, QuestStatus2Text.Trim(), SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow);

            //DrawText(QuestLogX + 285, QuestLogY + 288, Trim$(QuestRequirementsText), SFML.Graphics.Color.White, SFML.Graphics.Color.Black, GameWindow)

            y = 0;
            for (i = 1; i <= QuestRewardsText.Length - 1; i++)
            {
                //description
                C_Text.DrawText(QuestLogX + 255, QuestLogY + 292 + y, QuestRewardsText[i].Trim(), SFML.Graphics.Color.White, SFML.Graphics.Color.Black, C_Graphics.GameWindow);
                y = y + 15;
            }
        }
コード例 #12
0
ファイル: C_Banks.cs プロジェクト: xFuRiiOuS/OrionPlusSharp
        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);
                    }
                }
            }
コード例 #13
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);
            }
        }
コード例 #14
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);
                        }
                    }
                }
            }
コード例 #15
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;
            }
        }
コード例 #16
0
ファイル: C_Text.cs プロジェクト: goossin/toclone
        internal static void DrawPlayerName(int index)
        {
            int    textX     = 0;
            int    textY     = 0;
            Color  color     = new Color();
            Color  backcolor = new Color();
            string name      = "";

            // Check access level
            if (C_Player.GetPlayerPk(index) == 0)
            {
                switch (C_Player.GetPlayerAccess(index))
                {
                case (int)Enums.AdminType.Player:
                    color     = SFML.Graphics.Color.Red;
                    backcolor = SFML.Graphics.Color.Black;
                    break;

                case (int)Enums.AdminType.Monitor:
                    color     = SFML.Graphics.Color.Black;
                    backcolor = SFML.Graphics.Color.White;
                    break;

                case (int)Enums.AdminType.Mapper:
                    color     = SFML.Graphics.Color.Cyan;
                    backcolor = SFML.Graphics.Color.Black;
                    break;

                case (int)Enums.AdminType.Developer:
                    color     = SFML.Graphics.Color.Green;
                    backcolor = SFML.Graphics.Color.Black;
                    break;

                case (int)Enums.AdminType.Creator:
                    color     = SFML.Graphics.Color.Yellow;
                    backcolor = SFML.Graphics.Color.Black;
                    break;
                }
            }
            else
            {
                color = SFML.Graphics.Color.Red;
            }

            name = C_Types.Player[index].Name.Trim();
            // calc pos
            textX = System.Convert.ToInt32(C_Graphics.ConvertMapX(C_Player.GetPlayerX(index) * C_Constants.PicX) + C_Types.Player[index].XOffset + (C_Constants.PicX / 2));
            textX = System.Convert.ToInt32(textX - ((double)GetTextWidth(name.Trim()) / 2));
            if (C_Player.GetPlayerSprite(index) < 1 || C_Player.GetPlayerSprite(index) > C_Graphics.NumCharacters)
            {
                textY = C_Graphics.ConvertMapY(C_Player.GetPlayerY(index) * C_Constants.PicY) + C_Types.Player[index].YOffset - 16;
            }
            else
            {
                // Determine location for text
                textY = System.Convert.ToInt32(C_Graphics.ConvertMapY(C_Player.GetPlayerY(index) * C_Constants.PicY) + C_Types.Player[index].YOffset - ((double)C_Graphics.CharacterGfxInfo[C_Player.GetPlayerSprite(index)].Height / 4) + 16);
            }

            // Draw name
            DrawText(textX, textY, name.Trim(), color, backcolor, C_Graphics.GameWindow);
        }
コード例 #17
0
ファイル: C_Text.cs プロジェクト: goossin/toclone
        public static void DrawMapAttributes()
        {
            int X  = 0;
            int y  = 0;
            int tX = 0;
            int tY = 0;

            if (ReferenceEquals(FrmEditor_MapEditor.Default.tabpages.SelectedTab, FrmEditor_MapEditor.Default.tpAttributes))
            {
                for (X = C_Variables.TileView.Left; X <= C_Variables.TileView.Right; X++)
                {
                    for (y = C_Variables.TileView.Top; y <= C_Variables.TileView.Bottom; y++)
                    {
                        if (C_Graphics.IsValidMapPoint(X, y))
                        {
                            ref var with_1 = ref C_Maps.Map.Tile[X, y];
                            tX = System.Convert.ToInt32(((C_Graphics.ConvertMapX(X * C_Constants.PicX)) - 4) + (C_Constants.PicX * 0.5));
                            tY = System.Convert.ToInt32(((C_Graphics.ConvertMapY(y * C_Constants.PicY)) - 7) + (C_Constants.PicY * 0.5));
                            if (with_1.Type == (byte)Enums.TileType.Blocked)
                            {
                                DrawText(tX, tY, "B", Color.Red, Color.Black, C_Graphics.GameWindow);
                            }
                            else if (with_1.Type == (byte)Enums.TileType.Warp)
                            {
                                DrawText(tX, tY, "W", Color.Blue, Color.Black, C_Graphics.GameWindow);
                            }
                            else if (with_1.Type == (byte)Enums.TileType.Item)
                            {
                                DrawText(tX, tY, "I", Color.White, Color.Black, C_Graphics.GameWindow);
                            }
                            else if (with_1.Type == (byte)Enums.TileType.NpcAvoid)
                            {
                                DrawText(tX, tY, "N", Color.White, Color.Black, C_Graphics.GameWindow);
                            }
                            else if (with_1.Type == (byte)Enums.TileType.Key)
                            {
                                DrawText(tX, tY, "K", Color.White, Color.Black, C_Graphics.GameWindow);
                            }
                            else if (with_1.Type == (byte)Enums.TileType.KeyOpen)
                            {
                                DrawText(tX, tY, "KO", Color.White, Color.Black, C_Graphics.GameWindow);
                            }
                            else if (with_1.Type == (byte)Enums.TileType.Resource)
                            {
                                DrawText(tX, tY, "R", Color.Green, Color.Black, C_Graphics.GameWindow);
                            }
                            else if (with_1.Type == (byte)Enums.TileType.Door)
                            {
                                DrawText(tX, tY, "D", Color.Black, Color.Red, C_Graphics.GameWindow);
                            }
                            else if (with_1.Type == (byte)Enums.TileType.NpcSpawn)
                            {
                                DrawText(tX, tY, "S", Color.Yellow, Color.Black, C_Graphics.GameWindow);
                            }
                            else if (with_1.Type == (byte)Enums.TileType.Shop)
                            {
                                DrawText(tX, tY, "SH", Color.Blue, Color.Black, C_Graphics.GameWindow);
                            }
                            else if (with_1.Type == (byte)Enums.TileType.Bank)
                            {
                                DrawText(tX, tY, "BA", Color.Blue, Color.Black, C_Graphics.GameWindow);
                            }
                            else if (with_1.Type == (byte)Enums.TileType.Heal)
                            {
                                DrawText(tX, tY, "H", Color.Green, Color.Black, C_Graphics.GameWindow);
                            }
                            else if (with_1.Type == (byte)Enums.TileType.Trap)
                            {
                                DrawText(tX, tY, "T", Color.Red, Color.Black, C_Graphics.GameWindow);
                            }
                            else if (with_1.Type == (byte)Enums.TileType.House)
                            {
                                DrawText(tX, tY, "H", Color.Green, Color.Black, C_Graphics.GameWindow);
                            }
                            else if (with_1.Type == (byte)Enums.TileType.Craft)
                            {
                                DrawText(tX, tY, "C", Color.Green, Color.Black, C_Graphics.GameWindow);
                            }
                            else if (with_1.Type == (byte)Enums.TileType.Light)
                            {
                                DrawText(tX, tY, "L", Color.Yellow, Color.Black, C_Graphics.GameWindow);
                            }
                        }
                    }
                }
            }
コード例 #18
0
        public static void Startup()
        {
            SFML.Portable.Activate();

            SetStatus(Strings.Get("loadscreen", "loading"));

            FrmMenu.Default.Visible = true;

            Application.DoEvents();

            C_Types.CharSelection = new C_Types.CharSelRec[4];

            C_Types.Player = new C_Types.PlayerRec[Constants.MAX_PLAYERS + 1];

            for (var i = 1; i <= Constants.MAX_PLAYERS; i++)
            {
                C_Player.ClearPlayer(i);
            }

            C_AutoTiles.ClearAutotiles();

            //Housing
            C_Housing.House       = new C_Housing.HouseRec[C_Housing.MaxHouses + 1];
            C_Housing.HouseConfig = new C_Housing.HouseRec[C_Housing.MaxHouses + 1];

            //quests
            C_Quest.ClearQuests();

            //npc's
            C_DataBase.ClearNpcs();
            C_Maps.Map.Npc = new int[Constants.MAX_MAP_NPCS + 1];
            C_Maps.MapNpc  = new C_Types.MapNpcRec[Constants.MAX_MAP_NPCS + 1];
            for (var i = 0; i <= Constants.MAX_MAP_NPCS; i++)
            {
                for (var x = 0; x <= (int)Enums.VitalType.Count - 1; x++)
                {
                    C_Maps.MapNpc[(int)i].Vital = new int[(int)x + 1];
                }
            }

            C_Shops.ClearShops();

            C_DataBase.ClearAnimations();

            C_DataBase.ClearAnimInstances();

            C_Banks.ClearBank();

            C_Projectiles.MapProjectiles = new C_Projectiles.MapProjectileRec[C_Projectiles.MaxProjectiles + 1];
            C_Projectiles.Projectiles    = new C_Projectiles.ProjectileRec[C_Projectiles.MaxProjectiles + 1];

            C_Items.ClearItems();

            //craft
            C_Crafting.ClearRecipes();

            //party
            C_Parties.ClearParty();

            //pets
            C_Pets.ClearPets();

            C_Variables.GettingMap = true;
            C_Variables.VbQuote    = System.Convert.ToString((char)34);           // "

            // Update the form with the game's name before it's loaded
            FrmGame.Default.Text = C_Constants.GameName;

            SetStatus(Strings.Get("loadscreen", "options"));

            // load options
            if (File.Exists(Application.StartupPath + "\\Data\\Config.xml"))
            {
                C_DataBase.LoadOptions();
            }
            else
            {
                C_DataBase.CreateOptions();
            }

            // randomize rnd's seed
            VBMath.Randomize();

            SetStatus(Strings.Get("loadscreen", "network"));

            FrmMenu.Default.Text = C_Constants.GameName;

            // DX7 Master Object is already created, early binding
            SetStatus(Strings.Get("loadscreen", "graphics"));
            C_Maps.CheckTilesets();
            C_DataBase.CheckCharacters();
            C_DataBase.CheckPaperdolls();
            C_DataBase.CheckAnimations();
            C_Items.CheckItems();
            C_Resources.CheckResources();
            C_DataBase.CheckSkillIcons();
            C_DataBase.CheckFaces();
            C_DataBase.CheckFog();
            C_DataBase.CacheMusic();
            C_DataBase.CacheSound();
            C_DataBase.CheckEmotes();
            C_DataBase.CheckPanoramas();
            C_Housing.CheckFurniture();
            C_Projectiles.CheckProjectiles();
            C_DataBase.CheckParallax();

            C_Graphics.InitGraphics();

            // check if we have main-menu music
            if (C_Types.Options.Music == 1 && C_Types.Options.MenuMusic.Trim().Length > 0)
            {
                C_Sound.PlayMusic(C_Types.Options.MenuMusic.Trim());
                C_Sound.MusicPlayer.Volume = 100;
            }

            // Reset values
            C_Variables.Ping = -1;

            // set values for directional blocking arrows
            C_Variables.DirArrowX[1] = 12;             // up
            C_Variables.DirArrowY[1] = 0;

            C_Variables.DirArrowX[2] = 12;             // down
            C_Variables.DirArrowY[2] = 23;

            C_Variables.DirArrowX[3] = 0;             // left
            C_Variables.DirArrowY[3] = 12;

            C_Variables.DirArrowX[4] = 23;             // right
            C_Variables.DirArrowY[4] = 12;

            //set gui switches
            C_UpdateUI.HudVisible = true;

            SetStatus(Strings.Get("loadscreen", "starting"));
            Started = true;
            C_UpdateUI.Frmmenuvisible = true;
            C_UpdateUI.Pnlloadvisible = false;

            //C_UpdateUI.PnlInventoryVisible = true;

            C_NetworkConfig.InitNetwork();

            C_GameLogic.GameLoop();
        }
コード例 #19
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;
                }
            }