예제 #1
0
 private void OnGameModeChanged(Game.GameMode mode)
 {
     if (mode == Game.GameMode.Run)
     {
         if (isMoving)
         {
             Release();
         }
     }
 }
예제 #2
0
    public void DownloadHighscores(int topScoreCount, Game.GameMode mode)
    {
        switch (mode)
        {
        case Game.GameMode.TimeAttack:
            StartCoroutine(DownloadCoroutine(topScoreCount, TimeAttack.DomainApiUrl));
            break;

        case Game.GameMode.ScoreAttack:
            StartCoroutine(DownloadCoroutine(topScoreCount, ScoreAttack.DomainApiUrl));
            break;
        }
    }
예제 #3
0
    public void UploadScore(string playerName, Game.GameMode mode)
    {
        var onlineScore = new OnlineScore()
        {
            PlayerName = playerName,
            Score      = Score,
            Time       = Mathf.RoundToInt(RealTimePassed)
        };

        switch (mode)
        {
        case Game.GameMode.TimeAttack:
            StartCoroutine(UploadCoroutine(onlineScore, TimeAttack.DomainApiUrl));
            break;

        case Game.GameMode.ScoreAttack:
            StartCoroutine(UploadCoroutine(onlineScore, ScoreAttack.DomainApiUrl));
            break;
        }
    }
예제 #4
0
    public void ChangeControlMode(Game.GameMode newGameMode)
    {
        if (!_dead)
        {
            switch (newGameMode)
            {
            case Game.GameMode.Fly:
                _myMovement.ChangeControlMode(ControlMode.Fly);
                ControlModeChanged("Fly");
                break;

            case Game.GameMode.Tap:
                _myMovement.ChangeControlMode(ControlMode.Tap);
                ControlModeChanged("Tap");
                break;

            default:
                break;
            }
        }
    }
예제 #5
0
        // load game completed
        void _worker_LoadGameCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            _empire = GnomanEmpire.Instance;
            _dirty = false;
            //lblSaveGameTitle.Content = _empire.World.AIDirector.PlayerFaction.Name;
            Dictionary<uint, Faction> factions = _empire.World.AIDirector.Factions;
            foreach (KeyValuePair<uint,Faction> faction in factions)
            {
                if (faction.Value.ID == Game.Faction.PlayerFactionID)
                    lblSaveGameTitle.Content = faction.Value.Name;
            }

            _savedDifficulty = (Game.GameMode)_empire.World.GameMode;
            cmbDifficulty.SelectedItem = _savedDifficulty;

            _worker.DoWork -= new DoWorkEventHandler(_worker_LoadGame);
            _worker.RunWorkerCompleted -= new RunWorkerCompletedEventHandler(_worker_LoadGameCompleted);
            EnableState();
        }
예제 #6
0
 public static void SetGameMode(Game.GameMode mode)
 {
     Instance.CurrentGameMode = mode;
 }
 void SetModeFromGameMode(Game.GameMode gameMode)
 {
     SetMode(gameMode == Game.GameMode.Build ? Mode.Neutral : Mode.Inactive);
 }
예제 #8
0
        public static void moveInventory(IInventory a, IInventory b, ComponentPlayer player, GameMode mode)
        {
            bool remo = false;

            for (int i = 0; i < a.SlotsCount; i++)
            {         //遍历目标物品
                if (a.GetSlotCount(i) > 0)
                {     //该格有物品
                    for (int k = 0; k < b.SlotsCount; k++)
                    { //遍历背包
                        if ((b.GetSlotCount(k) == 0 || b.GetSlotValue(k) == a.GetSlotValue(i)))
                        {
                            //背包该格为空或者物品相同
                            //能够转移的数量
                            int needmovecnt = b.GetSlotCapacity(i, a.GetSlotValue(i)) - b.GetSlotCount(k);
                            //总共的转移数量
                            int allmovecnt = a.GetSlotCount(i);
                            if (needmovecnt >= allmovecnt)
                            {
                                needmovecnt = allmovecnt;
                            }
                            if (needmovecnt == 0)
                            {
                                i -= 1; continue;
                            }
                            else
                            {
                                if (mode != GameMode.Creative)
                                {
                                    b.AddSlotItems(k, a.GetSlotValue(i), needmovecnt);
                                }
                                a.RemoveSlotItems(i, needmovecnt);
                            }
                        }
                    }
                }
            }
            if (remo)
            {
                player.ComponentGui.DisplaySmallMessage("一键转移成功", Color.Red, false, false);
            }
            else
            {
                player.ComponentGui.DisplaySmallMessage("没有需要转移的物品呢", Color.Red, false, false);
            }
        }