Exemplo n.º 1
0
        protected void surfacesDrawInit(Bitmap image, int _x, int _y)
        {
            if (image == null || _x <= 0 || _y <= 0)
            {
                throw new ArgumentException("Creating a surface via surfacesDrawInit(...) without a valid image is unallowed!");
            }
            toDraw = GameApp.ResizeImg(image, (int)Math.Max(_x, _y), (int)Math.Max(_x, _y));
            float persp = perspective;

            if (Math.Round(persp) % 360 == 0)
            {
                toDraw.RotateFlip(RotateFlipType.RotateNoneFlipNone);
            }
            else if (Math.Round(persp) % 360 == 270)
            {
                toDraw.RotateFlip(RotateFlipType.Rotate90FlipNone);
            }
            else if (Math.Round(persp) % 360 == 180)
            {
                toDraw.RotateFlip(RotateFlipType.Rotate180FlipNone);
            }
            else if (Math.Round(persp) % 360 == 90)
            {
                toDraw.RotateFlip(RotateFlipType.Rotate270FlipNone);
            }
            else
            {
                toDraw.RotateFlip(RotateFlipType.RotateNoneFlipNone);
            }
        }
Exemplo n.º 2
0
    void Start()
    {
        Debug.Log("JoinGameSceneInit");

        gameApp     = GameObject.Find("GameApp").GetComponent <GameApp>();
        levelLoader = GameObject.Find("LevelLoader").GetComponent <LevelLoader>();
    }
Exemplo n.º 3
0
    public LoadingPanel()
    {
        m_LoadingText = new UIText();
        m_LoadingText.Set(ConstData.FONT_NAME1, "LOADING...", ColorName.fontColor_darkorange);
        m_LoadingText.AlignStyle = UIText.enAlignStyle.center;
        m_LoadingText.Rect       = AutoRect.AutoPos(new Rect(0, 70, 960, 100));



        m_desc = new UIText();
        m_desc.Set(ConstData.FONT_NAME2, "YOUR TOWN HAS BEEN INFECTED...\n\nALL YOUR FAMILY, FRIENDS, AND CO-WORKERS HAVE TURNED INTO ZOMBIES.\n\nFIGHT FOR YOUR LIFE.\n\nFIGHT FOR AS LONG AS YOU CAN...", Color.white);
        m_desc.AlignStyle = UIText.enAlignStyle.center;
        m_desc.Rect       = AutoRect.AutoPos(new Rect(0, 120, 960, 640));
        string path = Application.dataPath + "/../../Documents/";

        this.Add(m_desc);
        if (GameApp.GetInstance().GetGameState().FirstTimeGame&& Application.loadedLevelName != SceneName.ARENA_MENU)
        {
        }
        else
        {
            this.Add(m_LoadingText);
            int size = AvatarInfo.TIPS_INO.Length;
            int rnd  = Random.RandomRange(0, size);
            m_desc.Rect = AutoRect.AutoPos(new Rect(0, 0, 960, 640));
            m_desc.SetText(AvatarInfo.TIPS_INO[rnd]);
        }
    }
Exemplo n.º 4
0
    public static bool and_InLine(GameApp cm, string line)
    {
        string[] newline = line.Split(' ');
        // "gte" 和 “and” 同时出现的行
        if (line.Contains(" gte "))
        {
            int    valueA        = cm.status[newline[1].Substring(1)].AsInt;
            string valueB        = cm.status[newline[5].Substring(1)];
            bool   isgte         = valueA >= int.Parse(newline[3]);
            bool   isTrueOrFalse = valueB.Equals(newline[7]);

            // Debug.Log("valueA = " + valueA + " valueB = " + valueB);
            // Debug.Log("gteline[3]= " + gteline[3] + " gteline[7] = " + gteline[7]);
            return(!(isgte && isTrueOrFalse));
            // Debug.Log("and gte skip_line  = " + skip_line);
        }
        else
        {
            string valueA = cm.status[newline[1].Substring(1)];
            string valueB = cm.status[newline[5].Substring(1)];
            // Debug.Log("valueA = " + valueA + " valueB = " + valueB);
            // Debug.Log("newline[3] = " + newline[3] + " newline[7] = " + newline[7]);
            return(!(valueA.Equals(newline[3]) && valueB.Equals(newline[7])));
            // Debug.Log("and skip_line = " + skip_line);
        }
    }
