コード例 #1
0
        public void update()
        {
            VillageMap village = GameEngine.Instance.Village;

            if (village != null)
            {
                if (GameEngine.Instance.World.isRegionCapital(village.VillageID))
                {
                    this.stockpileHeaderLabel.Text = SK.Text("ResourcesPanel_Parish_Resources", "Parish Resources");
                }
                else if (GameEngine.Instance.World.isCountyCapital(village.VillageID))
                {
                    this.stockpileHeaderLabel.Text = SK.Text("ResourcesPanel_County_Resources", "County Resources");
                }
                else if (GameEngine.Instance.World.isProvinceCapital(village.VillageID))
                {
                    this.stockpileHeaderLabel.Text = SK.Text("ResourcesPanel_Province_Resources", "Province Resources");
                }
                else if (GameEngine.Instance.World.isCountryCapital(village.VillageID))
                {
                    this.stockpileHeaderLabel.Text = SK.Text("ResourcesPanel_Country_Resources", "Country Resources");
                }
                NumberFormatInfo           nFI    = GameEngine.NFI;
                VillageMap.StockpileLevels levels = new VillageMap.StockpileLevels();
                village.getStockpileLevels(levels);
                this.woodLabel.Text  = SK.Text("ResourceTypeWood", "Wood") + ": " + levels.woodLevel.ToString("N", nFI);
                this.stoneLabel.Text = SK.Text("ResourceType_Stone", "Stone") + ": " + levels.stoneLevel.ToString("N", nFI);
                this.pitchLabel.Text = SK.Text("ResourceType_Pitch", "Pitch") + ": " + levels.pitchLevel.ToString("N", nFI);
                this.ironLabel.Text  = SK.Text("ResourceType_Iron", "Iron") + ": " + levels.ironLevel.ToString("N", nFI);
            }
        }
コード例 #2
0
        private void btnHelp_Click(bool sfx)
        {
            if (sfx)
            {
                GameEngine.Instance.playInterfaceSound("WorldMapScreen_menu_help");
            }
            MenuPopup popup = new MenuPopup();
            Point     point = base.csd.PointToScreen(this.btnHelpMenu.Position);

            popup.setPosition(point.X, point.Y + 0x18);
            popup.setCallBack(new MenuPopup.MenuCallback(this.menu1Callback));
            popup.addMenuItem(SK.Text("MENU_SHK_Help", "Stronghold Kingdoms Help"), 0x6c);
            popup.addMenuItem(SK.Text("MENU_Game_Rules", "Game Rules"), 0x6d);
            if (Program.mySettings.LanguageIdent == "en")
            {
                popup.addMenuItem("Terms & Conditions", 0x97);
            }
            else
            {
                popup.addMenuItem(SK.Text("MENU_TandC", "Terms & Conditions").Replace("&", "&&"), 0x97);
            }
            popup.addMenuItem(SK.Text("MENU_Privacy", "Privacy Policy"), 0x98);
            popup.addMenuItem(SK.Text("MENU_Forum", "Forum"), 0x6b);
            popup.addBar();
            popup.addMenuItem(SK.Text("MENU_Show_Admin_Message", "Show Admin Message"), 0x67);
            popup.addBar();
            if (GameEngine.Instance.World.isTutorialResumable())
            {
                popup.addMenuItem(SK.Text("Options_Resume_Tutorial", "Resume Tutorial"), 0x455);
            }
            popup.addMenuItem(SK.Text("Options_Player_Guide", "Player Guide"), 0x4b1);
            popup.addBar();
            popup.addMenuItem(SK.Text("MENU_About_Stronghold Kingdoms", "About Stronghold Kingdoms"), 0x66);
            popup.showMenu();
        }
コード例 #3
0
 public static void VillageRenameCallback(VillageRename_ReturnType returnData)
 {
     if (returnData.Success)
     {
         if (returnData.abandoned)
         {
             GameEngine.Instance.World.newPlayer              = false;
             GameEngine.Instance.World.lastAttacker           = RemoteServices.Instance.UserName;
             GameEngine.Instance.World.lastAttackerLastUpdate = DateTime.Now;
             GameEngine.Instance.flushVillages();
             GameEngine.Instance.forceFullTick();
         }
     }
     else
     {
         if (returnData.m_errorCode == ErrorCodes.ErrorCode.ABANDONED_TOO_SOON)
         {
             MyMessageBox.Show(SK.Text("MENU_Abandon_Once_Week", "You can only abandon your village once a week"), SK.Text("MENU_Abandon_Village_Error", "Abandon Village Error"));
         }
         if (returnData.m_errorCode == ErrorCodes.ErrorCode.CANT_ABANDON_WITH_INCOMING_ATTACKS)
         {
             MyMessageBox.Show(SK.Text("MENU_Abandon_Incoming", "You cannot abandon your village while you have incoming attacks"), SK.Text("MENU_Abandon_Village_Error", "Abandon Village Error"));
         }
     }
 }
