示例#1
0
 static void Postfix(VRUI.VRUIViewController.DeactivationType deactivationType)
 {
     if (deactivationType == VRUI.VRUIViewController.DeactivationType.RemovedFromHierarchy)
     {
         Gamemode.ResetGameMode();
     }
 }
示例#2
0
        protected override void Init()
        {
            base.Init();
            switch (Gamemode)
            {
            case Type.Rush:
                MaxTimer    = 10;
                PointsToAdd = 5;
                break;

            case Type.Rush_Crazy:
                MaxTimer    = 6;
                PointsToAdd = 10;
                break;

            case Type.Rush_Insane:
                MaxTimer    = 3;
                PointsToAdd = 20;
                break;

            default:
                Debug.LogError("Gamemode: " + Gamemode.ToString() + " is NOT handled in rush script!");
                break;
            }

            SetUp();
        }
        // Fills the list view component with the leaderboard data for the passed game mode
        private async void FillListView(Gamemode currentGameMode)
        {
            // Creates the leaderboard manager for the passed gamemode
            this.leaderboardManager = new LeaderboardController(currentGameMode);

            // Clear the leaderboard view of any items
            this.leaderboardListView.Items.Clear();

            // Get the leaderboard data from the database
            List <LeaderboardData> leaderboardData = await this.leaderboardManager.GetLeaderboard();

            // Goes through each record of the database ordered by score in descending order
            int counter = 1;

            foreach (var record in leaderboardData.OrderByDescending(l => l.Score))
            {
                // Form the rank of each score - if it's below 10 add a zero ifront of the digit
                string rank = counter < 10 ? "0" + counter : counter.ToString();

                // Form the rank row
                string result = $@"      {rank}.         {record.Username} - {record.Score} pt.";

                // Create list view item with the formated result
                ListViewItem listViewItem = new ListViewItem(result);
                listViewItem.IndentCount = 4;

                // Add the list view item inside the listview
                this.leaderboardListView.Items.Add(listViewItem);

                // Increase the counter
                counter++;
            }
        }
    void StartLevel()
    {
        //Get rid of the old castle if one exists
        if (castle != null)
        {
            Destroy(castle);
        }

        //Destroy old projectiles if they exist
        GameObject[] gos = GameObject.FindGameObjectsWithTag("Projectile");
        foreach (GameObject pTemp in gos)
        {
            Destroy(pTemp);
        }

        //Instantiate the new castle
        castle = Instantiate(castles[level]) as GameObject;
        castle.transform.position = castlePos;
        shotsTaken = 0;

        //Reset the camera
        SwitchView("Booth");
        ProjectileLine.S.Clear();

        //Reset the goal
        Goal.goalMet = false;

        ShowGT();

        mode = Gamemode.playing;
    }
示例#5
0
 /// <summary>
 /// update gamemode
 /// </summary>
 public SP32PlayerInfo(MinecraftClient client, UUID uuid, Gamemode gamemode) : base(client)
 {
     Action = Data.WriteVarInt(1);
     Data.WriteVarInt(1);
     Uuid     = Data.WriteUuid(uuid);
     Gamemode = (Gamemode)Data.WriteVarInt((int)gamemode);
 }
示例#6
0
        public void Add(Gamemode gamemode, string player, TimeSpan time, DateTimeOffset date)
        {
            var achievements = _liteDatabase.GetCollection <AchievementRow>(_settings.AchievementsTable);
            var gamemodes    = _liteDatabase.GetCollection <GamemodeRow>(_settings.GamemodesTable);

            var gamemodeId = gamemodes.Query()
                             .Where(gm =>
                                    gamemode.Name == gm.Name &&
                                    gamemode.Width == gm.Width &&
                                    gamemode.Height == gm.Height &&
                                    gamemode.Bombs == gm.Bombs)
                             .Select(gm => gm.GamemodeId)
                             .FirstOrDefault();

            if (gamemodeId == 0)
            {
                gamemodeId = gamemodes.Insert(_mapper.Map <GamemodeRow>(gamemode));
            }

            var achivmentEntity = new AchievementRow
            {
                Date       = date,
                GamemodeId = gamemodeId,
                Player     = player,
                Time       = time
            };

            achievements.Insert(achivmentEntity);
            _logger.LogInformation("Player {0} won gamemode {1} in {2}", player, gamemode.Name, time);
        }