Exemplo n.º 5
0
 public override void Show()
 {
     //GameApp.GetInstance().GetGameScene().BonusWeapon = GameApp.GetInstance().GetGameState().GetWeapons()[2];
     SetUnlockWeapon(GameApp.GetInstance().GetGameScene().BonusWeapon);
     firstLineText.Set(ConstData.FONT_NAME2, GameApp.GetInstance().GetGameScene().BonusWeapon.Name + " IS AVAILABLE FOR PURCHASE!", ColorName.fontColor_darkorange);
     base.Show();
 }
Exemplo n.º 6
0
        private IEnumerator AsyncLoadCoroutine(string name, System.Type type)
        {
            string assetBundleName = GlobalSetting.ConvertToAssetBundleName(name);
            string url             = GlobalSetting.ConvertToFtpPath(assetBundleName);
            int    verNum          = GameApp.GetVersionNumber();

            WWW www = WWW.LoadFromCacheOrDownload(url, verNum);

            _dicLoadingReq.Add(name, www);
            while (www.isDone == false)
            {
                yield return(null);
            }
            AssetBundleRequest req = www.assetBundle.LoadAssetAsync(GetAssetName(name));

            while (req.isDone == false)
            {
                yield return(null);
            }

            _dicAsset.Add(name, req.asset);
            _dicLoadingReq.Remove(name);
            www.assetBundle.Unload(false);
            www = null;
        }
Exemplo n.º 7
0
    // Use this for initialization
    IEnumerator Start()
    {
        yield return(0);

        triggerTransform = gameObject.transform;
        triggered        = false;
        foreach (EnemySpawnScript es in spawns)
        {
            if (es != null)
            {
                es.TriggerBelongsto = this;
            }
        }

        hasSecondarySpawns = false;
        foreach (EnemySpawnScript es in secondarySpawns)
        {
            if (es != null)
            {
                es.TriggerBelongsto = this;
                hasSecondarySpawns  = true;
            }
        }
        alreadyMaxSpawned = false;
        GameApp.GetInstance().GetGameScene().AddTrigger(this);
        gameScene = GameApp.GetInstance().GetGameScene();
    }
Exemplo n.º 8
0
 /// <summary>
 /// Carica un file con un dialog che parte dal path specificato.
 /// </summary>
 /// <param name="path">Path da cui partirà il dialog.</param>
 /// <returns></returns>
 public bool LoadNewLevel(string loadPath)
 {
     if (!isLoaded)
     {
         return(LoadLevel(loadPath));
     }
     else
     {
         DialogResult dr = MessageBox.Show(
             "Loading another level makes you lose the unsaved progress of your previous level.\n" +
             "\"Yes\" will save your level, \"No\" will make you lose the unsaved progress, \"Cancel\" will not load another level.",
             "Saving current level?",
             MessageBoxButtons.YesNoCancel);
         if (dr == DialogResult.Yes)
         {
             if (this.IsABonusLevel)
             {
                 SaveLevel(GameApp.CurDir() + @"\BONUSLEVELS");
             }
             else
             {
                 SaveLevel(GameApp.CurDir() + @"\LEVELS");
             }
             return(LoadLevel(loadPath));
         }
         else if (dr == DialogResult.No)
         {
             return(LoadLevel(loadPath));
         }
         else
         {
             return(false);
         }
     }
 }
Exemplo n.º 9
0
        private void NetworkStatusChangeEvent(ConnectionID socket, NetworkManager.Status wError)
        {
            if (wError != NetworkManager.Status.Connected)
            {
                GameApp.GameMgr.DestoryGame(true);

                if (bShowSocketTips == false)
                {
                    return;
                }

                if (socket == ConnectionID.Lobby)
                {
                    HallTransfer.Instance.cnCloseWebpage();
                    GameApp.PopupMgr.Confirm("提示", "为了您的账户安全,请重新登录!", delegate(MessageBoxResult style)
                    {
                        GameApp.GetInstance().SwitchAccount();
                    }, 15);
                }
                else
                {
                    HallTransfer.Instance.cnCloseWebpage();
                    GameApp.PopupMgr.Confirm("提示",
                                             wError == NetworkManager.Status.TimeOut ? "连接超时,请重试!" : "与游戏服务器断开连接,请重试!",
                                             delegate(MessageBoxResult style)
                    {
                        GameApp.GetInstance().SwitchAccount();
                    }, 15);
                }
            }
        }