コード例 #4
0
 public MailAbuseSubmissionForm()
 {
     this.dockableControl = new DockableControl(this);
     this.InitializeComponent();
     this.Font = FontManager.GetFont("Microsoft Sans Serif", 8.25f, FontStyle.Regular);
     this.lblTextTitle.Font     = FontManager.GetFont("Microsoft Sans Serif", 9f, FontStyle.Bold);
     this.lblTitle.Font         = FontManager.GetFont("Microsoft Sans Serif", 12f, FontStyle.Bold);
     this.lblAdvice.Font        = FontManager.GetFont("Microsoft Sans Serif", 8.25f, FontStyle.Regular);
     this.btnClose.Text         = SK.Text("GENERIC_Close", "Close");
     this.btnReport.Text        = SK.Text("REPORT_ABUSE_Title", "Report Mail");
     this.lblTitle.Text         = SK.Text("REPORT_ABUSE_Title", "Report Mail");
     this.lblAdvice.Text        = SK.Text("REPORT_ABUSE_Advice", "If you believe that the contents of this mail need to be investigated by the game administration, you may report it using this form. Please select a reason for doing so from the choices listed below, and provide a summary as to why you feel investigation is required. Please note that being attacked through game mechanics is not a valid reason for reporting, and use of this system for inappropriate reasons will not be tolerated.");
     this.lblReason.Text        = SK.Text("REPORT_ABUSE_SelectReason", "Reason for reporting:");
     this.lblTextTitle.Text     = SK.Text("REPORT_ABUSE_SummaryTitle", "Summary of the issue (minimum 50 characters):");
     this.lblBlockReminder.Text = SK.Text("REPORT_ABUSE_BlockReminder", "Please note that, on sending the report, the user in question will automatically be added to your 'Blocked Users' list");
     this.cbReason.Items.Add(SK.Text("REPORT_ABUSE_PleaseSelect", "Please select"));
     this.cbReason.Items.Add(SK.Text("REPORT_ABUSE_Inappropriate", "Inappropriate Conduct"));
     this.cbReason.Items.Add(SK.Text("REPORT_ABUSE_Personal", "Threats outside the game"));
     this.cbReason.Items.Add(SK.Text("REPORT_ABUSE_Spam", "Advertisements or Links"));
     this.cbReason.Items.Add(SK.Text("REPORT_ABUSE_Scam", "Scam or Phishing Attempt"));
     this.cbReason.Items.Add(SK.Text("REPORT_ABUSE_Proclamation", "Offensive Proclamation"));
     this.cbReason.SelectedIndex = 0;
     this.btnReport.Enabled      = false;
     this.cbReason.DropDownStyle = ComboBoxStyle.DropDownList;
 }
コード例 #5
0
ファイル: App.cs プロジェクト: studentutu/StereoKit
    //////////////////////

    public void Init()
    {
        Material floorMat = new Material(Shader.FromFile("floor_shader.hlsl"));

        floorMat.Transparency = Transparency.Blend;
        floorMat.SetVector("radius", new Vec4(5, 10, 0, 0));
        floorMat.QueueOffset = -11;

        floorMesh = Model.FromMesh(Mesh.GeneratePlane(new Vec2(40, 40), Vec3.Up, Vec3.Forward), floorMat);
        floorTr   = Matrix.TR(new Vec3(0, -1.5f, 0), Quat.Identity);

        demoSelectPose.position    = new Vec3(0, 0, -0.6f);
        demoSelectPose.orientation = Quat.LookDir(-Vec3.Forward);

        Tests.FindTests();
        Tests.SetTestActive(startTest);
        Tests.Initialize();
        for (int i = 0; i < Tests.DemoCount; i++)
        {
            demoNames.Add(Tests.GetDemoName(i).Substring("Demo".Length));
        }

        if (!Tests.IsTesting)
        {
            SK.AddStepper(new RenderCamera(new Pose(0.3f, 0, .5f, Quat.FromAngles(0, -90, 0)), 1000, 1000));
        }
    }
コード例 #6
0
 public void open(bool forceDock, bool forceFloat, int areaType, int areaID)
 {
     if (this.chatBanned)
     {
         MyMessageBox.Show(SK.Text("ChatScreenManager_Ban_Message_Chat", "Your chat privileges have been suspended for violations of the game rules or code of conduct.") + Environment.NewLine + URLs.IPSharingPage, SK.Text("GENERIC_Chat_Banned", "Chat Privileges Ban"));
     }
     else
     {
         if (forceDock)
         {
             this.docked = true;
         }
         if (forceFloat)
         {
             this.docked = false;
         }
         this.close(true, false);
         if (this.initScreen)
         {
             this.chatScreen.initProperties(true, "Chat", this);
             this.chatScreen.init(this);
         }
         RemoteServices.Instance.Chat_StartReceiving();
         this.chatScreen.openFresh(areaType, areaID);
         this.chatScreen.display(true, this, this.lastFloatX, this.lastFloatY);
         this.chatScreen.openUpdate();
         this.initScreen = false;
     }
 }
コード例 #7
0
    ///////////////////////////////////////////

    static void Main(string[] args)
    {
        // Initialize the StereoKit application
        SKSettings settings = new SKSettings
        {
            appName      = "StereoKit_BingMaps",
            assetsFolder = "Assets",
        };

        if (!SK.Initialize(settings))
        {
            Environment.Exit(1);
        }

        Initialize();

        while (SK.Step(() =>
        {
            // If we're in AR, we don't initialize floorMesh, hence the '?'
            // operator! The real world should already have a floor :)
            floorMesh?.Draw(floorMat, Matrix.T(0, -1.5f, 0));

            // Draw the terrain widget!
            ShowTerrainWidget();
        }))
        {
            ;
        }

        SK.Shutdown();
    }