示例#7
0
        public static async Task <IActionResult> StartGame(
            [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "game/start")] HttpRequest req,
            ILogger log)
        {
            try
            {
                // User wants to start the game
                // Which gamemode did he choose?
                string   requestBody      = await new StreamReader(req.Body).ReadToEndAsync();
                Gamemode selectedGamemode = JsonConvert.DeserializeObject <Gamemode>(requestBody);

                // Start this gamemode
                Game startedGame = await GameHelper.StartGame(selectedGamemode);

                return(new OkObjectResult(startedGame));
            }
            catch (Exception ex)
            {
                if (ex.Message.Equals("GAME_BUSY"))
                {
                    return(new BadRequestObjectResult("There is already a game."));
                }
                throw ex;
            }
        }
示例#8
0
#pragma warning restore CS1591
        #endregion

        private Map(Gamemode gamemode, string mapName, OWEvent gameEvent)
        {
            GameEvent = gameEvent;
            GameMode  = gamemode;
            MapName   = mapName;
            ShortName = mapName.Substring(mapName.IndexOf('_') + 1);
        }
示例#9
0
        /// <summary>
        /// Begins the game, letting it start its update loop
        /// </summary>
        /// <param name="shouldDoWorldSetup">Whether to create tanks and map objects</param>
        public void BeginGame(bool shouldDoWorldSetup = true)
        {
            if (HasStarted)
            {
                return;
            }
            if (!HasEnoughPlayersToStart)
            {
                return;
            }

            EventEngine.UnsafeDisableEvents();

            HasStarted = true;

            Status = CurrentGameStatus.GameRunning;

            if (shouldDoWorldSetup)
            {
                //Create the player objects (server only)
                SetupGamePlayers();
                //And load the map / create the map objects
                CreateMapObjects();
            }
            Gamemode.StartGame();

            EventEngine.UnsafeEnableEvents();
            //And raise events
            EventEngine.RaiseGameStarted();
        }
示例#10
0
        /// <summary>
        /// Gets the modes enabled in the Overwatch custom game.
        /// </summary>
        /// <param name="currentOverwatchEvent">The current Overwatch event.</param>
        /// <returns></returns>
        public Gamemode GetModesEnabled(OWEvent currentOverwatchEvent)
        {
            using (LockHandler.Interactive)
            {
                NavigateToModesMenu();

                ResetMouse();

                Thread.Sleep(100);

                UpdateScreen();

                Gamemode modesEnabled = new Gamemode();

                foreach (Gamemode gamemode in Enum.GetValues(typeof(Gamemode)))
                {
                    Point gamemodeIconLocation = GetModeLocation(gamemode, currentOverwatchEvent);
                    if (gamemodeIconLocation != Point.Empty && Capture.CompareColor(gamemodeIconLocation, Colors.SETTINGS_MODES_ENABLED, Fades.SETTINGS_MODES_ENABLED))
                    {
                        modesEnabled |= gamemode;
                    }
                }

                GoBack(2);

                return(modesEnabled);
            }
        }
示例#11
0
        public void ProcessLobby()
        {
            WriteLine("직업을 선택하세요!");
            WriteLine("[1]기사");
            WriteLine("[2]궁수");
            WriteLine("[3]마법사");

            string input = ReadLine();

            switch (input)
            {
            case "1":
                player = new Knight();
                mode   = Gamemode.Town;
                break;

            case "2":
                player = new Archer();
                mode   = Gamemode.Town;
                break;

            case "3":
                player = new Mage();
                mode   = Gamemode.Town;
                break;
            }
        }