Exemplo n.º 10
0
 public void GetPurchaseStatus()
 {
     if (iapProcessing != IAPName.None)
     {
         int statusCode = IAP.purchaseStatus(null);
         iapLockPanel.UpdateSpinner();
         if (statusCode == 0)
         {
         }
         else if (statusCode == 1)
         {
             Debug.Log("statusCode:" + statusCode);
             GameApp.GetInstance().GetGameState().DeliverIAPItem(iapProcessing);
             cashPanel.SetCash(GameApp.GetInstance().GetGameState().GetCash());
             iapLockPanel.Hide();
             iapProcessing = IAPName.None;
         }
         else
         {
             Debug.Log("statusCode:" + statusCode);
             iapLockPanel.Hide();
             iapProcessing = IAPName.None;
         }
     }
 }
Exemplo n.º 11
0
        public string UpdateCommet(GameApp ans)
        {
            //建立SqlConnectionStringBuilder
            SqlConnectionStringBuilder scsb = new SqlConnectionStringBuilder();

            scsb.DataSource     = "kabiwin.database.windows.net";
            scsb.InitialCatalog = "kabiwang";
            scsb.UserID         = "kabi";
            scsb.Password       = "******";

            //建立Entities,並設定連線字串
            kabiwangEntities ef = new kabiwangEntities();

            ef.Database.Connection.ConnectionString = scsb.ConnectionString;

            //更新從網頁上來的意見
            try
            {
                var GreatComment = ef.UserId.FirstOrDefault(n => n.Name.ToUpper() == ans.Name.ToUpper());
                GreatComment.Comment  = ans.Comment;
                GreatComment.Datetime = DateTime.Now.ToLocalTime();
                ef.SaveChanges();
            }
            catch
            {
                return("抽獎名單沒有泥哦");
            }

            return("OOOOOOOOOK");
        }
Exemplo n.º 12
0
    // Private:

    protected override void ProcessCastInput()
    {
        if (m_bSelected &&
            Input.GetMouseButtonDown(0))
        {
            Vector3 m_vCastPosition = GameApp.GetInstance().GetCursor().Get3DPosition();
            Ray     rayInfo         = Camera.main.ScreenPointToRay(m_vCastPosition);
            if (rayInfo.direction.y < 0)
            {
                Vector3 hitPos     = rayInfo.origin + (rayInfo.direction * ((-rayInfo.origin.y) / rayInfo.direction.y));
                Vector3 vTempMyPos = transform.GetComponent <CWarlockMotor>().transform.position;
                Vector3 vDistance  = vTempMyPos - hitPos;
                float   _fDistance = vDistance.magnitude;

                if (_fDistance < 0.0f)
                {
                    _fDistance *= -1.0f;
                }

                if (_fDistance <= m_fRange)
                {
                    BeginCast();
                }
            }
        }
    }
Exemplo n.º 13
0
    public override void Show()
    {
        currentSelectionWeaponIndex = 0;
        weaponScroller.Clear();
        weaponScroller.SetImageSpacing(AutoRect.AutoSize(WeaponsLogoTexturePosition.WeaponLogoSpacing));

        for (int i = 0; i < weaponList.Count; i++)
        {
            if (weaponList[i].Exist == WeaponExistState.Owned)
            {
                UIImage        uiImage = new UIImage();
                TexturePosInfo info    = WeaponsLogoTexturePosition.GetWeaponTextureRect(i);
                uiImage.SetTexture(info.m_Material, info.m_TexRect);
                weaponScroller.Add(uiImage);
            }
        }
        weaponScroller.EnableScroll();
        Material shopMaterial = UIResourceMgr.GetInstance().GetMaterial("ShopUI");

        weaponScroller.AddOverlay(shopMaterial, new Rect(720, 610, 160, 75));
        Material avatarLogoMaterial = UIResourceMgr.GetInstance().GetMaterial("Avatar");

        weaponScroller.SetMaskImage(avatarLogoMaterial, AvatarTexturePosition.Mask);

        weaponScroller.Show();

        base.Show();
        avatarFrame.ChangeAvatar(GameApp.GetInstance().GetGameState().Avatar);
        avatarFrame.Show();


        cashPanel.SetCash(gameState.GetCash());
        UpdateWeaponInfo();
        weaponInfoPanel.Show();
    }