コード例 #8
0
 public static void showVacationMode()
 {
     if (GameEngine.Instance.World.NumVacationsAvailable > 0)
     {
         if (GameEngine.Instance.World.isAccount730Premium())
         {
             if ((popup == null) || !popup.Created)
             {
                 popup = new CreateVacationWindow();
             }
             popup.init();
             Form parentForm = InterfaceMgr.Instance.ParentForm;
             popup.Location = new Point((parentForm.Location.X + (parentForm.Width / 2)) - (popup.Width / 2), (parentForm.Location.Y + (parentForm.Height / 2)) - (popup.Height / 2));
             popup.Show(InterfaceMgr.Instance.ParentForm);
         }
         else
         {
             MyMessageBox.setForcedForm(InterfaceMgr.Instance.ParentForm);
             MyMessageBox.Show(SK.Text("VM_Not_Premium", "Vacation Mode requires you to have a 7 day or 30 day Premium Token active."), SK.Text("VM_Error", "Vacation Error"));
         }
     }
     else if (GameEngine.Instance.World.VacationNot30Days)
     {
         MyMessageBox.setForcedForm(InterfaceMgr.Instance.ParentForm);
         MyMessageBox.Show(SK.Text("VM_None_Available_30Days", "Vacation Mode is not available to you at this time. Your account must be at least 30 days old to be able to access Vacation Mode."), SK.Text("VM_Error", "Vacation Error"));
     }
     else
     {
         MyMessageBox.setForcedForm(InterfaceMgr.Instance.ParentForm);
         MyMessageBox.Show(SK.Text("VM_None_Available", "You have no Vacations Available at the current time."), SK.Text("VM_Error", "Vacation Error"));
     }
 }
コード例 #9
0
        private void button1_Click(object sender, EventArgs e) //By pressing the lighting button
        {
            try
            {
                //read the coordinates of the position of the light
                LightDirection[0] = (float)Convert.ToDecimal(textBox1.Text);
                LightDirection[1] = (float)Convert.ToDecimal(textBox2.Text);
                LightDirection[2] = (float)Convert.ToDecimal(textBox3.Text);


                Gl.glLightfv(Gl.GL_LIGHT0, Gl.GL_POSITION, LightDirection); //change the position lighting coordinates
                display();
                SK.Select();                                                //select (focus) this SimpleOpenGL form to be able to use the keyboard
            }
            catch (FormatException)
            {
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                DialogResult      result;

                result = MessageBox.Show("Please enter lighting coordinates as numbers!", "No numbers entered!", buttons);

                if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    this.Close();
                }
                SK.Select(); //select (focus) this SimpleOpenGL form to be able to use the keyboard
            }
        }
コード例 #10
0
ファイル: Mastermind.cs プロジェクト: Epidra/GameCenter
        public override void Draw2()
        {
            //spriteBatch.Draw(SK.texture_background_mastermind1, SK.Position_DisplayEdge() + SK.Position_Mastermind1(), Color.White);

            for (int i = 0; i < 6; i++)
            {
                int y = 0;
                if (lamp[i] == "green")
                {
                    y = 3;
                }
                if (lamp[i] == "yellow")
                {
                    y = 2;
                }
                if (lamp[i] == "red")
                {
                    y = 1;
                }
                spriteBatch.Draw(SK.texture_spritesheet_lamps, SK.Position_DisplayEdge() + new Vector2(SK.Position_Mastermind_Lamps().X + 71 * i, SK.Position_Mastermind_Lamps().Y), new Rectangle(0, 64 * y, 64, 64), Color.White, 0, new Vector2(0, 0), 1, SpriteEffects.None, 0);

                spriteBatch.Draw(SK.texture_casino_bet_up, SK.Position_DisplayEdge() + new Vector2(SK.Position_Mastermind_Lamps().X + 71 * i - 45, SK.Position_Mastermind_Lamps().Y + 350), null, selector == new Vector2(i, 0) ? Color.Gold : Color.White, 0, new Vector2(0, 0), 1, SpriteEffects.None, 0);
                spriteBatch.Draw(SK.texture_spritesheet_minos_64x, SK.Position_DisplayEdge() + new Vector2(SK.Position_Mastermind_Lamps().X + 71 * i, SK.Position_Mastermind_Lamps().Y + 400), Get_Mino_Texture(slot[i], "middle"), Color.White, 0, new Vector2(0, 0), 1, SpriteEffects.None, 0);
                spriteBatch.Draw(SK.texture_casino_bet_down, SK.Position_DisplayEdge() + new Vector2(SK.Position_Mastermind_Lamps().X + 71 * i - 45, SK.Position_Mastermind_Lamps().Y + 470), null, selector == new Vector2(i, 1) ? Color.Gold : Color.White, 0, new Vector2(0, 0), 1, SpriteEffects.None, 0);

                //spriteBatch.Draw(SK.texture_spritesheet_minos_64x, new Vector2(429 + 138 * i, 303), Get_Mino_Texture(slot[i], "upper"), Color.White, 0, new Vector2(0, 0), 2, SpriteEffects.None, 0);
                //spriteBatch.Draw(SK.texture_spritesheet_minos_64x, new Vector2(429 + 138 * i, 439), Get_Mino_Texture(slot[i], "lower"), Color.White, 0, new Vector2(0, 0), 2, SpriteEffects.None, 0);
                //spriteBatch.Draw(SK.texture_spritesheet_minos_64x, new Vector2(429 + 138 * i, 371), Get_Mino_Texture(slot[i], "middle"), Color.White, 0, new Vector2(0, 0), 2, SpriteEffects.None, 0);
            }
            //spriteBatch.Draw(SK.texture_background_mastermind2, SK.Position_DisplayEdge() + SK.Position_Mastermind2(), Color.White);
        }
コード例 #11
0
ファイル: Mastermind.cs プロジェクト: Epidra/GameCenter
 public override void Draw3()
 {
     if (!active_gameover && !active_pause)
     {
         spriteBatch.Draw(SK.texture_hud_button_questionmark, new Rectangle(SK.Position_Button(false), new Point(FM.button_scale)), Color.White);
     }
 }