示例#12
0
    void Start()
    {
        if (testing)
        {
            currentGamemode   = defaultGamemode;
            currentDifficulty = defaultDifficulty;
        }

#if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR
        Player1DriveUI.SetActive(true);
#endif

        if (currentGamemode == Gamemode.singleplayer)
        {
            Player1.transform.GetComponent <Visualizacion>().UpgradeToFullscreen();
            Player2.transform.GetComponent <Visualizacion>().Deactivate();
            Player2.gameObject.SetActive(false);
        }
        else
        {
#if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR
            Player2DriveUI.SetActive(true);
#endif
        }


        IniciarCalibracion();


        //para testing
        //PosCamionesCarrera[0].x+=100;
        //PosCamionesCarrera[1].x+=100;
    }
示例#13
0
        public ActionResult Create([Bind(Include = "GameId,Player1Id,Player2Id,GamemodeId,Moves,Winner")] GameCreateViewModel gameCreateViewModel)
        {
            if (ModelState.IsValid)
            {
                var player1  = db.Users.Find(gameCreateViewModel.Player1Id);
                var player2  = db.Users.Find(gameCreateViewModel.Player2Id);
                var gamemode = db.Gamemodes.Find(gameCreateViewModel.GamemodeId);

                if (gamemode == null)
                {
                    gamemode = new Gamemode(1, 0);
                }

                Game game = new Game(gamemode)
                {
                    GameId  = gameCreateViewModel.GameId,
                    Player1 = player1,
                    Player2 = player2,
                    Moves   = gameCreateViewModel.Moves,
                    Winner  = gameCreateViewModel.Winner,
                    //Timer1=gameCreateViewModel.Timer1,
                    //Timer2= gameCreateViewModel.Timer2,
                };

                db.Games.Add(game);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(gameCreateViewModel));
        }
        //Returns bool specifying whether or not to continue with the process
        public async Task <bool> Update(DirectoryInfo Destination, Gamemode Gamemode, ReleaseAsset Asset)
        {
            if (Destination == null || !Destination.Exists)
            {
                Dispatcher.Invoke(() => {
                    MessageBox.Show("Selected osu!lazer installation path is invalid.", Title, MessageBoxButton.OK, MessageBoxImage.Error);
                }, DispatcherPriority.Normal);
                MainWindow.UpdateLazerInstallationPath(false);
                return(false);
            }
            Debug.WriteLine("Will Update " + Gamemode.RulesetFilename + " from " + Asset.BrowserDownloadUrl);

            FileInfo DestinationFile = Destination.TryGetRelativeFile(Gamemode.RulesetFilename, out FileInfo File) ? File : null;

            Debug.WriteLine("\tDestination: " + DestinationFile?.FullName);

            if (DestinationFile.Exists())
            {
                RecycleFile(DestinationFile);
            }

            await DownloadFileAsync(new Uri(Asset.BrowserDownloadUrl), DestinationFile);

            return(true);
        }
示例#15
0
        public override void Execute(InRoomChat irc, string[] args)
        {
            if (args.Length > 0)
            {
                Gamemode oldMode = Mod.Gamemodes.CurrentMode;
                Gamemode newMode = Mod.Gamemodes.Find(args[0]);
                if (newMode == null)
                {
                    return;
                }

                GameHelper.Broadcast($"Gamemode Switch ({oldMode.Name} -> {newMode.Name})!");

                newMode.OnReset();
                Mod.Gamemodes.CurrentMode = newMode;

                oldMode.CleanUp();
            }
            else
            {
                irc.AddLine("Available Gamemodes:".AsColor("AAFF00"));

                foreach (Gamemode mode in Mod.Gamemodes.Elements)
                {
                    irc.AddLine("> ".AsColor("00FF00").AsBold() + mode.Name);
                }
            }
        }