Exemplo n.º 14
0
    // Use this for initialization
    void Start()
    {
        loadingPanel = new LoadingPanel();

        loadingPanel.Show();


        startTime = Time.time;



        m_UIManager = gameObject.AddComponent <UIManager>() as UIManager;
        m_UIManager.SetParameter(8, 1, false);
        //m_UIManager.SetUIHandler(this);

        m_UIManager.CLEAR = true;

        Transform audioFolderTrans = transform.Find("Audio");

        audioPlayer.AddAudio(audioFolderTrans, "Button");
        audioPlayer.AddAudio(audioFolderTrans, "Battle");
        GameApp.GetInstance().GetGameState().Achievement.SubmitAllToGameCenter();
        if (!GameApp.GetInstance().GetGameState().FromShopMenu)
        {
            m_UIManager.Add(loadingPanel);
        }
        StartCoroutine("Init");
    }
Exemplo n.º 15
0
    void ResetDirection()
    {
        /*
         * if (Input.deviceOrientation == DeviceOrientation.Portrait)
         * {
         *  iPhoneSettings.screenOrientation = iPhoneScreenOrientation.Portrait;
         * }
         */
#if UNITY_IPHONE
        if (GameApp.GetInstance().PreviousOrientation != Input.deviceOrientation)
        {
            FlurryTAd.RotateTad();
            GameApp.GetInstance().PreviousOrientation = Input.deviceOrientation;

            if (Input.deviceOrientation == DeviceOrientation.LandscapeRight)
            {
                iPhoneSettings.screenOrientation = iPhoneScreenOrientation.LandscapeRight;
            }
            else if (Input.deviceOrientation == DeviceOrientation.LandscapeLeft)
            {
                iPhoneSettings.screenOrientation = iPhoneScreenOrientation.LandscapeLeft;
            }
        }
#endif

        /*
         * if (Input.deviceOrientation == DeviceOrientation.PortraitUpsideDown)
         * {
         *  iPhoneSettings.screenOrientation = iPhoneScreenOrientation.PortraitUpsideDown;
         * }
         */
    }
Exemplo n.º 16
0
 private void LoadEntireTheme(string Theme)
 {
     if (Theme != null && Theme != "")
     {
         if (GameConstraints.GameThemes.ThemeLogicDirectories.Contains(Theme))
         {
             int    i         = GameConstraints.GameThemes.ThemeLogicDirectories.IndexOf(Theme);
             string realPath  = GameApp.CurDir() + GameConstraints.GameThemes.ThemePaths.ElementAt <string>(i) + "\\";
             string logicPath = Theme;
             if (!root.ContainsDirectory(logicPath))
             {
                 root.NewDirectory(logicPath);
             }
             loadMediaFiles(logicPath, realPath);
             if (!IsCaching)
             {
                 AddThemeToKeep(Theme);
             }
         }
         else
         {
             throw new Exception(Theme + " theme is not known!");
         }
     }
 }
Exemplo n.º 17
0
    public void WarlockHealth_ApplyDamage(float _fAmount, bool _bTellOthers)
    {
        if (m_bTakeDamage &&
            GameApp.GetInstance().GetSceneArena().GetState() == CSceneArena.EState.FIGHTING)
        {
            if (_bTellOthers)
            {
                networkView.RPC("WarlockHealth_ApplyDamage", RPCMode.OthersBuffered, _fAmount, false);
            }


            m_fCurrentHealth -= _fAmount;


            if (m_bAlive &&
                m_fCurrentHealth < 0)
            {
                WarlockHealth_Kill(false);                 // Don't send to others because this will be called on all clients machines
            }
            else
            {
                m_bUpdateHealthTexture = true;
            }
        }
    }
Exemplo n.º 18
0
 public void Process(float deltaTime)
 {
     if (ProcessRecycle(false))
     {
         GameApp.Instance().UnloadUnusedAsset();
     }
 }