コード例 #12
0
        public void Them()
        {
            SuKien SK;
            int    soluong = Menu.HoiYeuCau(9999, "Nhap so luong su kien: ");

            for (int i = 0; i < soluong; i++)
            {
                Menu.TaoHeader(10, "SU KIEN " + (i + 1).ToString());
                Console.Write("  1. Cuoc hop    2. Hoi thao\n\n");
                int chon = Menu.HoiYeuCau(2, "Chon loai su kien: ");
                if (chon == 1)
                {
                    SK = new CuocHop();
                }
                else
                {
                    SK = new HoiThao();
                }
                try
                {
                    SK.Nhap();
                    DSSK.Add(SK);
                }
                catch { Program.XuatMauDo("    Them that bai!\n"); }
            }
        }
コード例 #13
0
        public override void setData(GetReport_ReturnType returnData)
        {
            base.setData(returnData);
            switch (returnData.reportType)
            {
            case 0x49:
                base.lblMainText.Text      = returnData.otherUser + " (" + GameEngine.Instance.World.getVillageName(returnData.attackingVillage) + ")";
                base.lblSubTitle.Text      = SK.Text("Reports_Sent_Resources_To", "Has sent resources to");
                base.lblSecondaryText.Text = base.reportOwner + " (" + GameEngine.Instance.World.getVillageName(returnData.defendingVillage) + ")";
                break;

            case 0x4e:
                base.lblMainText.Text      = GameEngine.Instance.World.getVillageName(returnData.attackingVillage);
                base.lblSubTitle.Text      = SK.Text("Report_Auto_Sent_Resources_To", "Has Auto-Sent resources to");
                base.lblSecondaryText.Text = GameEngine.Instance.World.getVillageName(returnData.defendingVillage);
                break;
            }
            base.imgFurther.Image = (Image)GFXLibrary.getCommodity32Image(base.m_returnData.genericData1);
            base.imgFurther.setSizeToImage();
            base.imgFurther.Position  = new Point((base.Width / 2) - base.imgFurther.Width, base.btnDelete.Position.Y);
            base.lblFurther.Text      = base.m_returnData.genericData2.ToString("N", base.nfi);
            base.lblFurther.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_LEFT;
            base.lblFurther.Size      = new Size(base.Width, base.imgFurther.Height);
            base.lblFurther.Position  = new Point(base.imgFurther.Rectangle.Right + 10, base.imgFurther.Position.Y);
            base.showFurtherInfo();
        }
コード例 #14
0
 public void selfJoinHouseCallback(SelfJoinHouse_ReturnType returnData)
 {
     if (returnData.Success)
     {
         if (returnData.factionsList != null)
         {
             GameEngine.Instance.World.processFactionsList(returnData.factionsList, returnData.currentFactionChangePos);
         }
         GameEngine.Instance.World.HouseInfo     = returnData.m_houseData;
         GameEngine.Instance.World.YourFaction   = returnData.yourFaction;
         GameEngine.Instance.World.HouseVoteInfo = returnData.m_houseVoteData;
         if ((returnData.yourFaction != null) && (returnData.yourFaction.houseID > 0))
         {
             InterfaceMgr.Instance.showHousePanel(returnData.yourFaction.houseID);
         }
         else
         {
             this.init(false);
         }
     }
     else if ((returnData.m_errorCode == ErrorCodes.ErrorCode.HOUSE_FULL) || (returnData.m_errorCode == ErrorCodes.ErrorCode.HOUSE_FACTION_NEEDS_5_MEMBERS))
     {
         if ((returnData.m_errorCode == ErrorCodes.ErrorCode.HOUSE_FACTION_NEEDS_5_MEMBERS) && (GameEngine.Instance.LocalWorldData.Alternate_Ruleset == 1))
         {
             MyMessageBox.Show(SK.Text("ERRORCODE_HOUSE_FACTION_NEEDS_10_MEMBERS", "Your faction needs 10 members to join a house."), SK.Text("FactionsPanel_House_Join_Error", "House Join Error"));
         }
         else
         {
             MyMessageBox.Show(ErrorCodes.getErrorString(returnData.m_errorCode), SK.Text("FactionsPanel_House_Join_Error", "House Join Error"));
         }
     }
 }
コード例 #15
0
        public void setPerson(long personID)
        {
            WorldMap.LocalPerson person = GameEngine.Instance.World.getPerson(personID);
            if (person == null)
            {
                InterfaceMgr.Instance.closePersonInfoPanel();
            }
            else
            {
                switch (person.person.personType)
                {
                case 4:
                    this.backGround.updatePanelType(0x3e9);
                    this.backGround.updateHeading(SK.Text("PersonInfoPanel_Monk", "Monk"));
                    break;

                case 100:
                    this.backGround.updatePanelType(0x3ee);
                    this.backGround.updateHeading(SK.Text("PersonInfoPanel_Disease_Rat", "Disease Rat"));
                    break;
                }
                this.m_person  = person;
                this.lastState = -1;
                this.update();
            }
        }
