Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        playerClass = alice.GetComponent<Player>();

        gameMainClass = gameMain.GetComponent<GameMain>();
        GetComponent<Text>().color = new Color(1.0f, 0.0f, 0.0f, 0.5f);
    }
Exemplo n.º 2
0
 public TextHandler(GameMain.GetWindowSizeDelegate windowSizeDelegate)
 {
     _windowSizeDelegate = windowSizeDelegate;
     _random = new Random();
     Waiting = true;
     Counting = false;
 }
Exemplo n.º 3
0
        public bool Initialize(GameMain gameMain, out string reason)
        {
            if (!this.Initialize(gameMain.ScreenWidth / 2 - 230, gameMain.ScreenHeight / 2 - 180, 460, 360, StretchableImageType.MediumBorder, gameMain, false, gameMain.Random, out reason))
            {
                return false;
            }

            _discoveredTechs = new List<Technology>();
            _fieldsNeedingNewTopics = new List<TechField>();
            _availableTopics = new Dictionary<TechField, List<Technology>>();

            _techDescriptionBackground = new BBStretchableImage();
            _availableTechsToResearchBackground = new BBStretchableImage();
            _instructionLabel = new BBLabel();
            _techDescription = new BBTextBox();
            _scrollBar = new BBScrollBar();
            _availableTechsToResearchButtons = new BBInvisibleStretchButton[4];
            _researchCosts = new BBLabel[4];

            if (!_techDescriptionBackground.Initialize(_xPos + 20, _yPos + 20, 420, 170, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_availableTechsToResearchBackground.Initialize(_xPos + 20, _yPos + 220, 420, 120, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_instructionLabel.Initialize(_xPos + 20, _yPos + 195, "Please select an item to research", System.Drawing.Color.White, out reason))
            {
                return false;
            }
            if (!_techDescription.Initialize(_xPos + 165, _yPos + 33, 265, 150, true, true, "TechDescriptionTextBox", gameMain.Random, out reason))
            {
                return false;
            }
            if (!_scrollBar.Initialize(_xPos + 415, _yPos + 230, 100, 4, 4, false, false, gameMain.Random, out reason))
            {
                return false;
            }
            for (int i = 0; i < _availableTechsToResearchButtons.Length; i++)
            {
                _availableTechsToResearchButtons[i] = new BBInvisibleStretchButton();
                _researchCosts[i] = new BBLabel();
                if (!_availableTechsToResearchButtons[i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, _xPos + 30, _yPos + 230 + (i * 25), 385, 25, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_availableTechsToResearchButtons[i].SetToolTip("ItemToResearch" + i + "ToolTip", string.Empty, gameMain.ScreenWidth, gameMain.ScreenHeight, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_researchCosts[i].Initialize(_xPos + 405, _yPos + 232 + (i * 25), string.Empty, System.Drawing.Color.White, out reason))
                {
                    return false;
                }
                _researchCosts[i].SetAlignment(true);
            }

            return true;
        }
Exemplo n.º 4
0
    private void Start()
    {
        Instance = this;
        FutileParams fparams = new FutileParams(true, true, true, true);
        fparams.AddResolutionLevel(800.0f, 1.0f, 1.0f, "");
        fparams.origin = new Vector2(0.0f, 0.0f);
        Futile.instance.Init(fparams);

        // Clearly game assets must be put into an atlas as some point,
        // but for testing purposes I just load each image I need.
        Futile.atlasManager.LoadImage("grasstile");
        Futile.atlasManager.LoadImage("foresttile");
        Futile.atlasManager.LoadImage("evilsoldier");
        Futile.atlasManager.LoadImage("goodsoldier");
        Futile.atlasManager.LoadImage("bluehighlight");
        Futile.atlasManager.LoadImage("redhighlight");
        Futile.atlasManager.LoadImage("phaser");
        Futile.atlasManager.LoadImage("doublebluehighlight");
        Futile.atlasManager.LoadImage("attack");
        Futile.atlasManager.LoadImage("defend");
        Futile.atlasManager.LoadImage("wait");
        Futile.atlasManager.LoadImage("cancel");
        Futile.atlasManager.LoadImage("useitem");
        Futile.atlasManager.LoadImage("move");
        Futile.atlasManager.LoadImage("useitem");
        Futile.atlasManager.LoadImage("crosshair");

        GoToPage(GamePageType.MissionPage);
    }
Exemplo n.º 5
0
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		public static void Main(string[] args)
		{
			string error = null;
			GameMain main = null;
			if (Debugger.IsAttached)
			{
				main = new GameMain();
				try
				{
					main.Run();
				}
				catch (GameMain.ExitException)
				{

				}
			}
			else
			{
				try
				{
					main = new GameMain();
					main.Run();
				}
				catch (Exception e)
				{
					if (!(e is GameMain.ExitException))
						error = e.ToString();
				}
			}
			if (main != null)
				main.Cleanup();
#if ANALYTICS
			if (main.MapFile.Value == null || main.EditorEnabled)
				main.SessionRecorder.Reset();
			if (error == null)
				main.SessionRecorder.RecordEvent("Exit");
			else
				main.SessionRecorder.RecordEvent("Crash", error);
			main.SaveAnalytics();

#if MONOGAME
			// TODO: MonoGame analytics form
#else
			System.Windows.Forms.Application.EnableVisualStyles();
			AnalyticsForm analyticsForm = new AnalyticsForm(main, error);
			System.Windows.Forms.Application.Run(analyticsForm);
#endif
#else
#if MONOGAME
			// TODO: MonoGame error form
#else
			if (error != null)
			{
				System.Windows.Forms.Application.EnableVisualStyles();
				ErrorForm errorForm = new ErrorForm(error);
				System.Windows.Forms.Application.Run(errorForm);
			}
#endif
#endif
		}
Exemplo n.º 6
0
 void Awake()
 {
     gm = GameObject.FindGameObjectWithTag ("GameMain").GetComponent<GameMain> ();
     Rig = this.GetComponent<Rigidbody2D> ();
     arrayObject = this.transform.FindChild ("array").gameObject;
     arrayObject.SetActive (false);
 }
Exemplo n.º 7
0
        public BaseGameState(Game game, GameStateManager manager)
            : base(game, manager)
        {
            gameRef = (GameMain)game;

            playerIndexInControl = PlayerIndex.One;
        }
Exemplo n.º 8
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 private static void Main(string[] args)
 {
     //Create and run the GameMain
     using (GameMain game = new GameMain())
     {
         game.Run();
     }
 }
Exemplo n.º 9
0
 public Line(float thickness, GameMain.GetWindowSizeDelegate windowSizeDelegate)
 {
     Thickness = thickness;
     _randThickness = thickness;
     this._windowSizeDelegate = windowSizeDelegate;
     Vector2 windowSize = windowSizeDelegate();
     Pos1 = new Vector2(windowSize.X / 2, 0);
 }
Exemplo n.º 10
0
        public bool Initialize(GameMain gameMain, out string reason)
        {
            _gameMain = gameMain;

            if (!base.Initialize((gameMain.ScreenWidth / 2) - 320, (gameMain.ScreenHeight / 2) - 320, 640, 640, StretchableImageType.MediumBorder, gameMain, false, gameMain.Random, out reason))
            {
                return false;
            }
            _randomSprite = SpriteManager.GetSprite("RandomRace", gameMain.Random);
            if (_randomSprite == null)
            {
                reason = "RandomRace sprite does not exist.";
                return false;
            }

            _raceButtons = new BBStretchButton[15];
            _raceScrollBar = new BBScrollBar();
            _raceBackground = new BBStretchableImage();
            _raceDescription = new BBTextBox();
            _okButton = new BBStretchButton();
            _raceManager = gameMain.RaceManager;

            for (int i = 0; i < _raceButtons.Length; i++)
            {
                _raceButtons[i] = new BBStretchButton();
                if (!_raceButtons[i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 10, _yPos + 10 + (i * 40), 280, 40, gameMain.Random, out reason))
                {
                    return false;
                }
            }
            //Add 1 for the random race option
            int scrollValue = (_raceManager.Races.Count + 1) < _raceButtons.Length ? _raceButtons.Length : (_raceManager.Races.Count + 1);
            if (!_raceScrollBar.Initialize(_xPos + 290, _yPos + 10, 600, _raceButtons.Length, scrollValue, false, false, gameMain.Random, out reason))
            {
                return false;
            }
            _maxVisible = (_raceManager.Races.Count + 1) > _raceButtons.Length ? _raceButtons.Length : (_raceManager.Races.Count + 1);
            if (_raceManager.Races.Count < 15)
            {
                _raceScrollBar.SetEnabledState(false);
            }
            if (!_raceBackground.Initialize(_xPos + 310, _yPos + 10, 310, 550, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_raceDescription.Initialize(_xPos + 315, _yPos + 325, 300, 215, true, true, "RaceSelectionDescriptionTextBox", gameMain.Random, out reason))
            {
                return false;
            }
            if (!_okButton.Initialize("Select Race", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 310, _yPos + 570, 310, 40, gameMain.Random, out reason))
            {
                return false;
            }
            RefreshRaceLabels();
            RefreshRaceDescription();
            reason = null;
            return true;
        }
Exemplo n.º 11
0
        public bool Initialize(GameMain gameMain, out string reason)
        {
            if (!this.Initialize(gameMain.ScreenWidth / 2 - 200, gameMain.ScreenHeight / 2 - 300, 400, 250, StretchableImageType.MediumBorder, gameMain, false, gameMain.Random, out reason))
            {
                return false;
            }

            _shipButtons = new BBStretchButton[4];
            for (int i = 0; i < _shipButtons.Length; i++)
            {
                _shipButtons[i] = new BBStretchButton();
                if (!_shipButtons[i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 20, _yPos + 60, 200, 40, gameMain.Random, out reason))
                {
                    return false;
                }
            }
            _instructionLabel = new BBLabel();
            _systemNameLabel = new BBLabel();
            _cancelButton = new BBButton();
            _colonizeButton = new BBButton();
            _groundViewBackground = new BBStretchableImage();
            _nameBackground = new BBStretchableImage();
            _nameTextBox = new BBSingleLineTextBox();

            if (!_instructionLabel.Initialize(_xPos + 20, _yPos + 25, "Select a ship to colonize this planet", Color.White, out reason))
            {
                return false;
            }
            if (!_systemNameLabel.Initialize(_xPos + 300, _yPos + 130, string.Empty, Color.White, out reason))
            {
                return false;
            }
            if (!_cancelButton.Initialize("CancelColonizeBG", "CancelColonizeFG", string.Empty, ButtonTextAlignment.LEFT, _xPos + 230, _yPos + 195, 75, 35, gameMain.Random, out reason))
            {
                return false;
            }

            if (!_colonizeButton.Initialize("TransferToBG", "TransferToFG", string.Empty, ButtonTextAlignment.LEFT, _xPos + 310, _yPos + 195, 75, 35, gameMain.Random, out reason))
            {
                return false;
            }

            if (!_nameBackground.Initialize(gameMain.ScreenWidth / 2 - 100, gameMain.ScreenHeight / 2 - 40, 200, 80, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_nameTextBox.Initialize(string.Empty, gameMain.ScreenWidth / 2 - 80, gameMain.ScreenHeight / 2 - 20, 160, 40, false, gameMain.Random, out reason))
            {
                return false;
            }
            if (!_groundViewBackground.Initialize(gameMain.ScreenWidth / 2 - 440, gameMain.ScreenHeight / 2 - 340, 880, 680, StretchableImageType.ThickBorder, gameMain.Random, out reason))
            {
                return false;
            }
            _colonizing = false;

            return true;
        }
Exemplo n.º 12
0
        //List<Contact> empiresInContact;
        /*ScrollBar empireScrollBar;
        ScrollBar[] spyEffortScrollbars;
        ScrollBar[] spyDefenseScrollbars;
        Button[] empireButtons;
        Label[] relationLabels;
        Label[] empireNameLabels;
        BBSprite[] avatars;
        BBSprite profile;
        int whichContactSelected;
        Button[] messageOptions;
        ComboBox listOfEmpires;
        List<SpriteName> spriteNames;
        private bool isViewingReceivedMessage;
        private int whichMessageToSend;
        private List<Empire> adjustedEmpiresForSelection;
        private Button[] incomingMessages;
        private Label IncomingMessageTextBox; //Replace with real text box when it's implemented

        int maxVisible;
        int x;
        int y;*/
        public bool Initialize(GameMain gameMain, out string reason)
        {
            this.gameMain = gameMain;
            /*x = (gameMain.ScreenWidth / 2) - 400;
            y = (gameMain.ScreenHeight / 2) - 300;
            empireButtons = new Button[4];
            spyEffortScrollbars = new ScrollBar[4];
            spyDefenseScrollbars = new ScrollBar[4];
            for (int i = 0; i < empireButtons.Length; i++)
            {
                empireButtons[i] = new Button(SpriteName.NormalBackgroundButton, SpriteName.NormalForegroundButton, string.Empty, x, y + (150 * i), 384, 150);
                spyEffortScrollbars[i] = new ScrollBar(x + 145, y + 45 + (150 * i), 16, 174, 1, 101, true, true, SpriteName.ScrollLeftBackgroundButton, SpriteName.ScrollLeftForegroundButton,
                    SpriteName.ScrollRightBackgroundButton, SpriteName.ScrollRightForegroundButton, SpriteName.SliderHorizontalBackgroundButton, SpriteName.SliderHorizontalForegroundButton,
                    SpriteName.SliderHorizontalBar, SpriteName.SliderHighlightedHorizontalBar);
                spyDefenseScrollbars[i] = new ScrollBar(x + 145, y + 85 + (150 * i), 16, 174, 1, 101, true, true, SpriteName.ScrollLeftBackgroundButton, SpriteName.ScrollLeftForegroundButton,
                    SpriteName.ScrollRightBackgroundButton, SpriteName.ScrollRightForegroundButton, SpriteName.SliderHorizontalBackgroundButton, SpriteName.SliderHorizontalForegroundButton,
                    SpriteName.SliderHorizontalBar, SpriteName.SliderHighlightedHorizontalBar);
            }
            empireScrollBar = new ScrollBar(x + 384, y, 16, 568, 4, 10, false, false, SpriteName.ScrollUpBackgroundButton, SpriteName.ScrollUpForegroundButton, SpriteName.ScrollDownBackgroundButton,
                SpriteName.ScrollDownForegroundButton, SpriteName.ScrollVerticalBackgroundButton, SpriteName.ScrollVerticalForegroundButton, SpriteName.ScrollVerticalBar, SpriteName.ScrollVerticalBar);

            incomingMessages = new Button[4];
            for (int i = 0; i < incomingMessages.Length; i++)
            {
                incomingMessages[i] = new Button(SpriteName.IncomingMessageBackground, SpriteName.IncomingMessageForeground, string.Empty, x + 98, y + 98 + (150 * i), 40, 40);
            }
            IncomingMessageTextBox = new Label(x + 405, y + 320);

            messageOptions = new Button[10];
            messageOptions[TRADE] = new Button(SpriteName.MiniBackgroundButton, SpriteName.MiniForegroundButton, "Trade", x + 405, y + 320, 190, 25);
            messageOptions[RESEARCH] = new Button(SpriteName.MiniBackgroundButton, SpriteName.MiniForegroundButton, "Research", x + 605, y + 320, 190, 25);
            messageOptions[ALLY] = new Button(SpriteName.MiniBackgroundButton, SpriteName.MiniForegroundButton, "Ally", x + 405, y + 350, 190, 25);
            messageOptions[UNALLY] = new Button(SpriteName.MiniBackgroundButton, SpriteName.MiniForegroundButton, "Unally", x + 605, y + 350, 190, 25);
            messageOptions[HARASS] = new Button(SpriteName.MiniBackgroundButton, SpriteName.MiniForegroundButton, "Harass Selected Empire", x + 405, y + 410, 190, 25);
            messageOptions[RECONCILE] = new Button(SpriteName.MiniBackgroundButton, SpriteName.MiniForegroundButton, "Reconcile Selected Empire", x + 605, y + 410, 190, 25);
            messageOptions[WAR] = new Button(SpriteName.MiniBackgroundButton, SpriteName.MiniForegroundButton, "War", x + 505, y + 500, 190, 25);
            messageOptions[SEND] = new Button(SpriteName.MiniBackgroundButton, SpriteName.MiniForegroundButton, "Send Message", x + 505, y + 570, 190, 25);
            messageOptions[ACCEPT] = new Button(SpriteName.MiniBackgroundButton, SpriteName.MiniForegroundButton, "Accept", x + 405, y + 570, 190, 25);
            messageOptions[REJECT] = new Button(SpriteName.MiniBackgroundButton, SpriteName.MiniForegroundButton, "Decline", x + 605, y + 570, 190, 25);
            whichContactSelected = -1;
            isViewingReceivedMessage = false;

            spriteNames = new List<SpriteName>();
            spriteNames.Add(SpriteName.MiniBackgroundButton);
            spriteNames.Add(SpriteName.MiniForegroundButton);
            spriteNames.Add(SpriteName.ScrollUpBackgroundButton);
            spriteNames.Add(SpriteName.ScrollUpForegroundButton);
            spriteNames.Add(SpriteName.ScrollVerticalBar);
            spriteNames.Add(SpriteName.ScrollDownBackgroundButton);
            spriteNames.Add(SpriteName.ScrollDownForegroundButton);
            spriteNames.Add(SpriteName.ScrollVerticalBackgroundButton);
            spriteNames.Add(SpriteName.ScrollVerticalForegroundButton);
            whichMessageToSend = -1;*/

            reason = null;
            return true;
        }
Exemplo n.º 13
0
 public ParticleEngine(Texture2D texture, Texture2D lightMapTexture, GameMain.GetWindowSizeDelegate windowSizeDelegate, GameMain.GetScaleDelegate scaleDelegate)
 {
     _windowSizeDelegate = windowSizeDelegate;
     _scaleDelegate = scaleDelegate;
     _texture = texture;
     _lightMapTexture = lightMapTexture;
     _particles = new List<Particle>();
     _random = new Random();
 }
Exemplo n.º 14
0
        static void Main(string[] args)
        {
            GameContextConsole gCtx = new GameContextConsole();

            Dictionary<string, object> wfArgs = new Dictionary<string, object>();
            wfArgs.Add("ctx", gCtx);

            Activity workflow1 = new GameMain();
            WorkflowInvoker.Invoke(workflow1,wfArgs);
        }
Exemplo n.º 15
0
 void Awake()
 {
     objectNameArray = new string[]{"Player", "FallingOnes", "FallingOnes2"};
     startPosition = new Vector3 (0, 0, 0);
     startObjectPosition = new Vector3 (0, 6, 0);
     objectList = new List<GameObject>();
     getObjectList ();
     enemys = GameObject.FindGameObjectWithTag("Enemys");
     gm = GameObject.FindGameObjectWithTag ("GameMain").GetComponent<GameMain> ();
 }
Exemplo n.º 16
0
 public static GameMain Instance()
 {
     if( !instance )
     {
         container = new GameObject();
         container.name = "GameMain";
         instance = container.AddComponent(typeof(GameMain)) as GameMain;
     }
     return instance;
 }
Exemplo n.º 17
0
        public bool Initialize(GameMain gameMain, out string reason)
        {
            _gameMain = gameMain;

            _energyX = (_gameMain.ScreenSize.X / 2) - 190;
            _shipStatsBackground = new BBStretchableImage();
            _miniMapBackground = new BBStretchableImage();
            if (!_shipStatsBackground.Initialize((_gameMain.ScreenSize.X / 2) - 200, -20, 400, 90, StretchableImageType.ThinBorderBG, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_miniMapBackground.Initialize(_gameMain.ScreenSize.X - 250, _gameMain.ScreenSize.Y - 250, 300, 300, StretchableImageType.ThinBorderBG, _gameMain.Random, out reason))
            {
                return false;
            }

            _bankAmount = new BBLabel();
            _energyAmount = new BBLabel();

            if (!_bankAmount.Initialize(_energyX, 40, string.Empty, Color.White, out reason))
            {
                return false;
            }
            if (!_energyAmount.Initialize(_energyX + 380, 40, string.Empty, Color.White, out reason))
            {
                return false;
            }
            _energyAmount.SetAlignment(true);

            _horizontalEnergyBar = SpriteManager.GetSprite("ScrollHorizontalBar", gameMain.Random);
            if (_horizontalEnergyBar == null)
            {
                reason = "ScrollHorizontalBar sprite not found";
                return false;
            }

            /*_debuggingText = new BBTextBox();
            if (!_debuggingText.Initialize(0, 0, 300, 300, true, false, "DebugText", gameMain.Random, out reason))
            {
                return false;
            }*/

            _miniMapTarget = new RenderImage("MiniMapRender", 230, 230, ImageBufferFormats.BufferRGB888A8);
            _miniMapTarget.BlendingMode = BlendingModes.Modulated;

            _dot = SpriteManager.GetSprite("BackgroundStar", _gameMain.Random);
            if (_dot == null)
            {
                reason = "Star sprite doesn't exist.";
                return false;
            }
            _delay = 0;
            return true;
        }
Exemplo n.º 18
0
    // Use this for initialization
    void Start()
    {
        count = 0;
        rotRimit = 118.0f;
        rimitTime = 50;
        gameMainClass = gameMain.GetComponent<GameMain>();
        //ターン数上限を取得
        rimitTime = gameMainClass.stageTurnNum;

        //回転の限界を、ターン数で÷
        rotNum = (float)rotRimit / (float)rimitTime;
    }
Exemplo n.º 19
0
 static void Main()
 {
     bool editorMode = false;
       if(editorMode){
     editor = new Editor();
     editor.Run();
       }
       else{
     game = new GameMain ();
     game.Run ();
       }
 }
Exemplo n.º 20
0
 void Start()
 {
     if(Application.platform == RuntimePlatform.Android){
         Destroy(gameObject);
     }
     pv = transform.GetComponent<PhotonView>();
     gameMain = GameObject.Find("GameMain").GetComponent<GameMain>();
     pv.observed = this;
     if(pv.isMine){
         //transform.FindChild("Camera").gameObject.SetActive(true);
     }
     transform.parent = GameObject.Find("GameMain").transform;
     curRot = transform.rotation;
 }
Exemplo n.º 21
0
        public bool Initialize(GameMain gameMain, out string reason)
        {
            if (!this.Initialize((gameMain.ScreenWidth / 2) - 200, (gameMain.ScreenHeight / 2) - 200, 400, 100, StretchableImageType.MediumBorder, gameMain, false, gameMain.Random, out reason))
            {
                return false;
            }

            _informationText = new BBLabel();
            if (!_informationText.Initialize((gameMain.ScreenWidth / 2), (gameMain.ScreenHeight / 2) - 150, string.Empty, Color.White, out reason))
            {
                return false;
            }
            return true;
        }
Exemplo n.º 22
0
        public static void Initialize(GameMain game)
        {
            m_game = game;
            m_game.Exiting += (s, e) => Exit();

            if (!Directory.Exists("Logs")) Directory.CreateDirectory("Logs");
            m_sr = File.CreateText("Logs/" + GetNewLogName());
            m_sr.AutoFlush = true;

            m_debugThread = new Thread(UpdateStatus);
            m_debugThread.Start();

            System.Windows.Forms.Form form = (System.Windows.Forms.Form)System.Windows.Forms.Control.FromHandle(m_game.Window.Handle);
            form.Activate();
        }
Exemplo n.º 23
0
        public bool Initialize(GameMain gameMain, out string reason)
        {
            _gameMain = gameMain;

            _chatBackground = new BBStretchableImage();
            _playerListBackground = new BBStretchableImage();
            _chatText = new BBTextBox();
            _messageTextBox = new BBSingleLineTextBox();
            _playerList = new BBTextBox();
            _startGame = new BBStretchButton();
            _leaveLobby = new BBStretchButton();

            int chatWidth = _gameMain.ScreenSize.X - 250;
            int chatHeight = _gameMain.ScreenSize.Y - 80;

            if (!_chatBackground.Initialize(20, 20, chatWidth, chatHeight, StretchableImageType.ThinBorderBG, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_chatText.Initialize(25, 25, chatWidth - 10, chatHeight - 10, true, true, "PreGameChatTextBox", _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_messageTextBox.Initialize("Chat Message", 20, 20 + chatHeight, chatWidth, 40, false, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_playerListBackground.Initialize(chatWidth + 30, 20, 200, chatHeight - 45, StretchableImageType.ThinBorderBG, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_playerList.Initialize(chatWidth + 35, 25, 190, chatHeight - 255, false, true, "PlayerListTextBox", _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_startGame.Initialize("Start Game", ButtonTextAlignment.CENTER, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, chatWidth + 30, chatHeight - 15, 200, 35, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_leaveLobby.Initialize("Leave", ButtonTextAlignment.CENTER, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, chatWidth + 30, chatHeight + 25, 200, 35, _gameMain.Random, out reason))
            {
                return false;
            }
            _messageTextBox.Select();

            return true;
        }
Exemplo n.º 24
0
    // Use this for initialization
    void Awake()
    {
        mGM = GameMain.Singleton;
        mGM.TimeNormalScene = TimeNormalScene;
        mGM.GameSpeed = GameSpeed;
        Time.timeScale = GameSpeed;
        mGM.OneKillDie = OneKillDie;

        mGM.ScenePreludeMgr.IsRandomPrelude = Prelude_IsRandom;
        mGM.ScenePreludeMgr.PreludeIdxStart = Prelude_StartIdx;

        //GameOdds.RatioGet_Lizi = RatioGet_Lizi;
        mGunLiziGettor = FindObjectOfType(typeof(GunLiziGettorMain)) as GunLiziGettorMain;
        if (mGunLiziGettor != null)
            mGunLiziGettor.LiziRatio = RatioGet_Lizi;

        mGM.FishGenerator.IsGenerate = FishGenerate_IsEmitFish;
    }
Exemplo n.º 25
0
        /*private Label title;
        private Button[] buttons;
        private ScrollBar scrollBar;
        private int topIndex;
        private bool isVisible;*/
        public SituationReport(GameMain gameMain)
        {
            this.gameMain = gameMain;

            /*int x = (gameMain.ScreenWidth / 2) - 400;
            int y = (gameMain.ScreenHeight / 2) - 300;

            buttons = new Button[AMOUNT_VISIBLE];
            for (int i = 0; i < buttons.Length; i++)
            {
                buttons[i] = new Button(SpriteName.NormalBackgroundButton, SpriteName.NormalForegroundButton, string.Empty, x + 5, y + 35 + (i * 40), 775, 40);
            }
            scrollBar = new ScrollBar(x + 780, y + 25, 16, 574, AMOUNT_VISIBLE, AMOUNT_VISIBLE, false, false, SpriteName.ScrollUpBackgroundButton, SpriteName.ScrollUpForegroundButton,
                SpriteName.ScrollDownBackgroundButton, SpriteName.ScrollDownForegroundButton, SpriteName.ScrollVerticalBackgroundButton, SpriteName.ScrollVerticalForegroundButton,
                SpriteName.ScrollVerticalBar, SpriteName.ScrollVerticalBar);
            topIndex = 0;
            isVisible = false;
            title = new Label("Situation Report", x + 5, y + 5);*/
        }
Exemplo n.º 26
0
        public bool Initialize(int x, int y, int width, int height, StretchableImageType backgroundImage, GameMain gameMain, bool moveable, Random r, out string reason)
        {
            _xPos = x;
            _yPos = y;
            _windowWidth = width;
            _windowHeight = height;
            this._moveable = moveable;

            _moving = false;
            _gameMain = gameMain;

            _backGroundImage = new BBStretchableImage();
            if (!_backGroundImage.Initialize(x, y, width, height, backgroundImage, r, out reason))
            {
                return false;
            }
            reason = null;
            return true;
        }
Exemplo n.º 27
0
        public bool Initialize(GameMain gameMain, out string reason)
        {
            _middleX = gameMain.ScreenWidth / 2;
            _middleY = gameMain.ScreenHeight / 2;
            if (!base.Initialize((gameMain.ScreenWidth / 2) - 210, (gameMain.ScreenHeight / 2) - 230, 420, 460, StretchableImageType.ThinBorderBG, gameMain, false, gameMain.Random, out reason))
            {
                return false;
            }

            _buttons = new BBStretchButton[10];
            _columnValues = new List<BBLabel[]>();
            _columnNames = new List<BBLabel>();
            _maxVisible = 0;

            for (int i = 0; i < 10; i++)
            {
                _buttons[i] = new BBStretchButton();
                if (!_buttons[i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, _xPos + 10, _yPos + 50 + i * 40, 380, 40, gameMain.Random, out reason))
                {
                    return false;
                }
                if (!_buttons[i].SetToolTip("EquipmentSelection" + i, string.Empty, gameMain.ScreenWidth, gameMain.ScreenHeight, gameMain.Random, out reason))
                {
                    return false;
                }
            }
            _scrollBar = new BBScrollBar();
            if (!_scrollBar.Initialize(_xPos + 390, _yPos + 50, 400, 10, 10, false, false, gameMain.Random, out reason))
            {
                return false;
            }
            _maxVisible = 0;
            _numOfColumnsVisible = 0;
            _scrollBarVisible = false;
            return true;
        }
Exemplo n.º 28
0
 void Awake()
 {
     instance = this;
 }
Exemplo n.º 29
0
 void Start()
 {
     _main = GameObject.FindWithTag("GameMain").GetComponent <GameMain>();
     InitScene(_main.User);
 }
Exemplo n.º 30
0
 public ZhiboBuffManager(ZhiboGameMode gameMode)
 {
     this.gameMode = gameMode;
     mResLoader    = GameMain.GetInstance().GetModule <ResLoader>();
     LoadBuff();
 }
    private void Start()
    {
        Instance = this;

        this.GameInit();
    }
 void Awake()
 {
     _gameMain = this;
 }
Exemplo n.º 33
0
        public bool Initialize(GameMain gameMain, out string reason)
        {
            int x = (gameMain.ScreenWidth / 2) - 400;
            int y = (gameMain.ScreenHeight / 2) - 300;

            if (!base.Initialize(x, y, 800, 600, StretchableImageType.MediumBorder, gameMain, false, gameMain.Random, out reason))
            {
                return(false);
            }

            _fieldsBackground         = new BBStretchableImage();
            _technologyListBackground = new BBStretchableImage();
            if (!_fieldsBackground.Initialize(x + 20, y + 20, 760, 230, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_technologyListBackground.Initialize(x + 20, y + 300, 760, 280, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return(false);
            }

            _techFieldLabels = new BBLabel[6];
            _techNamesBeingResearchedLabels = new BBLabel[6];
            _techProgressLabels             = new BBLabel[6];
            _techSliders     = new BBScrollBar[6];
            _techLockButtons = new BBButton[6];
            for (int i = 0; i < 6; i++)
            {
                _techFieldLabels[i] = new BBLabel();
                _techNamesBeingResearchedLabels[i] = new BBLabel();
                _techProgressLabels[i]             = new BBLabel();
                _techSliders[i]     = new BBScrollBar();
                _techLockButtons[i] = new BBButton();
            }
            _totalResearchPointsLabel = new BBLabel();

            if (!_techFieldLabels[0].Initialize(x + 135, y + 35, "Computers:", System.Drawing.Color.White, out reason))
            {
                return(false);
            }
            if (!_techFieldLabels[1].Initialize(x + 135, y + 65, "Construction:", System.Drawing.Color.White, out reason))
            {
                return(false);
            }
            if (!_techFieldLabels[2].Initialize(x + 135, y + 95, "Force Fields:", System.Drawing.Color.White, out reason))
            {
                return(false);
            }
            if (!_techFieldLabels[3].Initialize(x + 135, y + 125, "Planetology:", System.Drawing.Color.White, out reason))
            {
                return(false);
            }
            if (!_techFieldLabels[4].Initialize(x + 135, y + 155, "Propulsion:", System.Drawing.Color.White, out reason))
            {
                return(false);
            }
            if (!_techFieldLabels[5].Initialize(x + 135, y + 185, "Weapons:", System.Drawing.Color.White, out reason))
            {
                return(false);
            }

            for (int i = 0; i < 6; i++)
            {
                _techFieldLabels[i].SetAlignment(true);
                if (!_techNamesBeingResearchedLabels[i].Initialize(x + 140, y + 35 + (i * 30), "None", System.Drawing.Color.White, out reason))
                {
                    return(false);
                }
                if (!_techProgressLabels[i].Initialize(x + 545, y + 35 + (i * 30), "N/A", System.Drawing.Color.White, out reason))
                {
                    return(false);
                }
                _techProgressLabels[i].SetAlignment(true);
                if (!_techSliders[i].Initialize(x + 550, y + 35 + (i * 30), 200, 0, 100, true, true, gameMain.Random, out reason))
                {
                    return(false);
                }
                if (!_techLockButtons[i].Initialize("LockBG", "LockFG", string.Empty, ButtonTextAlignment.LEFT, x + 755, y + 35 + (i * 30), 16, 16, gameMain.Random, out reason))
                {
                    return(false);
                }
            }

            if (!_totalResearchPointsLabel.Initialize(x + 765, y + 215, "Total Research Points: 0", System.Drawing.Color.White, out reason))
            {
                return(false);
            }
            _totalResearchPointsLabel.SetAlignment(true);

            _researchedTechnologyDescriptions = new BBTextBox();
            if (!_researchedTechnologyDescriptions.Initialize(x + 30, y + 310, 740, 260, true, true, "TechnologyListDescriptions", gameMain.Random, out reason))
            {
                return(false);
            }

            _techFieldButtons = new BBStretchButton[6];
            for (int i = 0; i < 6; i++)
            {
                _techFieldButtons[i] = new BBStretchButton();
            }

            if (!_techFieldButtons[0].Initialize("Computers", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, x + 20, y + 255, 125, 40, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_techFieldButtons[1].Initialize("Construction", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, x + 147, y + 255, 125, 40, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_techFieldButtons[2].Initialize("Force Fields", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, x + 274, y + 255, 125, 40, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_techFieldButtons[3].Initialize("Planetology", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, x + 401, y + 255, 125, 40, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_techFieldButtons[4].Initialize("Propulsion", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, x + 528, y + 255, 125, 40, gameMain.Random, out reason))
            {
                return(false);
            }
            if (!_techFieldButtons[5].Initialize("Weapons", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, x + 655, y + 255, 125, 40, gameMain.Random, out reason))
            {
                return(false);
            }

            reason = null;
            return(true);
        }
Exemplo n.º 34
0
        protected DemoBase(GameMain game)
        {
            _game = game;

            Window.AllowUserResizing = true;
        }
Exemplo n.º 35
0
    public Black_Player(byte index, CGame_BlackJack bjGame, Transform uiParent)
        : base(bjGame, uiParent)
    {
        m_nIndex = index;

        if (m_BjGameBase != null)
        {
            if (m_BjGameBase.m_SitUIObj != null)
            {
                m_SitUIObj = m_BjGameBase.m_SitUIObj.transform.GetChild(index).gameObject;
            }

            string    pointName = "Game_Model/Zhuozi/ZhuoMian/Points_New/Point_xian_" + (m_nIndex + 1).ToString();
            Transform parentTfm = GameObject.Find(pointName).transform;
            Transform tfm;

            m_PokerPointArray    = new Transform[3][];
            m_PokerPointArray[0] = new Transform[5];
            m_PokerPointArray[1] = new Transform[5];
            m_PokerPointArray[2] = new Transform[5];
            m_CountPointArray    = new Transform[3];
            for (int i = 0; i < 3; i++)
            {
                tfm = parentTfm.Find("Poker").Find("Poker_" + (i + 1).ToString());
                for (int j = 0; j < 5; j++)
                {
                    m_PokerPointArray[i][j] = tfm.GetChild(j);
                }
                m_CountPointArray[i] = tfm.Find("point_tips_bg");
            }

            m_ChipPointArray = new Transform[3, 3];
            for (int i = 0; i < 3; i++)
            {
                tfm = parentTfm.Find("Chip").Find("Chip_" + (i + 1).ToString());
                for (int j = 0; j < 3; j++)
                {
                    m_ChipPointArray[i, j] = tfm.GetChild(j);
                }
            }

            m_vecBlackPoker    = new List <byte> [2];
            m_vecBlackPoker[0] = new List <byte>();
            m_vecBlackPoker[1] = new List <byte>();

            if (m_BjGameBase.m_AssetBundle != null)
            {
                UnityEngine.Object obj = (GameObject)m_BjGameBase.m_AssetBundle.LoadAsset("PlayerInfor");
                m_InfoUIObj = (GameObject)GameMain.instantiate(obj);
                BillBoard billboard = m_InfoUIObj.AddComponent <BillBoard>();
                billboard.GameBase = m_BjGameBase;
                billboard.Target   = GameObject.Find("Game_Model/Zhuozi/Yizi/Icon_Point_" + (int)(m_nIndex + 1));
                m_InfoUIObj.transform.SetParent(uiParent, false);
                m_InfoUIObj.transform.Find("Button_Invitation").GetComponent <Button>().onClick.AddListener(OnClickInvite);
                m_TimeImg = m_InfoUIObj.transform.Find("PlayerBG").Find("Head").Find("HeadOutline").Find("OutlineCountdown").GetComponent <Image>();
                m_InfoUIObj.SetActive(false);

                m_CountTip    = new GameObject[2];
                obj           = (GameObject)m_BjGameBase.m_AssetBundle.LoadAsset("Model_tipsBG");
                m_CountTip[0] = GameMain.instantiate(obj) as GameObject;
                m_CountTip[0].SetActive(false);
                m_CountTip[1] = GameMain.instantiate(obj) as GameObject;
                m_CountTip[1].SetActive(false);
            }
        }
    }
 public void Init(GameMain mainRef)
 {
     m_MainRef = mainRef;
 }
Exemplo n.º 37
0
    void playClick()
    {
        GameMain gm = Camera.main.GetComponent("GameMain") as GameMain;

        AudioSource.PlayClipAtPoint(gm.SFXGUI, Camera.main.transform.position);
    }
Exemplo n.º 38
0
 public void SetGameMain(GameMain _gameMain)
 { 
     gameMain = _gameMain;
 }
Exemplo n.º 39
0
 public SpritesDemo(GameMain game) : base(game)
 {
 }
Exemplo n.º 40
0
 void OnDestroy()
 {
     instance = null;
 }
Exemplo n.º 41
0
    public int NumMin   = 4;    //最少生成个数

    //void Awake()
    //{
    //    //if (GameMain.EvtStopGenerateFish != null)
    //    //    Debug.Log("s GameMain.EvtStopGenerateFish.length = " + GameMain.EvtStopGenerateFish.GetInvocationList().Length);
    //    GameMain.EvtStopGenerateFish += Handle_StopGenerateFish;

    //}
    //void OnDestroy()
    //{
    //    //Debug.Log("destroy");

    //    if(GameMain.EvtStopGenerateFish != null)
    //        Debug.Log("GameMain.EvtStopGenerateFish.length = " + GameMain.EvtStopGenerateFish.GetInvocationList().Length);
    //}

    //void Handle_StopGenerateFish()
    //{
    //    //StopCoroutine("_Coro_Generate");
    //    //GameMain.EvtStopGenerateFish -= Handle_StopGenerateFish;
    //    //Destroy(gameObject);
    //}

    //public void Generate()
    //{
    //    StartCoroutine("_Coro_Generate");
    //}

    public void Generate()
    {
        int num          = Random.Range(NumMin, NumMax + 1);
        int generatedNum = 0;

        //yield return 0;//为取得transform.localPosition
        Swimmer leader = null;

        //Swimmer[] allSwimmer = new Swimmer[num];
        while (generatedNum < num)
        {
            Swimmer s = null;
            if (generatedNum == 0)
            {
                GameObject goLeader = new GameObject("领队_" + Prefab_Fish.name);

                leader = goLeader.AddComponent <Swimmer>();
                s      = leader;
                if (GameMain.EvtLeaderInstance != null)
                {
                    GameMain.EvtLeaderInstance(leader);
                }

                goLeader.AddComponent <DestroyWhenSwimmerOut>();
                Prefab_Fish.swimmer.CopyDataTo(leader);
            }
            else
            {
                Fish f = Instantiate(Prefab_Fish) as Fish;
                s      = f.swimmer;
                f.name = Prefab_Fish.name;
                //删除所有其他ai
                f.ClearAI();
                FishAI_Flock aiFollow = f.gameObject.AddComponent <FishAI_Flock>();
                aiFollow.SetLeader(leader);
            }

            s.gameObject.AddComponent <FishDimenSetWhenEnterWorld>();

            //allSwimmer[generatedNum] = s;
            s.SetLiveDimension(Radius / s.BoundCircleRadius * 2F);
            Transform tsSwimmer = s.transform;
            tsSwimmer.parent = GameMain.Singleton.FishGenerator.transform;
            Vector3 localPos = Random.insideUnitCircle * (Radius - s.BoundCircleRadius);
            localPos   = transform.localPosition + localPos;
            localPos.z = Defines.GMDepth_Fish + GameMain.Singleton.FishGenerator.ApplyFishDepth();
            tsSwimmer.localPosition = localPos;

            tsSwimmer.localRotation = transform.localRotation /* * Quaternion.AngleAxis(Random.Range(-AngleRndInit,AngleRndInit),Vector3.forward)*/;
            //f.transform.right = Vector3.zero - transform.localPosition;
            s.Go();

            ++generatedNum;

            //yield return 0;//不连续创建
        }

        //int fishLiveDimSetted = 0;
        //while (fishLiveDimSetted < num)
        //{
        //    for (int i = 0; i != num;++i )
        //    {
        //        if (allSwimmer[i] != null && allSwimmer[i].IsInWorld())
        //        {
        //            allSwimmer[i].SetLiveDimension(Defines.ClearFishRadius);
        //            allSwimmer[i] = null;
        //            ++fishLiveDimSetted;
        //        }
        //    }
        //    yield return new WaitForSeconds(0.3F);
        //}
        //GameMain.EvtStopGenerateFish -= Handle_StopGenerateFish;
        Destroy(gameObject);
    }
Exemplo n.º 42
0
 public CaveScreen2(GameMain mainGame, ContentManager contentManager)
 {
     _contentManager = contentManager;
     _mainGame       = mainGame;
 }
Exemplo n.º 43
0
        public bool Initialize(GameMain gameMain, out string reason)
        {
            _gameMain            = gameMain;
            _pathSprite          = SpriteManager.GetSprite("Path", _gameMain.Random);
            _fuelCircle          = SpriteManager.GetSprite("FuelCircle", _gameMain.Random);
            _selectionSprites    = new BBSprite[4];
            _selectionSprites[0] = SpriteManager.GetSprite("SelectionTL", _gameMain.Random);
            _selectionSprites[1] = SpriteManager.GetSprite("SelectionTR", _gameMain.Random);
            _selectionSprites[2] = SpriteManager.GetSprite("SelectionBL", _gameMain.Random);
            _selectionSprites[3] = SpriteManager.GetSprite("SelectionBR", _gameMain.Random);
            _showingFuelRange    = false;
            _showingRadarRange   = false;
            _showingOwners       = false;

            _camera = new Camera(_gameMain.Galaxy.GalaxySize * 60, _gameMain.Galaxy.GalaxySize * 60, _gameMain.ScreenWidth, _gameMain.ScreenHeight);

            _starName = new RenderImage("starNameRendered", 1, 1, ImageBufferFormats.BufferRGB888A8);
            _starName.BlendingMode = BlendingModes.Modulated;

            _backBuffer = new RenderImage("galaxyBackBuffer", _gameMain.ScreenWidth, _gameMain.ScreenHeight, ImageBufferFormats.BufferRGB888A8);
            _backBuffer.BlendingMode = BlendingModes.Modulated;

            _systemView = new SystemView();
            if (!_systemView.Initialize(_gameMain, "GalaxyScreen", out reason))
            {
                return(false);
            }
            _fleetView = new FleetView();
            if (!_fleetView.Initialize(_gameMain, out reason))
            {
                return(false);
            }

            _taskBar = new TaskBar();
            if (!_taskBar.Initialize(_gameMain, out reason))
            {
                return(false);
            }
            _inGameMenu       = new InGameMenu();
            _researchScreen   = new ResearchScreen();
            _shipDesignScreen = new ShipDesignScreen();
            _planetsView      = new PlanetsView();
            _fleetListScreen  = new FleetListScreen();
            if (!_inGameMenu.Initialize(_gameMain, out reason))
            {
                return(false);
            }
            if (!_researchScreen.Initialize(_gameMain, out reason))
            {
                return(false);
            }
            if (!_shipDesignScreen.Initialize(_gameMain, out reason))
            {
                return(false);
            }
            if (!_planetsView.Initialize(_gameMain, out reason))
            {
                return(false);
            }
            if (!_fleetListScreen.Initialize(_gameMain, out reason))
            {
                return(false);
            }
            _inGameMenu.CloseWindow       = CloseWindow;
            _researchScreen.CloseWindow   = CloseWindow;
            _shipDesignScreen.CloseWindow = CloseWindow;
            _planetsView.CloseWindow      = CloseWindow;
            _planetsView.CenterToSystem   = CenterToSystem;
            _fleetListScreen.CloseWindow  = CloseWindow;
            _fleetListScreen.SelectFleet  = SelectFleet;

            _taskBar.ShowGameMenu            = ShowInGameMenu;
            _taskBar.ShowResearchScreen      = ShowResearchScreen;
            _taskBar.ShowShipDesignScreen    = ShowShipDesignScreen;
            _taskBar.ShowPlanetsScreen       = ShowPlanetsView;
            _taskBar.ShowFleetOverviewScreen = ShowFleetListScreen;
            _taskBar.EndTurn = CloseWindow;

            _travelETA    = new BBLabel();
            _tentativeETA = new BBLabel();

            if (!_travelETA.Initialize(0, 0, "ETA", Color.White, out reason))
            {
                return(false);
            }
            if (!_tentativeETA.Initialize(0, 0, "ETA", Color.White, out reason))
            {
                return(false);
            }

            reason = null;
            return(true);
        }
Exemplo n.º 44
0
 public override void Init()
 {
     mResLoader = GameMain.GetInstance().GetModule <ResLoader>();
     gameMode   = GameMain.GetInstance().GetModule <CoreManager>().GetGameMode() as ZhiboGameMode;
 }
Exemplo n.º 45
0
 void OnPvpEnterBattle(C2G.PvpEnterBattle packet, C2G.PvpEnterBattleAck ack)
 {
     DungeonMonsterManager.Clear();
     GameMain.SetBattleMode(eBattleMode.PVP);
 }
Exemplo n.º 46
0
    private void Update()
    {
        if (listnerThread != null)
        {
            print(listnerThread.ThreadState + "상태");
        }
        switch (currentState)
        {
        case ClientNetworkState.Matching:
            if (targetIp.Length != 0)
            {
                string newTartget;
                lock (listenerLocker)
                {
                    newTartget = targetIp;
                }
                if (newTartget == "0")
                {
                    BindPlayerServer();
                }
                else
                {
                    ConnectToPlayerServer();
                }
            }
            break;

        case ClientNetworkState.InGame:
            // 메세지큐 수신 처리
        {
            while (networkReceivedList.Count > 0)
            {
                byte[] recievedBuf;
                lock (listenerLocker)
                {
                    recievedBuf = networkReceivedList.Dequeue();
                }
                switch ((CTCType)recievedBuf[0])
                {
                case CTCType.AttackSuccess:
                {
                    byte[] realBuf = new byte[recievedBuf.Length - 1];
                    for (int i = 0; i < recievedBuf.Length - 1; ++i)
                    {
                        realBuf[i] = recievedBuf[i + 1];
                    }
                    CM_AttackSuccess msg = MyTool.BytesToStruct <CM_AttackSuccess>(realBuf);
                    GameMain.GetInstance().Attack((msg.type == CharacterType.Local ? CharacterType.Enemy : CharacterType.Local), msg.damage, true);
                }
                break;

                case CTCType.SendTime:
                {
                    byte[] realBuf = new byte[recievedBuf.Length - 1];
                    for (int i = 0; i < recievedBuf.Length - 1; ++i)
                    {
                        realBuf[i] = recievedBuf[i + 1];
                    }
                    CM_SendTime msg = MyTool.BytesToStruct <CM_SendTime>(realBuf);
                    GameMain.GetInstance().timer = msg.timer - (float)(DateTime.Now - DateTime.Parse(msg.dateTime)).TotalSeconds;
                }
                break;

                case CTCType.Disconnect:
                {
                    ChangeState(ClientNetworkState.Matching);
                    return;
                }
                break;

                case CTCType.NoticeDeath:
                {
                    byte[] realBuf = new byte[recievedBuf.Length - 1];
                    for (int i = 0; i < recievedBuf.Length - 1; ++i)
                    {
                        realBuf[i] = recievedBuf[i + 1];
                    }
                    CM_NoticeDeath msg = MyTool.BytesToStruct <CM_NoticeDeath>(realBuf);
                    GameMain.GetInstance().Death((msg.characterType == CharacterType.Local ? CharacterType.Enemy : CharacterType.Local), msg.position, true);
                }
                break;

                case CTCType.UpdatePosition:
                {
                    byte[] realBuf = new byte[recievedBuf.Length - 1];
                    for (int i = 0; i < recievedBuf.Length - 1; ++i)
                    {
                        realBuf[i] = recievedBuf[i + 1];
                    }
                    CM_UpdatePosition msg = MyTool.BytesToStruct <CM_UpdatePosition>(realBuf);
                    Enemy.GetInstance().UpdatePosition(msg.position, msg.velocity);
                }
                break;

                case CTCType.UseSkill:
                {
                    byte[] realBuf = new byte[recievedBuf.Length - 1];
                    for (int i = 0; i < recievedBuf.Length - 1; ++i)
                    {
                        realBuf[i] = recievedBuf[i + 1];
                    }
                    CM_UseSkill msg = MyTool.BytesToStruct <CM_UseSkill>(realBuf);
                    LocalCharacter.GetInstance().InstantiateMissle(msg.skillType, msg.position, msg.rotation, true);
                }
                break;
                }
            }
        }

            // 메세지 전송 처리
            {
                for (int i = 0; i < networkSendList.Count; ++i)
                {
                    SendToServer(networkSendList[i]);
                }
                networkSendList.Clear();
            }
            break;
        }
        if (matchingFlag)
        {
            if (currentState != ClientNetworkState.Ready)
            {
                ChangeState(ClientNetworkState.Matching);
            }
            matchingFlag = false;
        }
        if (refreshThread && listnerThread.ThreadState == ThreadState.Stopped)
        {
            listnerThread.Start();
            refreshThread = true;
        }
    }
 public void OnOkBtnClicked()
 {
     GameMain.EnterMainMenuScene();
 }
Exemplo n.º 48
0
 // Start is called before the first frame update
 void Awake()
 {
     main = FindObjectOfType <GameMain>();
     rb   = GetComponent <Rigidbody>();
     Physics.IgnoreLayerCollision(8, 8);
 }
Exemplo n.º 49
0
        public bool Initialize(GameMain gameMain, out string reason)
        {
            if (!base.Initialize((gameMain.ScreenWidth / 2) - 250, (gameMain.ScreenHeight / 2) - 200, 500, 400, StretchableImageType.MediumBorder, gameMain, false, gameMain.Random, out reason))
            {
                return false;
            }

            int x = (gameMain.ScreenWidth / 2) - 150;
            int y = (gameMain.ScreenHeight / 2) - 50;
            _saveGameNamePromptBackground = new BBStretchableImage();
            if (!_saveGameNamePromptBackground.Initialize(x, y, 300, 100, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            _saveGameNamePromptInstructionLabel = new BBLabel();
            if (!_saveGameNamePromptInstructionLabel.Initialize(x + 20, y + 10, "Please input name for the save:", Color.White, out reason))
            {
                return false;
            }
            _saveGameNameField = new BBSingleLineTextBox();
            if (!_saveGameNameField.Initialize(string.Empty, x + 20, y + 40, 250, 40, false, gameMain.Random, out reason))
            {
                return false;
            }

            _buttons = new BBStretchButton[4];

            _buttons[0] = new BBStretchButton();
            if (!_buttons[0].Initialize("New Game", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 30, _yPos + 350, 200, 35, gameMain.Random, out reason))
            {
                return false;
            }
            _buttons[1] = new BBStretchButton();
            if (!_buttons[1].Initialize("Save Game", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 270, _yPos + 300, 200, 35, gameMain.Random, out reason))
            {
                return false;
            }
            _buttons[2] = new BBStretchButton();
            if (!_buttons[2].Initialize("Load Game", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 30, _yPos + 300, 200, 35, gameMain.Random, out reason))
            {
                return false;
            }
            _buttons[2].Enabled = false;

            _buttons[3] = new BBStretchButton();
            if (!_buttons[3].Initialize("Exit Game", ButtonTextAlignment.CENTER, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos + 270, _yPos + 350, 200, 35, gameMain.Random, out reason))
            {
                return false;
            }

            _saveGameListBackground = new BBStretchableImage();
            if (!_saveGameListBackground.Initialize(_xPos + 20, _yPos + 20, 460, 325, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }

            _saveGameButtons = new BBInvisibleStretchButton[8];
            for (int i = 0; i < _saveGameButtons.Length; i++)
            {
                _saveGameButtons[i] = new BBInvisibleStretchButton();
                if (!_saveGameButtons[i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, _xPos + 30, _yPos + 35 + (i * 32), 420, 32, gameMain.Random, out reason))
                {
                    return false;
                }
            }

            _scrollBar = new BBScrollBar();
            if (!_scrollBar.Initialize(_xPos + 455, _yPos + 37, 256, _saveGameButtons.Length, _saveGameButtons.Length, false, false, gameMain.Random, out reason))
            {
                return false;
            }

            _maxVisible = 0;
            _scrollBar.SetEnabledState(false);
            _selectedGame = -1;
            _files = new List<FileInfo>();
            _promptShowing = false;

            return true;
        }
Exemplo n.º 50
0
 public MainMenu(GameMain game)
 {
     this.game  = game;
     background = Helpers.LoadImage("mainbackground.png");
     startGame  = new SelectorText("Start", 740, 600, 210, 42);
 }
Exemplo n.º 51
0
 static void Main()
 {
     using (var game = new GameMain())
         game.Run();
 }
Exemplo n.º 52
0
 public BaseGameState(Game game) : base(game)
 {
     GameRef = (GameMain)game;
 }
 public void Hide()
 {
     gameObject.SetActivityExt(false);
     GameMain.RemoveEventListener(CommonEvents.UpdateCheckVersionProgress, OnUpdateCheckVersionProgress);
     m_pAlertOKButton.onClick.AddListener(OnAlertOKClick);
 }
Exemplo n.º 54
0
    /// <summary>
    /// 即时退奖
    /// </summary>
    /// <remarks>Dat_PlayersScoreWon中值,可以退奖则扣下</remarks>
    /// <returns></returns>
    public IEnumerator _Coro_OutBountyImm()
    {
        if (mIsOutingBounty)
        {
            yield break;
        }

        BackStageSetting bss   = GameMain.Singleton.BSSetting;
        INemoControlIO   arcIO = GameMain.Singleton.ArcIO;

        int oneBountyNeedScore = 100000000;//防止出现bug不会退

        if (bss.OutBountyType_.Val == OutBountyType.OutCoinImmediate)
        {
            oneBountyNeedScore = bss.InsertCoinScoreRatio.Val;
        }
        else if (bss.OutBountyType_.Val == OutBountyType.OutTicketImmediate)
        {
            oneBountyNeedScore = (int)(((float)bss.InsertCoinScoreRatio.Val) * bss.CoinTicketRatio_Coin.Val / bss.CoinTicketRatio_Ticket.Val);//投币比例(分/币) * 币票比(币/票) = 出一票需要多少分(分/票)
        }
        if (bss.Dat_PlayersScoreWon[Idx].Val < oneBountyNeedScore)
        {
            yield break;
        }

        mIsOutingBounty = true;

        //请求硬件扣币
        if (bss.OutBountyType_.Val == OutBountyType.OutCoinImmediate)
        {
            arcIO.OutCoin(1, CtrllerIdx);
        }
        else if (bss.OutBountyType_.Val == OutBountyType.OutTicketImmediate)
        {
            arcIO.OutTicket(1, CtrllerIdx);
        }


        bool  isBoutyOutted = false; //是否已出奖励
        float timeOut       = 10F;   //超时时间
        float elapse        = 0F;
        NemoCtrlIO_EventController outBountyreflect = (int cIdx) =>
        {
            if (CtrllerIdx == cIdx)
            {
                isBoutyOutted = true;
            }
        };

        if (bss.OutBountyType_.Val == OutBountyType.OutCoinImmediate)
        {
            arcIO.EvtOutCoinReflect += outBountyreflect;
        }
        else if (bss.OutBountyType_.Val == OutBountyType.OutTicketImmediate)
        {
            arcIO.EvtOutTicketReflect += outBountyreflect;
        }


        while (!isBoutyOutted)
        {
            if (elapse > timeOut)// 超时
            {
                //显示退奖错误提示
                if (bss.OutBountyType_.Val == OutBountyType.OutCoinImmediate)
                {
                    mGOViewingOutBountyHint = Instantiate(Prefab_OutBountyHints[2]) as GameObject;
                }
                else if (bss.OutBountyType_.Val == OutBountyType.OutTicketImmediate)
                {
                    mGOViewingOutBountyHint = Instantiate(Prefab_OutBountyHints[3]) as GameObject;
                }
                mGOViewingOutBountyHint.transform.parent        = transform;
                mGOViewingOutBountyHint.transform.localPosition = LocalOutBountyHint;
                mGOViewingOutBountyHint.transform.localRotation = Quaternion.identity;

                yield return(new WaitForSeconds(30F));

                mIsOutingBounty = false;
                StartCoroutine(_Coro_OutBountyImm());
                yield break;
            }
            elapse += Time.deltaTime;
            yield return(0);
        }

        //出币已应答
        if (bss.OutBountyType_.Val == OutBountyType.OutCoinImmediate)
        {
            arcIO.EvtOutCoinReflect -= outBountyreflect;
        }
        else if (bss.OutBountyType_.Val == OutBountyType.OutTicketImmediate)
        {
            arcIO.EvtOutTicketReflect -= outBountyreflect;
        }



        //历史记录
        if (bss.OutBountyType_.Val == OutBountyType.OutCoinImmediate)
        {
            bss.His_CoinOut.Val     += 1;
            bss.His_GainCurrent.Val -= 1;
            bss.UpdateGainCurrentAndTotal();
        }
        else if (bss.OutBountyType_.Val == OutBountyType.OutTicketImmediate)
        {
            bss.His_TicketOut.Val += 1;

            //所有玩家公用
            bss.TicketOutFragment.Val += 1;
            int outCoinNumBase = bss.TicketOutFragment.Val / bss.CoinTicketRatio_Ticket.Val;//出币基数,乘与CoinTicketRatio_Coin 得出应出多少个整币
            if (outCoinNumBase > 0)
            {
                bss.His_GainCurrent.Val   -= outCoinNumBase * bss.CoinTicketRatio_Coin.Val;
                bss.TicketOutFragment.Val -= bss.CoinTicketRatio_Ticket.Val;
            }
            bss.UpdateGainCurrentAndTotal();
        }
        if (bss.Dat_PlayersScoreWon[Idx].Val < oneBountyNeedScore)
        {
            Debug.LogError("[退奖错误]该扣分数大于玩家已赢分数.");
            yield break;
        }

        bss.Dat_PlayersScoreWon[Idx].Val = bss.Dat_PlayersScoreWon[Idx].Val - oneBountyNeedScore;
        if (GameMain.EvtPlayerWonScoreChanged != null)
        {
            GameMain.EvtPlayerWonScoreChanged(this, bss.Dat_PlayersScoreWon[Idx].Val);
        }
        //Ef_CoinStack.OneStack_SetNum(bss.Dat_PlayersScoreWon[Idx].Val);
        mIsOutingBounty = false;

        //是否可再扣分,可以则迭代
        if (bss.Dat_PlayersScoreWon[Idx].Val >= oneBountyNeedScore)
        {
            StartCoroutine(_Coro_OutBountyImm());
        }

        if (mGOViewingOutBountyHint != null)
        {
            Destroy(mGOViewingOutBountyHint);
            mGOViewingOutBountyHint = null;
        }
    }
Exemplo n.º 55
0
        public bool Initialize(GameMain gameMain, out string reason)
        {
            int x = (gameMain.ScreenWidth / 2) - 533;
            int y = (gameMain.ScreenHeight / 2) - 300;

            if (!Initialize(x, y, 1066, 600, StretchableImageType.MediumBorder, gameMain, false, gameMain.Random, out reason))
            {
                return false;
            }

            x += 20;
            y += 20;

            _columnHeaders = new BBStretchButton[8];
            for (int i = 0; i < _columnHeaders.Length; i++)
            {
                _columnHeaders[i] = new BBStretchButton();
            }
            _columnCells = new BBStretchButton[8][];
            for (int i = 0; i < _columnCells.Length; i++)
            {
                _columnCells[i] = new BBStretchButton[13];
                for (int j = 0; j < _columnCells[i].Length; j++)
                {
                    _columnCells[i][j] = new BBStretchButton();
                }
            }

            if (!_columnHeaders[0].Initialize("Planet", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonBG, x, y, 280, 30, _gameMain.Random, out reason))
            {
                return false;
            }
            for (int i = 0; i < 13; i++)
            {
                if (!_columnCells[0][i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x, y + 30 + (i * 30), 280, 30, _gameMain.Random, out reason))
                {
                    return false;
                }
            }

            x += 280;
            if (!_columnHeaders[1].Initialize("Population", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonBG, x, y, 90, 30, _gameMain.Random, out reason))
            {
                return false;
            }
            for (int i = 0; i < 13; i++)
            {
                if (!_columnCells[1][i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x, y + 30 + (i * 30), 90, 30, _gameMain.Random, out reason))
                {
                    return false;
                }
            }

            x += 90;
            if (!_columnHeaders[2].Initialize("Buildings", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonBG, x, y, 90, 30, _gameMain.Random, out reason))
            {
                return false;
            }
            for (int i = 0; i < 13; i++)
            {
                if (!_columnCells[2][i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x, y + 30 + (i * 30), 90, 30, _gameMain.Random, out reason))
                {
                    return false;
                }
            }

            x += 90;
            if (!_columnHeaders[3].Initialize("Bases", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonBG, x, y, 80, 30, _gameMain.Random, out reason))
            {
                return false;
            }
            for (int i = 0; i < 13; i++)
            {
                if (!_columnCells[3][i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x, y + 30 + (i * 30), 80, 30, _gameMain.Random, out reason))
                {
                    return false;
                }
            }

            x += 80;
            if (!_columnHeaders[4].Initialize("Waste", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonBG, x, y, 80, 30, _gameMain.Random, out reason))
            {
                return false;
            }
            for (int i = 0; i < 13; i++)
            {
                if (!_columnCells[4][i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x, y + 30 + (i * 30), 80, 30, _gameMain.Random, out reason))
                {
                    return false;
                }
            }

            x += 80;
            if (!_columnHeaders[5].Initialize("Industry", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonBG, x, y, 80, 30, _gameMain.Random, out reason))
            {
                return false;
            }
            for (int i = 0; i < 13; i++)
            {
                if (!_columnCells[5][i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x, y + 30 + (i * 30), 80, 30, _gameMain.Random, out reason))
                {
                    return false;
                }
            }

            x += 80;
            if (!_columnHeaders[6].Initialize("Constructing", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonBG, x, y, 250, 30, _gameMain.Random, out reason))
            {
                return false;
            }
            for (int i = 0; i < 13; i++)
            {
                if (!_columnCells[6][i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x, y + 30 + (i * 30), 250, 30, _gameMain.Random, out reason))
                {
                    return false;
                }
            }

            x += 250;
            if (!_columnHeaders[7].Initialize("Notes", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonBG, x, y, 60, 30, _gameMain.Random, out reason))
            {
                return false;
            }
            for (int i = 0; i < 13; i++)
            {
                if (!_columnCells[7][i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x, y + 30 + (i * 30), 60, 30, _gameMain.Random, out reason))
                {
                    return false;
                }
            }
            x += 60;
            _scrollBar = new BBScrollBar();
            if (!_scrollBar.Initialize(x, y + 30, 390, 13, 13, false, false, _gameMain.Random, out reason))
            {
                return false;
            }

            _expensesBackground = new BBStretchableImage();
            _incomeBackground = new BBStretchableImage();
            _reserves = new BBStretchableImage();

            _expenseTitle = new BBLabel();
            _incomeTitle = new BBLabel();

            _expenses = new BBStretchButton[4];
            _expenseLabels = new BBLabel[4];
            _incomes = new BBStretchButton[2];
            _incomeLabels = new BBLabel[2];
            for (int i = 0; i < 4; i++)
            {
                _expenses[i] = new BBStretchButton();
                _expenseLabels[i] = new BBLabel();
            }
            for (int i = 0; i < 2; i++)
            {
                _incomes[i] = new BBStretchButton();
                _incomeLabels[i] = new BBLabel();
            }

            x = (gameMain.ScreenWidth / 2) - 513;
            y = (gameMain.ScreenHeight / 2) + 143;

            if (!_expensesBackground.Initialize(x, y, 476, 140, StretchableImageType.ThinBorderBG, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_expenseTitle.Initialize(0, 0, "Expenses", Color.Gold, "LargeComputerFont", out reason))
            {
                return false;
            }
            _expenseTitle.MoveTo((int)(x + 238 - _expenseTitle.GetWidth() / 2), y + 5);
            if (!_expenses[0].Initialize("Ships", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 10, y + 50,  228, 40, _gameMain.Random, out reason))
            {
                return false;
            }
            _expenses[0].SetTextColor(Color.Orange, Color.Empty);
            if (!_expenseLabels[0].Initialize(x + 228, y + 65, string.Empty, Color.White, out reason))
            {
                return false;
            }
            _expenseLabels[0].SetAlignment(true);
            if (!_expenses[1].Initialize("Bases", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 10, y + 90, 228, 40, _gameMain.Random, out reason))
            {
                return false;
            }
            _expenses[1].SetTextColor(Color.Orange, Color.Empty);
            if (!_expenseLabels[1].Initialize(x + 228, y + 105, string.Empty, Color.White, out reason))
            {
                return false;
            }
            _expenseLabels[1].SetAlignment(true);
            if (!_expenses[2].Initialize("Spying", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 238, y + 50, 228, 40, _gameMain.Random, out reason))
            {
                return false;
            }
            _expenses[2].SetTextColor(Color.Orange, Color.Empty);
            if (!_expenseLabels[2].Initialize(x + 456, y + 65, string.Empty, Color.White, out reason))
            {
                return false;
            }
            _expenseLabels[2].SetAlignment(true);
            if (!_expenses[3].Initialize("Security", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 238, y + 90, 228, 40, _gameMain.Random, out reason))
            {
                return false;
            }
            _expenses[3].SetTextColor(Color.Orange, Color.Empty);
            if (!_expenseLabels[3].Initialize(x + 456, y + 105, string.Empty, Color.White, out reason))
            {
                return false;
            }
            _expenseLabels[3].SetAlignment(true);
            x += 476;

            if (!_incomeBackground.Initialize(x, y, 250, 140, StretchableImageType.ThinBorderBG, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_incomeTitle.Initialize(0, 0, "Incomes", Color.Gold, "LargeComputerFont", out reason))
            {
                return false;
            }
            if (!_incomes[0].Initialize("Planets", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 10, y + 50, 230, 40, _gameMain.Random, out reason))
            {
                return false;
            }
            _incomes[0].SetTextColor(Color.Orange, Color.Empty);
            if (!_incomeLabels[0].Initialize(x + 230, y + 65, string.Empty, Color.White, out reason))
            {
                return false;
            }
            _incomeLabels[0].SetAlignment(true);
            if (!_incomes[1].Initialize("Trade", ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 10, y + 90, 230, 40, _gameMain.Random, out reason))
            {
                return false;
            }
            _incomes[1].SetTextColor(Color.Orange, Color.Empty);
            if (!_incomeLabels[1].Initialize(x + 230, y + 105, string.Empty, Color.White, out reason))
            {
                return false;
            }
            _incomeLabels[1].SetAlignment(true);
            _incomeTitle.MoveTo((int)(x + 125 - _incomeTitle.GetWidth() / 2), y + 5);
            x += 250;

            if (!_reserves.Initialize(x, y, 300, 140, StretchableImageType.ThinBorderBG, _gameMain.Random, out reason))
            {
                return false;
            }
            _reserveSlider = new BBScrollBar();
            _reservesLabel = new BBLabel();
            _reservesAmount = new BBLabel();

            _transferSlider = new BBScrollBar();
            _transferLabel = new BBLabel();
            _transferAmount = new BBLabel();
            _transferReserves = new BBStretchButton();

            if (!_reservesLabel.Initialize(x + 10, y + 10, "Reserve:", Color.Orange, out reason))
            {
                return false;
            }
            if (!_reservesAmount.Initialize(x + 280, y + 10, string.Empty, Color.White, out reason))
            {
                return false;
            }
            if (!_reserveSlider.Initialize(x + 10, y + 33, 280, 0, 20, true, true, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_transferLabel.Initialize(x + 10, y + 51, "Amount to transfer:", Color.Orange, out reason))
            {
                return false;
            }
            if (!_transferAmount.Initialize(x + 280, y + 51, string.Empty, Color.White, out reason))
            {
                return false;
            }
            if (!_transferSlider.Initialize(x + 10, y + 72, 280, 0, 200, true, true, _gameMain.Random, out reason))
            {
                return false;
            }
            if (!_transferReserves.Initialize("Transfer reserves to selected planet", ButtonTextAlignment.CENTER, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, x + 10, y + 95, 280, 35, _gameMain.Random, out reason))
            {
                return false;
            }
            _reservesAmount.SetAlignment(true);
            _transferAmount.SetAlignment(true);

            return true;
        }
Exemplo n.º 56
0
 public GuiDemo(GameMain game)
 {
     _game = game;
 }
Exemplo n.º 57
0
 private void Form1_Load(object sender, EventArgs e)
 {
     game_base = new GameBase(this, 1024, 720, null, true);
     game_main = new GameMain(game_base);                      // DxLib初期化後にこちらを処理したいので
     game_base.dlg_main_loop_one_frame = game_main.MainLoop;   // 上記の理由につきやや強引(引数でやりたいところ)
 }
Exemplo n.º 58
0
 public ExitCommand(GameMain sprint0)
 {
     this.Sprint0 = sprint0;
 }
Exemplo n.º 59
0
        public bool Initialize(GameMain gameMain, out string reason)
        {
            this._gameMain = gameMain;

            _buttons = new BBButton[4];

            _x = (gameMain.ScreenWidth / 2) - 130;
            _y = (gameMain.ScreenHeight / 2);

            for (int i = 0; i < _buttons.Length; i++)
            {
                _buttons[i] = new BBButton();
            }

            if (!_buttons[0].Initialize("MainButtonBG", "MainButtonFG", "Continue", "LargeComputerFont", ButtonTextAlignment.CENTER, _x, _y, 260, 40, gameMain.Random, out reason, 20, -1))
            {
                return false;
            }
            if (!_buttons[1].Initialize("MainButtonBG", "MainButtonFG", "New Game", "LargeComputerFont", ButtonTextAlignment.CENTER, _x, _y + 50, 260, 40, gameMain.Random, out reason, 20, -1))
            {
                return false;
            }
            if (!_buttons[2].Initialize("MainButtonBG", "MainButtonFG", "Load Game", "LargeComputerFont", ButtonTextAlignment.CENTER, _x, _y + 100, 260, 40, gameMain.Random, out reason, 20, -1))
            {
                return false;
            }
            if (!_buttons[3].Initialize("MainButtonBG", "MainButtonFG", "Exit", "LargeComputerFont", ButtonTextAlignment.CENTER, _x, _y + 150, 260, 40, gameMain.Random, out reason, 20, -1))
            {
                return false;
            }
            for (int i = 0; i < _buttons.Length; i++)
            {
                _buttons[i].SetTextColor(System.Drawing.Color.Gold, System.Drawing.Color.Black);
            }

            _versionLabel = new BBLabel();
            if (!_versionLabel.Initialize(10, _gameMain.ScreenHeight - 30, "Version 0.59", System.Drawing.Color.White, out reason))
            {
                return false;
            }

            _background = SpriteManager.GetSprite("MainBackground", gameMain.Random);
            _planet = SpriteManager.GetSprite("MainPlanetBackground", gameMain.Random);
            _title = SpriteManager.GetSprite("Title", gameMain.Random);

            _x = (gameMain.ScreenWidth / 2) - 512;
            _y = (gameMain.ScreenHeight / 2) - 300;

            _files = Utility.GetSaveGames(gameMain.GameDataSet.FullName);
            if (_files.Count == 0)
            {
                _buttons[0].Active = false; //Disabled Continue and Load buttons since there's no games to load
                _buttons[2].Active = false;
            }

            _loadBackground = new BBStretchableImage();
            if (!_loadBackground.Initialize((gameMain.ScreenWidth / 2) - 225, (gameMain.ScreenHeight / 2) - 175, 450, 350, StretchableImageType.ThinBorderBG, gameMain.Random, out reason))
            {
                return false;
            }
            _saveGameButtons = new BBInvisibleStretchButton[10];
            for (int i = 0; i < _saveGameButtons.Length; i++)
            {
                _saveGameButtons[i] = new BBInvisibleStretchButton();
                if (!_saveGameButtons[i].Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.TinyButtonBG, StretchableImageType.TinyButtonFG, (gameMain.ScreenWidth / 2) - 220, (gameMain.ScreenHeight / 2) - 160 + (i * 32), 420, 32, gameMain.Random, out reason))
                {
                    return false;
                }
            }
            _scrollBar = new BBScrollBar();
            if (!_scrollBar.Initialize((gameMain.ScreenWidth / 2) + 200, (gameMain.ScreenHeight / 2) - 160, 320, 10, 10, false, false, gameMain.Random, out reason))
            {
                return false;
            }

            _maxVisible = _files.Count > _saveGameButtons.Length ? _saveGameButtons.Length : _files.Count;
            if (_maxVisible < _saveGameButtons.Length)
            {
                //Disable the scrollbar
                _scrollBar.SetEnabledState(false);
            }
            else
            {
                _scrollBar.SetEnabledState(true);
                _scrollBar.SetAmountOfItems(_files.Count);
            }

            RefreshSaves();

            _showingLoadMenu = false;

            reason = null;
            return true;
        }
Exemplo n.º 60
0
 public BitmapFontsDemo(GameMain parent)
     : base(parent)
 {
 }