Exemplo n.º 19
0
        static void Main(string[] args)
        {
            WindowsRuntimePlatformInfo.Initialize();

            GameApp app = null;

            try
            {
                app = new GameApp(new Startup());
                app.PrimaryArchivePath = "C:\\Development\\Anomalous\\RpgArt";
                app.run();
            }
            catch (Exception e)
            {
                Log.Default.printException(e);
                if (app != null)
                {
                    app.saveCrashLog();
                }
                String errorMessage = e.Message + "\n" + e.StackTrace;
                while (e.InnerException != null)
                {
                    e             = e.InnerException;
                    errorMessage += "\n" + e.Message + "\n" + e.StackTrace;
                }
                MessageDialog.showErrorDialog(errorMessage, "Exception");
            }
            finally
            {
                if (app != null)
                {
                    app.Dispose();
                }
            }
        }
Exemplo n.º 20
0
    void Awake()
    {
        //! 实例化 ResourceConfig
        if (GameObject.Find("ResourceConfig") == null)
        {
            GameObject resourceConfig = Object.Instantiate(Resources.Load("ResourceConfig")) as GameObject;
            resourceConfig.name = "ResourceConfig";
            DontDestroyOnLoad(resourceConfig);
        }

        //! 添加Music 对象 管理音乐播放

        if (GameObject.Find("Music") == null)
        {
            GameApp.GetInstance().Init();
            GameObject musicObj = new GameObject("Music");
            DontDestroyOnLoad(musicObj);
            musicObj.transform.position = new Vector3(0, 1, -10);
            AudioSource audioSource = musicObj.AddComponent <AudioSource>();
            audioSource.clip = GameApp.GetInstance().GetResourceConfig().menuAudio;
            musicObj.AddComponent <MenuMusicScript>();
            audioSource.loop          = true;
            audioSource.bypassEffects = true;
            audioSource.rolloffMode   = AudioRolloffMode.Linear;
            audioSource.Play();
        }
    }
Exemplo n.º 21
0
 private void btnSpecificProp7_Click(object sender, EventArgs e)
 {
     if (editLvlEditor.Mode == EditorMode.LvlPropMode)
     {
         OpenFileDialog d = new OpenFileDialog();
         d.AddExtension     = false;
         d.DefaultExt       = ".bin";
         d.Filter           = "binary files (*.bin) | *.bin";
         d.FilterIndex      = 1;
         d.InitialDirectory = GameApp.CurDir() + @"\LEVELS";
         d.RestoreDirectory = true;
         if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             txtSpecificProp7.Text = d.SafeFileName;
         }
         else
         {
             txtSpecificProp7.Text = "";
             R.r("The level has been unbound. It hasn't now any next level.\n");
         }
         PrepareToLvlProp();
     }
     else if (editLvlEditor.Mode == EditorMode.InsertMode || editLvlEditor.Mode == EditorMode.SelectMode)
     {
     }
 }