コード例 #16
0
ファイル: Sokoban.cs プロジェクト: Epidra/GameCenter
 public override void Draw2()
 {
     for (int x = 0; x < 16; x++)
     {
         for (int y = 0; y < 12; y++)
         {
             if (grid_field[x, y] == 1)
             {
                 spriteBatch.Draw(SK.texture_background_grid32, SK.Position_DisplayEdge() + SK.Position_Grid32() + new Vector2(6 * 32, 5 * 32) + new Vector2(32 * x, 32 * y), new Rectangle(0, 0, 32, 32), Color.WhiteSmoke, 0.0f, new Vector2(0, 0), 1, SpriteEffects.None, 0.0f);
             }
             if (grid_field[x, y] == 2)
             {
                 spriteBatch.Draw(SK.texture_background_grid32, SK.Position_DisplayEdge() + SK.Position_Grid32() + new Vector2(6 * 32, 5 * 32) + new Vector2(32 * x, 32 * y), new Rectangle(32, 0, 32, 32), Color.WhiteSmoke, 0.0f, new Vector2(0, 0), 1, SpriteEffects.None, 0.0f);
             }
             if (grid_main [x, y])
             {
                 spriteBatch.Draw(SK.texture_spritesheet_octagames, SK.Position_DisplayEdge() + SK.Position_Grid32() + new Vector2(6 * 32, 5 * 32) + new Vector2(32 * x, 32 * y), new Rectangle(32, 0, 32, 32), Color.WhiteSmoke, 0.0f, new Vector2(0, 0), 1, SpriteEffects.None, 0.0f);
             }
         }
     }
     foreach (Entity c in crate)
     {
         spriteBatch.Draw(SK.texture_spritesheet_octagames, SK.Position_DisplayEdge() + SK.Position_Grid32() + new Vector2(6 * 32, 5 * 32) + c.Get_GridPos(), new Rectangle(0, 32, 32, 32), Color.White, 0.0f, new Vector2(0, 0), 1, SpriteEffects.None, 0.0f);
     }
     foreach (Entity c in cross)
     {
         spriteBatch.Draw(SK.texture_spritesheet_octagames, SK.Position_DisplayEdge() + SK.Position_Grid32() + new Vector2(6 * 32, 5 * 32) + c.Get_GridPos(), new Rectangle(32, 32, 32, 32), Color.White, 0.0f, new Vector2(0, 0), 1, SpriteEffects.None, 0.0f);
     }
     spriteBatch.Draw(SK.texture_spritesheet_octanom_head, SK.Position_DisplayEdge() + SK.Position_Grid32() + new Vector2(6 * 32, 5 * 32) + octanom.Get_GridPos(), new Rectangle(0, octanom.Get_LookDirection() * 32, 32, 32), Color.White, 0.0f, new Vector2(0, 0), 1, SpriteEffects.None, 0.0f);
 }
コード例 #17
0
ファイル: Program.cs プロジェクト: studentutu/StereoKit
    static void Main(string[] args)
    {
        // If the app has a constructor that takes a string array, then
        // we'll use that, and pass the command line arguments into it on
        // creation
        Type appType = typeof(App);
        App  app     = appType.GetConstructor(new Type[] { typeof(string[]) }) != null
                        ? (App)Activator.CreateInstance(appType, new object[] { args })
                        : (App)Activator.CreateInstance(appType);

        if (app == null)
        {
            throw new Exception("StereoKit loader couldn't construct an instance of the App!");
        }

        // Initialize StereoKit, and the app
        if (!SK.Initialize(app.Settings))
        {
            Environment.Exit(1);
        }

        if (Backend.XRType == BackendXRType.OpenXR)
        {
            xrConvertTimeToWin32PerformanceCounterKHR = Backend.OpenXR.GetFunction <XR_xrConvertTimeToWin32PerformanceCounterKHR>("xrConvertTimeToWin32PerformanceCounterKHR");
            xrConvertTimeToWin32PerformanceCounterKHR(Backend.OpenXR.Instance, Backend.OpenXR.Time, out long counter);
            Log.Info($"XrTime: {counter}");
        }

        app.Init();

        // Now pass execution over to StereoKit
        SK.Run(app.Step, () => Log.Info("Bye!"));
    }
コード例 #18
0
 private void deleteClick()
 {
     if ((this.storedList.getSelectedItem() != null) && (MyMessageBox.Show(SK.Text("Formations_Confirm_Delete", "Are you sure you want to delete this formation?"), SK.Text("Formations_Delete_Confirmation_Title", "Confirm Deletion"), MessageBoxButtons.YesNo) != DialogResult.No))
     {
         this.SharedDeleteCode();
     }
 }