示例#16
0
    public void OnJoinedRoom()
    {
        Room currentRoom = PhotonNetwork.room;

        string mapName = currentRoom.GetMap();

        m_roomMap = m_mapDatabase.GetMapWithMapName(mapName);

        int gamemodeIndex = currentRoom.GetGamemode();

        m_currenGameMode = (Mode)gamemodeIndex;

        Debug.Log("Gamemode : " + m_currenGameMode);

        //Instantiate MasterCLients Player
        if (PhotonNetwork.isMasterClient)
        {
            Gamemode.AddPlayerToTeam(m_currenGameMode, PhotonNetwork.masterClient);
            NetworkEventHandler.SyncSpawnNode(PhotonNetwork.player.GetPlayerTeam(), PhotonNetwork.masterClient);
            m_pingroutine = StartCoroutine(SetPing());
        }

        SetPlayerCount();
        IsRoomFull();
        m_startInternalTimer = true;
    }
示例#17
0
        public static async Task <Gamemode> AddGamemodeAsync(Gamemode gm)
        {
            try
            {
                // Make Entity of it
                GamemodeEntity gamemodeEntity = new GamemodeEntity(gm.Id, gm.Name, gm.Description, gm.Duration, gm.Released);

                CloudTable gamemodeTable = await StorageHelper.GetCloudTable("gamemodes");

                TableOperation insertOperation = TableOperation.Insert(gamemodeEntity);

                TableResult result = await gamemodeTable.ExecuteAsync(insertOperation);

                GamemodeEntity resultEntity   = result.Result as GamemodeEntity;
                Gamemode       resultGamemode = new Gamemode()
                {
                    Id          = resultEntity.Id,
                    Name        = resultEntity.Name,
                    Description = resultEntity.Description,
                    Duration    = resultEntity.Duration,
                    Released    = resultEntity.Released
                };

                return(resultGamemode);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#18
0
    void Update()
    {
        /// INITIALIZE ///
        if (gm == null || !initialized)
        {
            GameObject gg = GameObject.Find("Gamemode");
            if (gg == null)
                return;
            gm = gg.GetComponent<Gamemode>();
            if (gm.currentState == Gamemode.State.RACING)
                initialized = true;
            else
                return;
            for (int i = 0; i < gm.GetPlayers().Count; i++)
            {


                tempIcon = Instantiate(defaultIcon);                                            // Create a minimap marker for a player
                tempIcon.transform.parent = transform;                                          // Set its parent to be minimap GameObject
                tempIcon.GetComponent<Image>().sprite = gm.GetPlayers()[i].gameObject.transform.Find("Kart").GetComponent<KartInformation>().miniMapIcon;   // Set the icon sprite to be sprite from KartInformation
                gm.GetPlayers()[i].gameObject.GetComponent<Placement>().miniMapObject = tempIcon;   // Set the created icon to be this players personal minimap icon
            }
        }

        /// UPDATE ///
        for (int i = 0; i < gm.GetPlayers().Count; i++)
        {
            pX = GetMapPos(gm.GetPlayers()[i].gameObject.transform.position.x - offSetX, mapWidth, sceneWidth);
            pZ = GetMapPos(gm.GetPlayers()[i].gameObject.transform.position.z - offSetZ, mapHeight, sceneHeight);
            gm.GetPlayers()[i].gameObject.GetComponent<Placement>().miniMapObject.GetComponent<RectTransform>().localPosition = new Vector3(pX, pZ, 0);
        }
    }
示例#19
0
    // Update is called once per frame
    void Update()
    {
        if (gamemode == null)
        {
            var dump = GameObject.Find("Gamemode");
            if (dump != null)
            {
                gamemode = dump.GetComponent <Gamemode>();
            }
            return;
        }
        if (PlayerNetwork.localPlayer == null)
        {
            updateWeaponTexture(InventoryScript.WEAPON.noWeapon);
            return;
        }
        InventoryScript.WEAPON currentWeapon = PlayerNetwork.localPlayer.GetComponent <InventoryScript>().currentWeapon;
        if (currentWeapon != uiweapon)
        {
            updateWeaponTexture(currentWeapon);
        }
        lapText.GetComponent <Text>().text = "Lap:" + PlayerNetwork.localPlayer.GetComponent <Placement>().currentLap;
        int placement = gamemode.getPlacement(PlayerNetwork.localPlayer);

        placementText.GetComponent <Text>().text = placement + getPlacementString(placement);

        gamemode.checkGameFinish();
    }
示例#20
0
        public void SetMode(Gamemode game)
        {
            switch (game)
            {
            case Gamemode.classic:
                Game = (IGame) new ClassicGame();
                break;

            case Gamemode.advanced:
                Game = (IGame) new AdvancedGame();
                break;

            case Gamemode.challenge:
                Game = (IGame) new ChallengeGame();
                break;

            case Gamemode.evils:
                Game = (IGame) new EvilsGame();
                break;

            case Gamemode.custom:
                Game = (IGame) new CustomGame();
                break;

            case Gamemode.allany:
                Game = (IGame) new AllAnyGame();
                break;
            }
            SelectedMode = game;
        }
示例#21
0
        internal static string DeriveGamemodeFlags(Gamemode gamemode)
        {
            var gamemodes = new List <string>();

            if (gamemode.HasFlag(Gamemode.Casual))
            {
                gamemodes.Add(Constant.GamemodeToString(Gamemode.Casual));
            }

            if (gamemode.HasFlag(Gamemode.Unranked))
            {
                gamemodes.Add(Constant.GamemodeToString(Gamemode.Unranked));
            }

            if (gamemode.HasFlag(Gamemode.Ranked))
            {
                gamemodes.Add(Constant.GamemodeToString(Gamemode.Ranked));
            }

            if (gamemode.HasFlag(Gamemode.All))
            {
                gamemodes.Add(Constant.GamemodeToString(Gamemode.All));
            }

            return(string.Join(',', gamemodes));
        }
示例#22
0
    void InitializeBasics()
    {
        Debug.Log("Initializing!");
        InitializeDirectories();
        InitializeResources();
        state = State.Started;
        Datastream.healthAmount = Datastream.STARTING_HEALTH;

        if (currentScene != Scene.BattlefieldEditor)
        {
            ResearchMenu.cur = researchMenu;
            purchaseMenu.Initialize();
        }

        if (currentScene == Scene.Play)
        {
            researchMenu.SaveBackup();
            researchMenu.gameObject.SetActive(true);
            researchMenu.Initialize();
            enemyInformationPanel.Initialize();
        }

        if (currentScene == Scene.Play || currentScene == Scene.Menu)
        {
            SettingsMenu.cur = settingsMenu;
            SettingsMenu.LoadSettings();
        }

        if (Application.platform == RuntimePlatform.Android)
        {
            gamemode = Gamemode.TitaniumEnemies;
        }

        Debug.Log("Done initializing!");
    }
示例#23
0
    public EventData(int seed, int checkpoints, Gamemode gmode, SpecialEvent spEvent = SpecialEvent.None, string customName = "", string customDesc = "")
    {
        m_new = true;

        m_special         = spEvent;
        m_gameMode        = gmode;
        m_eventSeed       = seed;
        m_checkPoints     = checkpoints;
        m_customEventName = customName;
        m_customEventDesc = customDesc;
        m_seasonalEvent   = true;
        m_canBeRestarted  = true;
        m_eventLeague     = 16;

        m_rewardType = 0;

        SetEventRules();
        SetEventObjectives();

        UnityEngine.Random.InitState(m_eventSeed);
        int curveChance = UnityEngine.Random.Range(10, 71);
        int minStraight = UnityEngine.Random.Range(0, 3);
        int maxStraight = UnityEngine.Random.Range(minStraight, 8);

        m_startingHour = UnityEngine.Random.Range(0f, 24f);

        // Difficulty bonus setting.
        m_roadDifficulty = ((curveChance - 10f) / 70f) * 3f; m_roadDifficulty += 1 - (minStraight / 3f); m_roadDifficulty += 1 - (maxStraight / 8f);



        m_rewardValue = 0;
    }
        public async Task Update(int SelectedIndex)
        {
            Gamemode Gamemode    = DisplayGamemodes[SelectedIndex];
            int      CallerIndex = MainWindow?.Gamemodes.IndexOf(Gamemode) ?? -1;
            Release  Release     = GamemodeReleases[Gamemode];

            ReleaseAsset FoundAsset = null;

            foreach (ReleaseAsset Asset in Release.Assets.Where(Asset => Asset.Name.EndsWith(".dll")))
            {
                FoundAsset = Asset;
            }

            if (FoundAsset == null)
            {
                return;
            }

            if (!await Update(MainWindow.GetCurrentLazerPath(), Gamemode, FoundAsset))
            {
                return;
            }

            GamemodeReleases.Remove(Gamemode);
            DisplayGamemodes.RemoveAt(SelectedIndex);
            Title = OriginalTitle.Replace("%%COUNT%%", GamemodeReleases.Count.ToString("N0")).Replace("%%S%%", GamemodeReleases.Count != 1 ? "s" : string.Empty);

            if (CallerIndex >= 0)
            {
                Gamemode GamemodeClone = (Gamemode)Gamemode.Clone();
                GamemodeClone.UpdateStatus     = UpdateStatus.UpToDate;
                GamemodeClone.GitHubTagVersion = Release.TagName ?? GamemodeClone.GitHubTagVersion;
                MainWindow.UpdateGamemode(CallerIndex, GamemodeClone, true);
            }
        }
示例#25
0
    public void Awake()
    {
        SetVisible(false);

        uiTypes = Gamemode.GetUiSettings();

        EmitterSelect       = gameObject.AddComponent <StudioEventEmitter>();
        EmitterSelect.Event = FModStrings.ChoiceHover;
        EmitterSubmit       = gameObject.AddComponent <StudioEventEmitter>();
        EmitterSubmit.Event = FModStrings.ChoiceClick;
        EmitterAppear       = gameObject.AddComponent <StudioEventEmitter>();
        EmitterAppear.Event = FModStrings.ListAppear;

        button.onClick.AddListener(delegate
        {
            if (currentChoice == null)
            {
                Debug.LogError("Button shouldn't have beenn interactable");
                return;
            }
            currentChoice.Select();
        });

        uiTypes = Gamemode.GetUiSettings();
    }
示例#26
0
        private static Gamemode ReadGamemode(string Rule, Gamemode Default)
        {
            try
            {
                var gm = ReadString(Rule);
                switch (gm)
                {
                case "1":
                case "creative":
                    return(Gamemode.Creative);

                case "0":
                case "survival":
                    return(Gamemode.Surival);

                case "2":
                case "adventure":
                    return(Gamemode.Adventure);

                default:
                    return(Default);
                }
            }
            catch
            {
                return(Default);
            }
        }
示例#27
0
        private void InstantiateMatch(Player playerWhite, Player playerBlack)
        {
            Gamemode     gamemode = CreateGamemode(gamemodeType, playerWhite, playerBlack);
            BoardDisplay board    = new BoardDisplay(gamemode, white == PlayerType.Local, black == PlayerType.Local || black == PlayerType.LichessPlayer);

            board.Show();
        }
示例#28
0
 public override void Decode(MinecraftStream stream)
 {
     Dimension  = stream.ReadInt();
     Difficulty = (byte)stream.ReadByte();
     Gamemode   = (Gamemode)stream.ReadByte();
     LevelType  = stream.ReadString();
 }
示例#29
0
    // Start is called before the first frame update
    void Start()
    {
        gm           = FindObjectOfType <Gamemode>();
        rb           = GetComponent <Rigidbody2D>();
        player       = GameObject.Find("Player");
        playerScript = GameObject.Find("Player").GetComponent <Player>();
        enemy        = GameObject.Find("Enemy 1");

        animator = GetComponentInChildren <Animator>();

        //forward = playerScript.gunHolder.transform.localEulerAngles;
        //Debug.Log(forward);

        playerPos = player.transform.position;

        sr = GetComponentInChildren <SpriteRenderer>();

        //Set correct element visually.
        SetElement();

        // If enemy could see target, allow it to pass through obstacles
        if (gm.p_CanSeeTarget && gm.nearestEnemy)
        {
            passThrough = true;
        }
        else
        {
            passThrough = false;
        }
    }
示例#30
0
        public Entities WithGamemode(Gamemode gamemode)
        {
            var entities = Copy(this);

            entities.gamemode = gamemode;
            return(entities);
        }
        public static async Task <Gamemode> GetGamemodeEditor(Gamemode CurrentGamemode = default)
        {
            Debug.WriteLine("Update Status: " + CurrentGamemode.UpdateStatus);
            GamemodeEditor Window = new GamemodeEditor();

            Window.Show();
            return(await Window.GetGamemode(CurrentGamemode));
        }
示例#32
0
	public void SetModeSelection( Gamemode mode, bool value )
	{
		if( m_ModeSelection.ContainsKey( mode ) == false )
		{
			return;
		}

		m_ModeSelection[ mode ] = value;
	}
示例#33
0
	public bool IsModeSelected( Gamemode mode )
	{
		if( m_ModeSelection.ContainsKey( mode ) == false )
		{
			return false;
		}

		return m_ModeSelection[ mode ];
	}
示例#34
0
	void AddMapToQueue(string map, Gamemode mode)
	{
		MapQueueEntry newEntry = new MapQueueEntry
		{
			Name = map,
			Mode = mode,
		};

		m_MapQueue.Add( newEntry );
		UpdateGamesList();
	}
示例#35
0
	string GetGamemodeShortform( Gamemode mode )
	{
		switch( mode )
		{
		case Gamemode.Deathmatch:
			return "DM";
		case Gamemode.CaptureTheFlag:
			return "CTF";
		case Gamemode.TeamDeathmatch:
			return "TDM";
		}

		return "N/A";
	}
示例#36
0
	/// <summary>
	/// This function checks the current room for it's custom properties to see which game mode 
	/// is currently being played
	/// </summary>
	void FindCurrentMapMode()
	{
		//Check if we are actually connected to a room
		if( PhotonNetwork.room == null )
		{
			return;
		}

		MapQueueEntry map = MapQueue.GetCurrentMap();

		if( map.Equals( MapQueueEntry.None ) == false )
		{
			SelectedGamemode = map.Mode;
		}
	}
	void Update () {
		if (block != null) {
			//Call Reset
			if(previousGamemode != GamemodeManager.instance.Gamemode) {
				block.Reset();
			}
			previousGamemode = GamemodeManager.instance.Gamemode;
			
			//Call Update and InactiveUpdate
			if (GamemodeManager.instance.Gamemode == Gamemode.Design) {
				block.InactiveUpdate();
			} else {
				block.Update();
			}

			//Set rotation
			transform.parent.rotation = Quaternion.Euler(0, 90 * block.GetRotation(), 0);
		}
	}
示例#38
0
	// Update is called once per frame
	void Update () {

        if (gamemode == null)
        {
            var dump = GameObject.Find("Gamemode");
            if(dump != null)
            gamemode = dump.GetComponent<Gamemode>();
            return;
        }
          if (PlayerNetwork.localPlayer == null)
          {
              updateWeaponTexture(InventoryScript.WEAPON.noWeapon);
              return;
          }
          InventoryScript.WEAPON currentWeapon = PlayerNetwork.localPlayer.GetComponent<InventoryScript>().currentWeapon;
        if(currentWeapon != uiweapon)
            updateWeaponTexture(currentWeapon);
        lapText.GetComponent<Text>().text = "Lap:" + PlayerNetwork.localPlayer.GetComponent<Placement>().currentLap;
        int placement = gamemode.getPlacement(PlayerNetwork.localPlayer);
       
        placementText.GetComponent<Text>().text = placement + getPlacementString(placement);

        gamemode.checkGameFinish();
	}
示例#39
0
 public void SetGamemodeFFA()
 {
     m_gameMode = Gamemode.FFA;
 }
示例#40
0
 public void SetGamemodeTeams()
 {
     m_gameMode = Gamemode.TEAMS;
 }
	/// <summary>
	/// Set the gamemode
	/// </summary>
	/// <param name="gamemode">The gamemode to set</param>
	public void SetGamemode(Gamemode gamemode) {
		if (Gamemode != gamemode) {
			Gamemode = gamemode;
			//StartTransition();
		} else {
			Gamemode = gamemode;
		}
	}
示例#42
0
文件: Config.cs 项目: LiveMC/SharpMC
 public static Gamemode GetProperty(string property, Gamemode defaultValue)
 {
     return ReadGamemode(property, defaultValue);
 }
示例#43
0
	/// <summary>
	/// Retrieve any of the game mode components
	/// </summary>
	public GamemodeBase GetGamemode( Gamemode mode )
	{
		return m_Gamemodes[ (int)mode ];
	}
示例#44
0
	void DrawSelectModeArea()
	{
		GUILayout.Space( 5 );
		GUILayout.Label( "Selected Gamemode: " + m_SelectedMode, Styles.LabelSmall );

		for( int i = 0; i < ServerOptions.AvailableModes.Length; ++i )
		{
			bool isSelected = m_SelectedMode == ServerOptions.AvailableModes[ i ];
			bool newValue = GUILayout.Toggle( isSelected, ServerOptions.AvailableModes[ i ].ToString(), Styles.Toggle );

			if( newValue != isSelected )
			{
				m_SelectedMode = ServerOptions.AvailableModes[ i ];
			}
		}
	}
示例#45
0
        protected void SendData(byte[] data, Gamemode.Signature signature, bool direct = false)
        {
            var memory = new MemoryStream();
            var writer = new BinaryWriter(memory);

            writer.Write((byte) signature);
            writer.Write(data);

            Server.SendGameData(memory.ToArray(), direct);

            memory.Close();
            writer.Close();
        }
示例#46
0
 public void SetGamemode(Gamemode target)
 {
     SetGamemode(target, false);
 }
示例#47
0
        public void SetGamemode(Gamemode target, bool silent)
        {
            Gamemode = target;
            new PlayerListItem(Wrapper)
            {
                Action = 1,
                Gamemode = Gamemode,
                Uuid = Uuid
            }.Broadcast(Level);

            new ChangeGameState(Wrapper)
            {
                Reason = GameStateReason.ChangeGameMode,
                Value = (float) target
            }.Write();

            if (!silent)
            {
                ConsoleFunctions.WriteInfoLine(Username + "'s gamemode was changed to " + target.ToString("D"));
                SendChat("Your gamemode was changed to " + target.ToString(), ChatColor.Yellow);
            }
        }
示例#48
0
文件: Config.cs 项目: LiveMC/SharpMC
 private static Gamemode ReadGamemode(string rule, Gamemode Default)
 {
     try
     {
         var gm = ReadString(rule);
         switch (gm)
         {
             case "1":
             case "creative":
                 return Gamemode.Creative;
             case "0":
             case "survival":
                 return Gamemode.Survival;
             case "2":
             case "adventure":
                 return Gamemode.Adventure;
             default:
                 return Default;
         }
     }
     catch
     {
         return Default;
     }
 }
示例#49
0
	/// <summary>
	/// Chages what map will be played for the round will be
	/// </summary>
	/// <param name="b"></param>
	public void ChangeGametype(bool gametypeBool)
	{
		if (gametypeBool)
		{
			if (m_ModeCount < ServerOptions.AvailableModes.Length)
			{
				m_ModeCount++;
				if (m_ModeCount > (ServerOptions.AvailableModes.Length - 1))
				{
					m_ModeCount = 0;
				}
			}
		}
		else
		{
			if (m_ModeCount < ServerOptions.AvailableModes.Length)
			{
				m_ModeCount--;
				if (m_ModeCount < 0)
				{
					m_ModeCount = ServerOptions.AvailableModes.Length - 1;
				}
			}
		}
		m_SelectedMode = ServerOptions.AvailableModes[m_ModeCount];
		MapNameText.text = "Mode: "+  m_SelectedMode.ToString();
	}