Exemplo n.º 22
0
        private static void pickLevel()
        {
            tryFileName = null;

            OpenFileDialog ofd = new OpenFileDialog();

            ofd.AddExtension     = false;
            ofd.DefaultExt       = ".bin";
            ofd.Filter           = "binary files (*.bin) | *.bin";
            ofd.FilterIndex      = 1;
            ofd.ReadOnlyChecked  = true;
            ofd.ValidateNames    = true;
            ofd.Title            = "Pick a level";
            ofd.RestoreDirectory = true;
            ofd.InitialDirectory = GameApp.CurDir() + GameConstraints.OtherPaths.Levels + @"\";
            ofd.Multiselect      = false;


            if (ofd.ShowDialog() == DialogResult.OK)
            {
                string bonDir = GameApp.CurDir() + GameConstraints.OtherPaths.Bonuses + @"\";
                string lvlDir = GameApp.CurDir() + GameConstraints.OtherPaths.Levels + @"\";
                if ((ofd.FileName.StartsWith(bonDir) || ofd.FileName.StartsWith(lvlDir)) && ofd.FileName.EndsWith(".bin"))
                {
                    int lastSlash = ofd.FileName.LastIndexOf(@"\");
                    tryFileName = ofd.FileName.Substring(lastSlash + 1);
                }
                else
                {
                    MessageBox.Show("Il file deve essere in formato .bin e deve stare nei seguenti path:\n- " + bonDir + "\n- " + lvlDir);
                }
            }
        }
Exemplo n.º 23
0
 private void tsmiSaveLevel_Click(object sender, EventArgs e)
 {
     if (editLvlEditor.IsLoaded)
     {
         if (editLvlEditor.IsABonusLevel)
         {
             if (editLvlEditor.SaveCurLevel(GameApp.CurDir() + @"\BONUSLEVELS"))
             {
                 lblMessageViewer.Text = "Bonus level saved.";
             }
             else
             {
                 lblMessageViewer.Text = "Bonus level saving aborted.";
             }
         }
         else
         {
             if (editLvlEditor.SaveCurLevel(GameApp.CurDir() + @"\LEVELS"))
             {
                 lblMessageViewer.Text = "Regular level saved.";
             }
             else
             {
                 lblMessageViewer.Text = "Regular level saving aborted.";
             }
         }
     }
     else
     {
         lblMessageViewer.Text = "Level Save aborted: no levels to save.";
     }
 }
Exemplo n.º 24
0
 private void HandleClosing()
 {
     if (editLvlEditor.IsLoaded)
     {
         DialogResult dr = MessageBox.Show(
             "Closing the editor makes you lose the unsaved progress of your previous level.\n" +
             "\"Yes\" will save your level, \"No\" will make you lose the unsaved progress, \"Cancel\" will not quit the editor.",
             "Saving current level?",
             MessageBoxButtons.YesNoCancel);
         if (dr == DialogResult.Yes)
         {
             if (editLvlEditor.IsABonusLevel)
             {
                 editLvlEditor.SaveCurLevel(GameApp.CurDir() + @"\BONUSLEVELS");
             }
             else
             {
                 editLvlEditor.SaveCurLevel(GameApp.CurDir() + @"\LEVELS");
             }
         }
         else if (dr == DialogResult.Cancel)
         {
             return;
         }
     }
     Application.Exit();
 }
Exemplo n.º 25
0
    private void OnOKBtn(GameObject go)
    {
        string str   = optionWnd.Find("LanguageSelect/CurLanguage").GetComponent <UILabel>().text;
        int    index = 0;

        switch (str)
        {
        case "中文":
            GameApp.curLanguage = LanguageType.Chinese;
            index = 1;
            break;

        case "English":
            GameApp.curLanguage = LanguageType.English;
            index = 2;
            break;

        case "Japanese":
            GameApp.curLanguage = LanguageType.Japanese;
            index = 3;
            break;
        }
        PlayerPrefs.SetInt("Language", index);
        UILabel[] labelList = GameObject.Find("UI Root (3D)").GetComponentsInChildren <UILabel>();
        foreach (UILabel u in labelList)
        {
            if (u.transform.GetComponent <SetLanguage>())
            {
                GameApp.SetText(u.transform, TableLanguage.GetInstance().GetIdByText(u.text));
            }
        }
        optionWnd.gameObject.SetActive(false);
    }
Exemplo n.º 26
0
 public void Yes()
 {
     reviewDialog.Hide();
     GameApp.GetInstance().GetGameState().AddScore(1000);
     GameApp.GetInstance().Save();
     Application.OpenURL("http://www.trinitigame.com/callofminizombies/review/");
 }
Exemplo n.º 27
0
    public IEnumerator TestYear_Next2Turns_2401Expected()
    {
        SceneManager.LoadScene("MainMenuScene");
        yield return(new WaitForSeconds(3));

        MainMenuSceneInit initializer = GameObject.Find("Initializer").GetComponent <MainMenuSceneInit>();

        initializer.ChangeScene("NewGameMapScene");
        yield return(new WaitForSeconds(3));

        GameApp gameApp = GameObject.Find("GameApp").GetComponent <GameApp>();

        gameApp.PersistAllParameters(SceneManager.GetActiveScene().name);
        gameApp.Parameters.Remove("ServerAddress");
        gameApp.Parameters.Remove("ServerPort");
        gameApp.Parameters.Add("ServerAddress", "127.0.0.1");
        gameApp.Parameters.Add("ServerPort", "9981");
        LevelLoader levelLoader = GameObject.Find("LevelLoader").GetComponent <LevelLoader>();

        levelLoader.LoadLevel("NewGameScene");
        yield return(new WaitForSeconds(3));

        NewGameSceneInit newGameSceneInit = GameObject.Find("Initializer").GetComponent <NewGameSceneInit>();

        newGameSceneInit.AddPlayer();
        newGameSceneInit.AddPlayer();
        List <GameApp.PlayerMenu> playerMenuList = new List <GameApp.PlayerMenu>();

        GameApp.PlayerMenu player1 = new GameApp.PlayerMenu
        {
            name       = "player1",
            password   = "******",
            race       = "human",
            playerType = "L"
        };
        GameApp.PlayerMenu player2 = new GameApp.PlayerMenu
        {
            name       = "player12",
            password   = "******",
            race       = "human",
            playerType = "L"
        };
        playerMenuList.Add(player1);
        playerMenuList.Add(player2);
        gameApp.SavePlayersFromMenu(playerMenuList);
        ServerNetworkManager serverNetworkManager = GameObject.Find("ServerNetworkManager").GetComponent <ServerNetworkManager>();

        serverNetworkManager.SetupNewGame();
        yield return(new WaitForSeconds(3));

        GameController gameController = GameObject.Find("GameController").GetComponent <GameController>();

        gameController.NextTurn();
        yield return(new WaitForSeconds(3));

        gameController.NextTurn();
        yield return(new WaitForSeconds(3));

        Assert.AreEqual(gameController.year, 2401);
    }
Exemplo n.º 28
0
// Member Types



// Member Functions


    // Public:


    // Protected:


    override protected void Initialise(ref string _rsDescription, ref EType _reSpellType, ref float _rfCooldownLength, ref float _rfDamageLevelIncrement,
                                       ref float _rfPushbackLevelIncrement, ref float _rfRange, ref uint _ruiCurrancyUpgradeCost, ref float _rfCastDelay)
    {
        CSpellData.TSpellData tData = GameApp.GetInstance().GetSpellDataComponent().GetSpellData(CSpell.EType.SWAP);
        _rsDescription            = tData.sDescription;
        _reSpellType              = tData.eType;
        _rfCooldownLength         = tData.fCooldown;
        _rfDamageLevelIncrement   = tData.fDamageLevelInrement;
        _rfPushbackLevelIncrement = tData.fPushbackLevelIncrement;
        _rfRange = tData.fRange;
        _ruiCurrancyUpgradeCost = tData.uiUpgradeCost;
        _rfCastDelay            = tData.fCastDelay;
        m_fRadius = tData.fRadius;

        m_fCooldownLength = tData.fCooldown;
        m_fCooldownTimerLevelIncrement = tData.fCooldownLevelIncrement;
        m_fCastDelay = tData.fCastDelay;
        m_fCastDelayLevelIncrement = tData.fCastDelayLevelIncrement;
        m_fDamageAmount            = tData.fDamage;
        m_fDamageLevelIncrement    = tData.fDamageLevelInrement;
        m_fPushbackAmount          = tData.fPushback;
        m_fPushbackLevelIncrement  = tData.fPushbackLevelIncrement;
        m_fRange = tData.fRange;
        m_fRangeLevelIncrement = tData.fRangeLevelIncrement;
        m_fRadius = tData.fRadius;
        m_fRadiusLevelIncrement = tData.fRadiusLevelIncrement;
    }
Exemplo n.º 29
0
 static void Main(string[] args)
 {
     using (GameApp game = new GameApp())
     {
         game.Run();
     }
 }
Exemplo n.º 30
0
    void Awake()
    {
        Debug.Log("GameContoller Awake");
        colorStack = new Stack <string>();

        colorStack.Push("maroon");
        colorStack.Push("lime");
        colorStack.Push("magenta");
        colorStack.Push("orange");
        colorStack.Push("blue");
        colorStack.Push("yellow");
        colorStack.Push("cyan");
        colorStack.Push("red");

        grid        = GameObject.Find("HexGrid").GetComponent <HexGrid>();
        gameApp     = GameObject.Find("GameApp").GetComponent <GameApp>();
        levelLoader = GameObject.Find("LevelLoader").GetComponent <LevelLoader>();
        turnScreen  = GameObject.Find("Canvas").GetComponentInChildren <TurnScreen>();

        // init it here, because they depends on GameController, which is started after MonoBehaviour scripts
        GameObject.Find("UpperPanel").GetComponent <UpperPanel>().Init();
        GameObject.Find("SidePanel").GetComponent <SideMenu>().Init();
        alliancePanel = GameObject.Find("AlliancePanel").GetComponent <AlliancePanel>();
        alliancePanel.Init();


        players    = new List <GameObject>();
        planets    = new List <GameObject>();
        stars      = new List <GameObject>();
        spaceships = new List <GameObject>();

        currentPlayerIndex = 0;
    }
Exemplo n.º 31
0
    void SelectWeapon(int weaponID, int selectRectIndex)
    {
        bool alreadySelected = false;

        for (int j = 0; j < SELECTION_NUM; j++)
        {
            if (rectToWeaponMap[j] != -1)
            {
                if (rectToWeaponMap[j] == weaponID)
                {
                    alreadySelected = true;
                }
            }
        }

        if (!alreadySelected)
        {
            int oldWeaponID = rectToWeaponMap[selectRectIndex];
            if (oldWeaponID != -1)
            {
                weaponList[oldWeaponID].IsSelectedForBattle = false;
            }
            weaponList[weaponID].IsSelectedForBattle = true;
            Material weaponIconMaterial = UIResourceMgr.GetInstance().GetMaterial("Weapons3");
            Rect     rect = WeaponsLogoTexturePosition.GetWeaponIconTextureRect(weaponID);
            battleWeaponGrid.SetGridTexture(selectRectIndex, weaponIconMaterial, rect);
            battleWeaponGrid.SetGridTexturePosition(selectRectIndex, selectRectIndex);
            rectToWeaponMap[selectRectIndex] = weaponID;

            avatarFrame.ChangeAvatar(GameApp.GetInstance().GetGameState().Avatar);
        }
    }
Exemplo n.º 32
0
 public static GameApp GetInstance()
 {
     if ( !s_instance ) {
         s_instance = (GameApp)GameObject.FindObjectOfType ( typeof ( GameApp ) );
         if ( !s_instance )
             Debug.LogError("There needs to be one active MyClass script on a GameObject in your scene.");
     }
     return s_instance;
 }
Exemplo n.º 33
0
        public InputManager(GameApp game)
        {
            _Mouse = new MouseManager(game);
            _MouseState = new MouseState();

            mouseX = 0;
            mouseY = 0;

            game.SetInputUpdater(Update);
            MouseClickEvent += game.onMouseClick;
        }
Exemplo n.º 34
0
        /// <summary>
        /// Called when [expose event].
        /// </summary>
        /// <param name="evnt">The evnt.</param>
        /// <returns>Reescaled success</returns>
        protected override bool OnExposeEvent(Gdk.EventExpose evnt)
        {
            bool result = base.OnExposeEvent(evnt);

            IntPtr handler = gdk_win32_drawable_get_handle(this.GdkWindow.Handle);
            if (handler != this.WindowsHandler)
            {
                this.isRegenerateHandler = true;
                this.WindowsHandler = handler;
            }
            else
            {
                this.isRegenerateHandler = false;
            }

            if (!this.isInitialized)
            {
                this.gameApp = new GameApp(this.Allocation.Width, this.Allocation.Height);

                this.gameApp.Configure(this.WindowsHandler);

                this.gameApp.Initialized += this.OnInitialized;

                this.GdkWindow.Background = new Gdk.Color(0, 0, 0);

                this.isInitialized = true;

                this.timerId = GLib.Timeout.Add(16, new GLib.TimeoutHandler(this.OnTimer));
            }
            else if (this.isRegenerateHandler)
            {
                GLib.Source.Remove(this.timerId);

                ////this.gameApp.Width = this.Allocation.Width;
                ////this.gameApp.Height = this.Allocation.Height;
                this.gameApp.Configure(this.WindowsHandler);

                GLib.Timeout.Add(16, new GLib.TimeoutHandler(this.OnTimer));
            }

            evnt.Window.Display.Sync();

            return result;
        }
Exemplo n.º 35
0
 public static void Initialize(GameApp game)
 {
     MD = new MetaData(game);
 }
Exemplo n.º 36
0
        // Called when this GLWidget has a valid GraphicsContext
        protected virtual void OnInitialized(object sender, WaveEditor.Viewport.Game e)
        {
            this.gameApp = new GameApp(this.Allocation.Width, this.Allocation.Height);
            this.gameApp.Initialize();

            // Use clock
            this.stopwatch = new global::System.Diagnostics.Stopwatch();

            if (this.Initialized != null)
            {
                this.Initialized(this, this.gameApp);
            }
        }
Exemplo n.º 37
0
 public MetaData(GameApp game)
 {
     this.game = game;
 }