コード例 #19
0
        public override void setData(GetReport_ReturnType returnData)
        {
            base.setData(returnData);
            switch (returnData.reportType)
            {
            case 15:
                base.lblMainText.Text      = base.lblMainText.Text + " (" + GameEngine.Instance.World.getVillageName(returnData.attackingVillage) + ")";
                base.lblSubTitle.Text      = SK.Text("Reports_Has_Lost_Vassal", "Has Lost a Vassal");
                base.lblSecondaryText.Text = returnData.otherUser + " (" + GameEngine.Instance.World.getVillageName(returnData.defendingVillage) + ")";
                this.villageID             = returnData.attackingVillage;
                base.lblFurther.Text       = SK.Text("Reports_Troops_Lost", "Troops Lost") + " : " + returnData.genericData1.ToString("N", base.nfi);
                base.lblFurther.Visible    = true;
                base.addControl(base.lblFurther);
                break;

            case 0x10:
                base.lblMainText.Text      = base.lblMainText.Text + " (" + GameEngine.Instance.World.getVillageName(returnData.attackingVillage) + ")";
                base.lblSubTitle.Text      = SK.Text("Reports_No_Longer_Liege_Lord", "No longer has a liege lord");
                base.lblSecondaryText.Text = "";
                this.villageID             = returnData.attackingVillage;
                break;

            case 0x2e:
                base.lblMainText.Text      = returnData.otherUser + " (" + GameEngine.Instance.World.getVillageName(returnData.attackingVillage) + ")";
                base.lblSubTitle.Text      = SK.Text("Reports_Offers_Liege_lord", "offers to be liege lord of");
                base.lblSecondaryText.Text = base.reportOwner + " (" + GameEngine.Instance.World.getVillageName(returnData.defendingVillage) + ")";
                this.villageID             = returnData.defendingVillage;
                break;

            case 0x2f:
                base.lblMainText.Text      = returnData.otherUser + " (" + GameEngine.Instance.World.getVillageName(returnData.defendingVillage) + ")";
                base.lblSubTitle.Text      = SK.Text("Reports_Accepted_Liege_Lord", "has accepted your liege lord offer and becomes your vassal to");
                base.lblSecondaryText.Text = GameEngine.Instance.World.getVillageName(returnData.attackingVillage);
                this.villageID             = returnData.attackingVillage;
                break;

            case 0x30:
                base.lblMainText.Text      = returnData.otherUser + " (" + GameEngine.Instance.World.getVillageName(returnData.defendingVillage) + ")";
                base.lblSubTitle.Text      = SK.Text("Reports_Has_declined_Liege_lord_Offer", "has declined your liege lord offer from");
                base.lblSecondaryText.Text = GameEngine.Instance.World.getVillageName(returnData.attackingVillage);
                this.villageID             = returnData.attackingVillage;
                break;

            case 0x31:
                base.lblMainText.Text      = returnData.otherUser + " (" + GameEngine.Instance.World.getVillageName(returnData.attackingVillage) + ")";
                base.lblSubTitle.Text      = SK.Text("Reports_Withdrawn_Liege_Lord_Offer", "has withdrawn the liege lord offer for");
                base.lblSecondaryText.Text = base.reportOwner + " (" + GameEngine.Instance.World.getVillageName(returnData.defendingVillage) + ")";
                this.villageID             = returnData.defendingVillage;
                break;
            }
            if (GameEngine.Instance.World.isUserVillage(this.villageID))
            {
                base.btnUtility.Text.Text = SK.Text("GENERIC_Vassals", "Vassals");
                base.btnUtility.Visible   = true;
            }
            else
            {
                base.btnUtility.Visible = false;
            }
        }
コード例 #20
0
        private void renameClick()
        {
            string testText = this.m_parent.getSelectedText();

            if ((this.storedList.getSelectedItem() != null) && (testText != ""))
            {
                if (this.storedList.contains(testText))
                {
                    MyMessageBox.Show(SK.Text("Formations_Name_Exists", "That name is already in use"), SK.Text("Formations_Overwrite_Title", "Name Already in Use"));
                }
                else
                {
                    string text = this.storedList.getSelectedItem().Text;
                    GameEngine.Instance.CastleAttackerSetup.renameAttackSetup(text, testText);
                    this.formationNames.Remove(this.storedList.getSelectedItem());
                    CustomSelfDrawPanel.CSDListItem item = new CustomSelfDrawPanel.CSDListItem {
                        Text = testText
                    };
                    this.formationNames.Add(item);
                    this.storedList.populate(this.formationNames);
                    this.selectedTitleLabel.Text = testText;
                    this.loadNames();
                }
            }
        }
コード例 #21
0
 public void init()
 {
     base.clearControls();
     CustomSelfDrawPanel.CSDImage image = this.backGround.init(true, 0x3ec);
     this.backGround.updateHeading(SK.Text("SelectArmyPanel_Trader", "Trader"));
     this.backGround.centerSubHeading();
     base.addControl(this.backGround);
     this.backGround.initTravelButton(this.homeVillageButton);
     this.homeVillageButton.Position = new Point(11, 0x3d);
     this.homeVillageButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.homeClick), "TraderInfoPanel2_home_village");
     image.addControl(this.homeVillageButton);
     this.backGround.initTravelButton(this.targetVillageButton);
     this.targetVillageButton.Position = new Point(11, 0x77);
     this.targetVillageButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.targetClick), "TraderInfoPanel2_target_village");
     image.addControl(this.targetVillageButton);
     this.travelDirection.Image    = (Image)GFXLibrary.mrhp_travelling_arrows[0];
     this.travelDirection.Position = new Point(0x58, 90);
     this.travelDirection.Alpha    = 0.5f;
     image.addControl(this.travelDirection);
     this.resourceImage.Image    = GFXLibrary.dummy;
     this.resourceImage.Position = new Point(0x2d, 0x90);
     this.resourceImage.Visible  = false;
     image.addControl(this.resourceImage);
     this.resourceAmountLabel.Text     = "";
     this.resourceAmountLabel.Color    = ARGBColors.Black;
     this.resourceAmountLabel.Font     = FontManager.GetFont("Arial", 8f, FontStyle.Regular);
     this.resourceAmountLabel.Position = new Point(90, 0x9e);
     this.resourceAmountLabel.Size     = new Size(0xa8, 0x17);
     this.resourceAmountLabel.Visible  = false;
     image.addControl(this.resourceAmountLabel);
 }
コード例 #22
0
 public void init()
 {
     base.clearControls();
     CustomSelfDrawPanel.CSDImage image = this.backGround.init(true, 0x3eb);
     this.backGround.updateHeading(SK.Text("SelectArmyPanel_Reinforcements", "Reinforcements"));
     this.backGround.centerSubHeading();
     base.addControl(this.backGround);
     this.backGround.initTravelButton(this.homeVillageButton);
     this.homeVillageButton.Position = new Point(11, 0x3d);
     this.homeVillageButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.homeClick), "SelectReinforcementPanel2_home_village");
     image.addControl(this.homeVillageButton);
     this.backGround.initTravelButton(this.targetVillageButton);
     this.targetVillageButton.Position = new Point(11, 0x77);
     this.targetVillageButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.targetClick), "SelectReinforcementPanel2_target_village");
     image.addControl(this.targetVillageButton);
     this.travelDirection.Image    = (Image)GFXLibrary.mrhp_travelling_arrows[0];
     this.travelDirection.Alpha    = 0.5f;
     this.travelDirection.Position = new Point(0x58, 90);
     image.addControl(this.travelDirection);
     this.returnButton.ImageNorm   = (Image)GFXLibrary.mrhp_button_150x25[0];
     this.returnButton.ImageOver   = (Image)GFXLibrary.mrhp_button_150x25[1];
     this.returnButton.ImageClick  = (Image)GFXLibrary.mrhp_button_150x25[2];
     this.returnButton.Position    = new Point(0x1a, 0x9b);
     this.returnButton.Text.Text   = "";
     this.returnButton.TextYOffset = -3;
     this.returnButton.Text.Color  = ARGBColors.Black;
     this.returnButton.Text.Font   = FontManager.GetFont("Arial", 9f, FontStyle.Bold);
     this.returnButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.returnClick), "SelectReinforcementPanel2_return");
     this.returnButton.Visible = false;
     image.addControl(this.returnButton);
 }
コード例 #23
0
ファイル: App.cs プロジェクト: studentutu/StereoKit
    //////////////////////

    public App(string[] args)
    {
        Tests.IsTesting       = Array.IndexOf(args, "-test") != -1;
        Tests.MakeScreenshots = Array.IndexOf(args, "-noscreens") == -1;
        if (Array.IndexOf(args, "-screenfolder") != -1)
        {
            Tests.ScreenshotRoot = args[Array.IndexOf(args, "-screenfolder") + 1];
        }
        if (Array.IndexOf(args, "-start") != -1)
        {
            startTest = args[Array.IndexOf(args, "-start") + 1];
        }

        if (Tests.IsTesting)
        {
            settings.displayPreference     = DisplayMode.Flatscreen;
            settings.disableUnfocusedSleep = true;
        }

        // Preload the StereoKit library for access to Time.Scale before
        // initialization occurs.
        SK.PreLoadLibrary();
        Time.Scale = Tests.IsTesting ? 0 : 1;

        /// :CodeSample: Log.Subscribe Log
        /// Then you add the OnLog method into the log events like this in
        /// your initialization code!
        Log.Subscribe(OnLog);
        /// :End:
    }
コード例 #24
0
        public void update()
        {
            TimeSpan span     = (TimeSpan)(DateTime.Now - this.m_startTime);
            int      secsLeft = this.m_secondsLeft - ((int)span.TotalSeconds);

            if (secsLeft < 0)
            {
                InterfaceMgr.Instance.closeVacationCancelPopupWindow();
            }
            else
            {
                this.expiresInLabel.TextDiffOnly = SK.Text("VACATION_Expires_In", "Vacation Mode Expires in") + " - " + VillageMap.createBuildTimeString(secsLeft);
            }
            int num2 = this.m_secondsLeftToCancel - ((int)span.TotalSeconds);

            if (num2 < 0)
            {
                if (!this.cancelButton.Visible)
                {
                    this.cancelButton.Visible  = true;
                    this.cancelInLabel.Visible = false;
                }
            }
            else
            {
                this.cancelInLabel.Text = SK.Text("VACATION_Cancel_In", "You can cancel in") + " - " + VillageMap.createBuildTimeString(num2);
            }
        }
コード例 #25
0
        public void update()
        {
            this.backGround.update();
            bool     visible = this.lblProtectionType.Visible;
            int      num     = 0;
            TimeSpan span    = new TimeSpan();

            if (GameEngine.Instance.World.isVillageInterdictProtected(this.m_selectedVillage))
            {
                DateTime time  = GameEngine.Instance.World.getInterdictTime(this.m_selectedVillage);
                DateTime time2 = VillageMap.getCurrentServerTime();
                span = (TimeSpan)(time - time2);
                num  = 1;
            }
            if (num == 1)
            {
                int    totalSeconds = (int)span.TotalSeconds;
                string str          = VillageMap.createBuildTimeStringFull(totalSeconds);
                this.lblProtected.TextDiffOnly      = SK.Text("OtherVillagePanel_Cannot_Be_Attacked_For_X_Time", "Cannot be attacked for") + " : " + str;
                this.lblProtectionType.TextDiffOnly = SK.Text("OtherVillagePanel_Interdict", "Interdict");
                this.lblProtectionType.Visible      = true;
            }
            else
            {
                this.lblProtected.TextDiffOnly      = "";
                this.lblProtectionType.TextDiffOnly = "";
                this.lblProtectionType.Visible      = false;
            }
            if (visible != this.lblProtectionType.Visible)
            {
                this.updateSize();
            }
        }
コード例 #26
0
 public void deleteMoatClicked()
 {
     if (MyMessageBox.Show(SK.Text("Advanced_Castle_Delete_Castle_message_moat", "You are about to delete all your Moat from your castle. Are you really sure about this?"), SK.Text("Advanced_Castle_Delete_Castle", "Delete All Castle Infrastructure"), MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         this.DeleteMoat();
     }
 }
コード例 #27
0
        private void button2_Click(bool sfx)
        {
            if (sfx)
            {
                GameEngine.Instance.playInterfaceSound("WorldMapScreen_menu_settings");
            }
            MenuPopup popup = new MenuPopup();
            Point     point = base.csd.PointToScreen(this.btnFileMenu.Position);

            popup.setPosition(point.X, point.Y + 0x18);
            popup.setCallBack(new MenuPopup.MenuCallback(this.menu1Callback));
            popup.addMenuItem(SK.Text("MENU_Settings", "Settings"), 1);
            popup.addMenuItem(SK.Text("MENU_Edit_Avatar", "Edit Avatar"), 5);
            popup.addMenuItem(SK.Text("User_Manage_Relations", "Manage Diplomacy"), 300);
            int ownSelectedVillage = InterfaceMgr.Instance.OwnSelectedVillage;

            if (((ownSelectedVillage >= 0) && !GameEngine.Instance.World.isCapital(ownSelectedVillage)) && GameEngine.Instance.World.isUserVillage(ownSelectedVillage))
            {
                popup.addBar();
                popup.addMenuItem(SK.Text("MENU_Rename_Current_Village", "Rename Current Village"), 9);
                CustomSelfDrawPanel.CSDControl control  = popup.addMenuItem(SK.Text("MENU_Convert_Current_Village", "Convert Current Village"), 12);
                CustomSelfDrawPanel.CSDControl control2 = popup.addMenuItem(SK.Text("MENU_Abandon_Current_Village", "Abandon Current Village"), 11);
                control.CustomTooltipID  = 0x4b0;
                control2.CustomTooltipID = 0x4b1;
            }
            popup.showMenu();
        }
コード例 #28
0
 public void deleteOilPotsClicked()
 {
     if (MyMessageBox.Show(SK.Text("Advanced_Castle_Delete_Castle_message_oil", "You are about to delete all your Oil Pots castle. Are you really sure about this?"), SK.Text("Advanced_Castle_Delete_Castle_oil_pots", "Delete All Oil Pots"), MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         this.DeleteOilPots();
     }
 }
コード例 #29
0
ファイル: Program.cs プロジェクト: ltstein/StereoKit
    static void Main(string[] args)
    {
        // If the app has a constructor that takes a string array, then
        // we'll use that, and pass the command line arguments into it on
        // creation
        Type appType = typeof(App);
        App  app     = appType.GetConstructor(new Type[] { typeof(string[]) }) != null
                        ? (App)Activator.CreateInstance(appType, new object[] { args })
                        : (App)Activator.CreateInstance(appType);

        if (app == null)
        {
            throw new Exception("StereoKit loader couldn't construct an instance of the App!");
        }

        // Initialize StereoKit, and the app
        if (!SK.Initialize(app.Settings))
        {
            Environment.Exit(1);
        }
        app.Init();

        // Now loop until finished, and then shut down
        Action step = app.Step;         // Storing this separately reduces allocations

        while (SK.Step(step))
        {
        }
        SK.Shutdown();
    }
コード例 #30
0
ファイル: OctaCubes.cs プロジェクト: Epidra/GameCenter
        public override void Draw2()
        {
            spriteBatch.Draw(SK.texture_spritesheet_octacubes, SK.Position_OctaCubes() + new Vector2(32 - 16, 8 - 32 - 8 * score_level), new Rectangle(128, 0, 64, 48), Color.White * alpha, 0.0f, new Vector2(0, 0), 1, SpriteEffects.None, 0.0f);
            spriteBatch.Draw(SK.texture_spritesheet_octacubes, SK.Position_OctaCubes() + new Vector2(-32 - 16, 8 - 32 - 8 * score_level), new Rectangle(128, 0, 64, 48), Color.White * alpha, 0.0f, new Vector2(0, 0), 1, SpriteEffects.None, 0.0f);
            for (int y = 0; y < grid_main.GetLength(1); y++)
            {
                for (int x = 0; x < grid_main.GetLength(0); x++)
                {
                    if (grid_main[x, y] == 1)
                    {
                        spriteBatch.Draw(SK.texture_spritesheet_octacubes, SK.Position_OctaCubes() + new Vector2(32 * x - 32 * y - 16, 32 * x + 32 * y + 8 - 8 * score_level), new Rectangle(0, 0, 64, 48), Color.White * alpha, 0.0f, new Vector2(0, 0), 1, SpriteEffects.None, 0.0f);
                    }
                    if (grid_main[x, y] == 2)
                    {
                        spriteBatch.Draw(SK.texture_spritesheet_octacubes, SK.Position_OctaCubes() + new Vector2(32 * x - 32 * y - 16, 32 * x + 32 * y + 8 - 8 * score_level), new Rectangle(64, 0, 64, 48), Color.White * alpha, 0.0f, new Vector2(0, 0), 1, SpriteEffects.None, 0.0f);
                    }
                }
            }
            foreach (Entity c in boulders)
            {
                spriteBatch.Draw(SK.texture_static_boulder, SK.Position_OctaCubes() + c.Get_GridPos() + new Vector2(0, -8 * score_level), Color.White * alpha);
            }
            if (octanom.Get_HP() > 0 && score_lives > 0)
            {
                spriteBatch.Draw(SK.texture_spritesheet_octanom_head, SK.Position_OctaCubes() + new Vector2(octanom.Get_GridPos().X, octanom.Get_GridPos().Y - 8 * score_level), new Rectangle(0, octanom.Get_LookDirection() * 32, 32, 32), Color.White * alpha, 0.0f, new Vector2(0, 0), 1, SpriteEffects.None, 0.0f);
            }

            foreach (Entity E in explosions)
            {
                spriteBatch.Draw(SK.texture_spritesheet_explosion, SK.Position_OctaCubes() + E.Get_Pos() - new Vector2(16), new Rectangle(1 + E.Get_HP() + (64 * (E.Get_HP() / 2)), 1, 64, 64), Color.White, 0.0f, new Vector2(0, 0), 1, SpriteEffects.None, 0.0f);
                E.Change_HP(1);
            }
        }