示例#1
0
    public override void OnAction(GameControllerBase game)
    {
        base.OnAction(game);

        if (CalcDistance(transform.position, game.Avatar.transform.position) <= Distance && isVisible)
        {
            this.gameObject.renderer.enabled = false;
            isVisible = false;
            _readyToUse = false;

            ResetSpawn();

            PlayerAnimator.playerAnimation.Animate(PBConstants.ANIM_PICKUP, AnimationAction.Play, WrapMode.Once, 1f, 0);

            StoreItem();
        }
        else
        {
            WindowManager.CreateDialog("dlgItem", PBConstants.APP_TITLE, Lang.Localized("Jarak anda terlalu jauh untuk mengambil item ini!"), new string[] { "OK" },
            (dlg, index) =>
            {
                ((winDialog)dlg).Hide();
            }).MakeCenter(300, 200);
        }
    }
示例#2
0
    public override void OnGUI(GameControllerBase mainGame)
    {
        base.OnGUI(mainGame);

        // Display Loading Progress
        //UIProgressBar.Instance.Update(_statusText, this.loadingProgress, PBConstants.LOADINGBAR_FONTSIZE);
    }
示例#3
0
    public override void OnAction(GameControllerBase game)
    {
        base.OnAction(game);

        float currentDistance = CalcDistance(gameObject.transform.position, game.Avatar.transform.position);

        _readyToUse = false;
        string contentText = QuestionText.Replace("{WorldName}", WorldName);
        if (currentDistance <= Distance)
        {
            if (WorldName != "")
            {
                WindowManager.CreateDialog("dlgPortalLoading", hintDescription, contentText, new string[] { YesAnswer, NoAnswer }, (dlg, choice) =>
                {
                    if (choice == 0)
                    {
                        // Store the spawn group name of this portal, so the game load will pickup once the game is reloaded
                        var profile = PBDefaults.GetProfile(PBConstants.PROFILE_INGAME);
                        profile.SetString(PBConstants.PREF_SPAWNGROUP, this.SpawnGroupName);

                        Messenger<string>.Broadcast(Messages.LEVEL_CHANGE, WorldName);
                    }
                    else
                    {
                        _readyToUse = true;
                    }

                    dlg.Hide();
                }).MakeCenter(300, 200);
            }
        }
    }
 void Start()
 {
     gameController  = FindObjectOfType(typeof(GameController)) as GameController;
     initialPosition = transform.position;
     z      = 1;
     locked = true;
     moveInitial();
     //moveInitial(Transform transform, float xDest, float yDest)
 }
    private void Awake()
    {
        if (mapView == null || uiView == null)
        {
            Application.Quit();
        }

        controller = new GameController(mapView, uiView, new MapModel(), new AStarPathFinder(), new MapSaver());
    }
示例#6
0
    // Start is called before the first frame update
    void Start()
    {
        gameController = FindObjectOfType <GameControllerBase>();
        gameController.trackingHandler.OnTrackFound += OnTrackFound;
        gameController.trackingHandler.OnTrackLost  += OnTrackLost;


        placeObject.onClick.AddListener(PlaceObject);
        restartOnMain.onClick.AddListener(RestartGame);
    }
 public GLRendererTestBase()
 {
     using (var tmxStream = FileStreams.FullTmxStream())
         using (var tilesetTableStreamReader = new StreamReader(FileStreams.TilesetTableStream()))
         {
             var gameSetup = new GameSetup(tmxStream, tilesetTableStreamReader);
             m_gameController = ControllerFactory.GetController(gameSetup);
             m_gameController.Init();
         }
 }
    public override void OnGUI(GameControllerBase mainGame)
    {
        base.OnGUI(mainGame);

        /*if (PBGameMaster.GameState == GameStateType.EnterWorld)
        {
            UIProgressBar.Instance.Update(PBConstants.LOADINGBAR_LOADING, 0, PBConstants.LOADINGBAR_FONTSIZE);

            return;
        }*/
    }
        public void Dispose()
        {
            if (m_disposed)
                return;

            GameController.Dispose();
            // Test repeated Dispose()
            GameController.Dispose();
            GameController = null;

            m_disposed = true;
        }
示例#10
0
        public GameControllerTestBase()
        {
            var tmxMemoryStream          = FileStreams.SmallTmx();
            var tilesetTableMemoryStream = FileStreams.TilesetTableStream();

            var tilesetTableStreamReader = new StreamReader(tilesetTableMemoryStream);

            var gameSetup = new GameSetup(tmxMemoryStream, tilesetTableStreamReader);

            GameController = GetController(gameSetup);

            GameController.Init();
        }
        public GameControllerTestBase()
        {
            var tmxMemoryStream = FileStreams.SmallTmx();
            var tilesetTableMemoryStream = FileStreams.TilesetTableStream();

            var tilesetTableStreamReader = new StreamReader(tilesetTableMemoryStream);

            var gameSetup = new GameSetup(tmxMemoryStream, tilesetTableStreamReader);

            GameController = GetController(gameSetup);

            GameController.Init();
        }
示例#12
0
        private void Go()
        {
            isGoing = true;
            if (controllerBase == null)
            {
                controllerBase = target as GameControllerBase;
            }


            //创建数据
            GameData sceneData = ScriptableObject.CreateInstance <GameData>();



            if (sceneData != null)
            {
                sceneData.name  = SceneManager.GetActiveScene().name;
                sceneData.opNum = FindObjectsOfType <DiamantController>().Length;
            }
            else
            {
                isGoing = false;
                return;
            }

            string SceneDataPath = "Assets/Scripts/RubiksAndAngieBase/GameData";

            string path;

            path = SceneDataPath + "/Data";

            //检查保存路径
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }


            //删除原有文件,生成新文件
            string fullPath = path + "/" + sceneData.name + "_" + "GameData.asset";

            UnityEditor.AssetDatabase.DeleteAsset(fullPath);
            UnityEditor.AssetDatabase.CreateAsset(sceneData, fullPath);
            UnityEditor.AssetDatabase.Refresh();

            sceneData.DataName = sceneData.name;

            controllerBase.gameData = sceneData;
            //isError = false;
            isGoing = false;
        }
    public override void OnConnect(GameControllerBase mainGame)
    {
        base.OnConnect(mainGame);

        Debug.Log("MainGame: Connected");

        // Setup our Inventory and Quest Engine
        InventoryEngine.Instance.Initialize(mainGame);
        QuestEngine.Instance.Initialize(mainGame);
        DialogEngine.Instance.Initialize(mainGame);

        PBGameMaster.GameState = GameStateType.Connected;

        if (Application.platform == RuntimePlatform.WindowsEditor)
        {
            mainGame.Game.Avatar.Token = "b184145cd5405aa0cadd91c724198613";//"f8caa53b14f9d5d35fdc84756c5ff8ba";
        }
        else if (Application.platform == RuntimePlatform.WindowsPlayer)
        {
            mainGame.Game.Avatar.Token = "f61297bd64ce510052c3864b2fe22d02";
        }

        if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.OSXEditor ||
            Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.OSXPlayer)
        {
            if (_loaderPref.GetInt(PBConstants.PREF_LOGGEDIN) == 1)
            {
                PBGameMaster.GameState = GameStateType.Authenticating;

                string username = _loaderPref.GetString(PBConstants.PREF_USERNAME);
                string password = _loaderPref.GetString(PBConstants.PREF_PASSWORD);

                Debug.Log("MainGame: Logging in with Username: "******", Password: "******"MainGame: Authenticating... with Token: " + mainGame.Game.Avatar.Token);

            mainGame.Game.Avatar.Authenticate(mainGame.Game.Avatar.Token);
        }
    }
示例#14
0
        public static MainController Get()
        {
            if (mainController == null)
            {
                mainController = new MainController
                {
                    Configuration = Configuration.Load(),
                    Logger        = new LoggerService(),
                };
                gameController = new MockGameController();
            }

            return(mainController);
        }
示例#15
0
        public void Dispose()
        {
            if (m_disposed)
            {
                return;
            }

            GameController.Dispose();
            // Test repeated Dispose()
            GameController.Dispose();
            GameController = null;

            m_disposed = true;
        }
示例#16
0
    void Start()
    {
        gameController = FindObjectOfType(typeof(GameController)) as GameController;

        coroutine = waith();
        StartCoroutine("waith");
        x = transform.localScale.x;
        y = transform.localScale.y;
        //z = transform.localScale.z;

        xN = x * 2f;
        yN = y * 2f;

        locked         = false;
        estaArrastando = false;
    }
示例#17
0
 void Start()
 {
     if (dinamico)
     {
         gameController = FindObjectOfType(typeof(GCEscreverDinamicoObjetos)) as GCEscreverDinamicoObjetos;
     }
     else
     {
         gameController = FindObjectOfType(typeof(GameController)) as GameController;
     }
     initialPosition = transform.position;
     z      = 1;
     locked = true;
     moveInitial();
     //moveInitial(Transform transform, float xDest, float yDest)
 }
示例#18
0
    public override void OnWorldEntered(GameControllerBase mainGame)
    {
        base.OnWorldEntered(mainGame);

        PBGameMaster.GameState = GameStateType.WorldEntered;

        WindowManager.IsVisible = true;

        mainGame.CreateAvatar(mainGame.Game);

        Operations.RadarSubscribe(mainGame.Game.Peer, mainGame.Game.WorldData.Name);

        // Unload unneeded assets
        Resources.UnloadUnusedAssets();

        // Finished and removed our loading background
        MainController.SetLoadingFinished();
    }
示例#19
0
    public override void OnWorldStartDownload(GameControllerBase mainGame)
    {
        base.OnWorldStartDownload(mainGame);

        Level level = mainGame.Game.WorldData.Level;

        MainController.SetLoadingText(PBConstants.LOADINGBAR_LOADING);

        mainGame.Game.Listener.LogDebug(mainGame.Game, string.Format("Tile ({0}, {1}), Grid ({2}, {3})", level.InterestArea[0], level.InterestArea[1], level.WorldSize[0], level.WorldSize[1]));

        try
        {
            PBGameMaster.GameTime = DateTime.Parse(level.StartDateTime);
        }
        catch (System.Exception ex)
        {
            Debug.LogWarning("Invalid Game Time: " + level.StartDateTime + " => " + ex.ToString());
            PBGameMaster.GameTime = DateTime.Now;
        }

        //loadingProgress = 0;
        MainController.SetLoadingProgess(0);
        MainController.SetLoadingText(PBConstants.LOADINGBAR_LOADING);

        _progress = 0;
        _isDownload = true;
        _downloadState = DownloadStateType.Level;
        //_statusText = PBConstants.LOADINGBAR_LOADING;

        // Register Gesticon Engine to the game data loader
        GesticonEngine.Instance.Register();

        // Register the Inventory Engine into the game data loader
        InventoryEngine.Instance.Register();

        // Register dialog engine into the game data loader
        DialogEngine.Instance.Register();

        // Register our Quest engine into the game data loader
        QuestEngine.Instance.Register();

        // Prepare all the data loaders
        GameDataLoader.Prepare();
    }
    // Start is called before the first frame update
    void Start()
    {
        if (tipoDinamico.Equals("Cores"))
        {
            audioController = FindObjectOfType(typeof(AudioController)) as AudioController;
            gameController  = FindObjectOfType(typeof(GameControllerDinamicoCores)) as GameControllerDinamicoCores;
        }
        else if (tipoDinamico.Equals("Sons"))
        {
            audioController = FindObjectOfType(typeof(AudioController)) as AudioController;
            gameController  = FindObjectOfType(typeof(GameControllerDinamicoAnimais)) as GameControllerDinamicoAnimais;
        }

        if (playinicial)
        {
            //coroutine = playAudioEnumSon();
            //StartCoroutine("playAudioEnumSon");
        }
    }
    public override void OnDisconnect(GameControllerBase mainGame, ExitGames.Client.Photon.StatusCode returnCode)
    {
        base.OnDisconnect(mainGame, returnCode);

        _isDisconnected = true;
        _counter = 10;  // 10 seconds countdown

        Debug.Log("MainGame: Disconnected with returnCode " + returnCode);

        WindowManager.IsVisible = false;

        Messenger<string>.Broadcast(Messages.BANNER_CHANGE, "GUI/Banner/ditu_bg");
        Messenger<bool>.Broadcast(Messages.BANNER_SETVISIBILITY, true);

        PBGameMaster.GameState = GameStateType.Disconnected;

        //mainGame.Clear();

        _countdownTimer.Start();
    }
示例#22
0
    public override void OnAction(GameControllerBase game)
    {
        base.OnAction(game);

        Transform position = GetAvailablePosition();

        // Do not turn on the interaction hint
        _readyToUse = false;

        ItemInteractionType interactionType = ItemInteractionType.Sit;
        var target = position.gameObject.GetComponent<ItemInteractionTarget>();
        if (target != null)
        {
            interactionType = target.interactionType;
        }

        if (position != null)
        {
            Messenger<ItemInteraction, Transform, ItemInteraction.ItemInteractionType>.Broadcast(Messages.PLAYER_INTERACTO, this, position, interactionType, MessengerMode.DONT_REQUIRE_LISTENER);
        }
    }
示例#23
0
    public override void OnRadarUpdate(GameControllerBase mainGame, string itemId, byte itemType, float[] position)
    {
        base.OnRadarUpdate(mainGame, itemId, itemType, position);

        itemId += itemType;

        if (position == null)
        {
            PBGameMaster.ItemPositions.Remove(itemId);
            return;
        }

        Vector3 pos = new Vector3(position[0], position[1], position.Length > 2 ? position[2] : 0f);

        if (PBGameMaster.ItemPositions.ContainsKey(itemId) == false)
        {
            PBGameMaster.ItemPositions.Add(itemId, pos);
            return;
        }

        PBGameMaster.ItemPositions[itemId] = pos;
    }
    public override void OnAuthenticated(GameControllerBase mainGame, bool isAuth)
    {
        base.OnAuthenticated(mainGame, isAuth);

        if (isAuth == false)	// not authenticated
        {
            if (mainGame.loginWindow == null)
            {
                mainGame.Game.Avatar.Disconnect();
            }
            else
            {
                PBGameMaster.GameState = GameStateType.Disconnected;
                mainGame.loginWindow.InfoText = "Failed...";

                _loaderPref.SetInt(PBConstants.PREF_LOGGEDIN, 0);

                mainGame.ShowLoginWindow();
            }
        }
        else
        {
            if (mainGame.loginWindow != null)
            {
                mainGame.loginWindow.Hide();
            }

            _loaderPref.SetInt(PBConstants.PREF_LOGGEDIN, 1);
            _loaderPref.SetString(PBConstants.PREF_USERNAME, mainGame.Game.Avatar.Username);
            _loaderPref.SetString(PBConstants.PREF_PASSWORD, mainGame.Game.Avatar.Password);

            mainGame.Game.Avatar.LoadWorld(mainGame.Game.Settings.IsPrivateRoom);

            PBGameMaster.GameState = GameStateType.Loading;
        }
    }
示例#25
0
 public override void OnReceivedChatMessage(GameControllerBase mainGame, PB.Client.Item item, string[] group, string message)
 {
     base.OnReceivedChatMessage(mainGame, item, group, message);
 }
示例#26
0
 public Detector(GameControllerBase game)
 {
     this.Game = game;
 }
示例#27
0
 public virtual void Initialize(GameControllerBase gameController)
 {
     this.GameController = gameController;
 }
示例#28
0
    protected void OnInstantiateSkybox(GameControllerBase mainGame, UnityEngine.Object obj)
    {
        RenderSettings.skybox = (Material)obj;

        try
        {
            // Setup the fog
            Fog fog = mainGame.Game.WorldData.Level.Fog;
            RenderSettings.fog = fog.active;
            RenderSettings.fogColor = new Color(fog.color.x, fog.color.y, fog.color.z, fog.color.w);
            RenderSettings.fogDensity = fog.density;
            RenderSettings.fogStartDistance = fog.startDistance;
            RenderSettings.fogEndDistance = fog.endDistance;
            RenderSettings.fogMode = (FogMode)Enum.Parse(typeof(FogMode), fog.fogMode);
        }
        catch (Exception ex)
        {
            Debug.LogError("IslandGame.OnInstantiateSkybox.Fog: " + ex.ToString());
        }
    }
    public override void OnGUI(GameControllerBase mainGame)
    {
        base.OnGUI(mainGame);

        //UIProgressBar.Instance.Update(PBConstants.LOADINGBAR_CONNECTING, 0, PBConstants.LOADINGBAR_FONTSIZE);
    }
示例#30
0
    public override void OnInventoriesReceived(GameControllerBase mainGame, Inventories inventories)
    {
        base.OnInventoriesReceived(mainGame, inventories);

        InventoryEngine.Instance.SetInventories(inventories);
    }
示例#31
0
 protected void OnInstantiateAudio(GameControllerBase mainGame, UnityEngine.Object obj)
 {
     _backgroundSound = (AudioClip)obj;
     mainGame.SetupBackgroundSound(_backgroundSound);
 }
示例#32
0
    protected void OnInstantiateLevelEntity(GameControllerBase mainGame, UnityEngine.Object obj, Vector3 position, Vector3 rotation, string tag, int lightmapIndex, Vector4 lightmapTilingOffset)
    {
        if (PopBloopSettings.useLogs)
        {
            Debug.Log(string.Format("MainGame: Instantiating object '{0}', Lightmap Index: {1}, LightmapTilingOffset: {2},{3},{4},{5}", obj.name, lightmapIndex, lightmapTilingOffset.x, lightmapTilingOffset.y, lightmapTilingOffset.z, lightmapTilingOffset.w));
        }

        GameObject go = AssetsManager.Instantiate(obj);

        if (go != null)
        {
            go.transform.position = position;
            go.transform.rotation = Quaternion.Euler(rotation);
            go.transform.tag = tag;

            if (PopBloopSettings.useLogs)
            {
                //Debug.Log("Lightmap Object: " + go.name + " => Index: " + lightmapIndex.ToString());
            }

            if (go.renderer != null && mainGame.Game.WorldData.Level.Lightmap.lightmaps.Count > 0)
            {
                go.renderer.lightmapIndex = lightmapIndex;
                go.renderer.lightmapTilingOffset = lightmapTilingOffset;
            }

            if (go.tag == LevelConstants.TagItem)
            {
                ItemBase item = go.GetComponent<ItemBase>();
                if (item != null)
                {
                    item.drawGizmo = false;
                }
            }

            if (go.tag == LevelConstants.TagNPC)
            {
                ItemNPC npc = go.GetComponent<ItemNPC>();
                npc.drawGizmo = false;
            }

            if (go.tag == LevelConstants.TagSpawnPoints)
            {
                PBGameMaster.SpawnPoints.Add(go.transform);
            }

            if (PBGameMaster.Objects.ContainsKey(go.name) == false)
            {
                PBGameMaster.Objects.Add(go.name, go);
            }
        }
        else
        {
            Debug.Log("MainGame: Instantiating " + obj.name + " failed");
        }
    }
示例#33
0
    private void ReportProgress(GameControllerBase mainGame, int counter, int totalDownloads)
    {
        if (counter > totalDownloads)
        {
            counter = totalDownloads;
        }

        float newProgress = (float)counter / (float)totalDownloads;

        // Calculate progress and inform listener about the progress

        if (_progress != newProgress)
        {
            //this.loadingProgress = _progress;
            //Debug.Log(string.Format("Counter: {0}, Total: {1}, Progress: {2}", counter, totalDownloads, newProgress));
            MainController.SetLoadingProgess(_progress);
        }
        _progress = newProgress;
    }
示例#34
0
    private int GetLevelTotalDownloads(GameControllerBase mainGame)
    {
        Level level = mainGame.Game.WorldData.Level;

        return level == null ? 0 : level.Lightmap.lightmaps.Count + level.Entities.Count + (level.Audio != "" ? 1 : 0) + (level.Skybox != "" ? 1 : 0) - 1;
    }
示例#35
0
    private bool DownloadWorldLevel(GameControllerBase mainGame)
    {
        WWW asset = null;
        if (mainGame.Game.WorldData.Level != null)
        {
            Level level = mainGame.Game.WorldData.Level;

            string path = PopBloopSettings.LevelAssetsUrl + level.Path + "/";

            _counter = 0;

            int totalDownloads = GetLevelTotalDownloads(mainGame);

            // Download the skybox
            if (level.Skybox != "")
            {
                _counter++;
                ReportProgress(mainGame, _counter, totalDownloads);

                asset = AssetsManager.DownloadAssetBundleAbsolute(path + level.Skybox);
                if (asset.isDone == false)
                {
                    return false;
                }
                if (asset.error != null)
                {
                    Debug.LogError("LoadWorld: error downloading " + path + level.Skybox + "=> " + asset.error);
                    asset = AssetsManager.RetryDownloadAssetBundleAbsolute(path + level.Skybox);
                    return false;
                }
            }

            // Download the Lightmaps
            if (level.Lightmap.lightmaps.Count > 0)
            {
                foreach (LightmapDataInfo lmData in level.Lightmap.lightmaps)
                {
                    _counter++;
                    ReportProgress(mainGame, _counter, totalDownloads);

                    if (lmData.nearLightmap != "")
                    {
                        string nearLightmap = string.Format("{0}{1}", path, lmData.nearLightmap);

                        asset = AssetsManager.DownloadAssetBundle(nearLightmap);
                        if (asset.isDone == false)
                        {
                            return false;
                        }

                        if (asset.error != null)
                        {
                            Debug.LogError("LoadWorld: error downloading " + nearLightmap + "=> " + asset.error);
                            asset = AssetsManager.RetryDownloadAssetBundleAbsolute(nearLightmap);
                            return false;
                        }

                    }

                    if (lmData.farLightmap != "")
                    {
                        string farLightmap = string.Format("{0}{1}", path, lmData.farLightmap);
                        asset = AssetsManager.DownloadAssetBundle(farLightmap);
                        if (asset.isDone == false)
                        {
                            return false;
                        }

                        if (asset.error != null)
                        {
                            Debug.LogError("LoadWorld: error downloading " + farLightmap + "=> " + asset.error);
                            asset = AssetsManager.RetryDownloadAssetBundleAbsolute(farLightmap);
                            return false;
                        }
                    }
                }
            }

            // Download the audio
            if (level.Audio != "")
            {
                _counter++;
                ReportProgress(mainGame, _counter, totalDownloads);

                asset = AssetsManager.DownloadSoundAbsolute(path + level.Audio);

                if (asset.isDone == false)
                {
                    return false;
                }

                if (asset.error != null)
                {
                    Debug.LogError("LoadWorld: error downloading " + path + level.Skybox + "=> " + asset.error);
                    asset = AssetsManager.RetryDownloadAssetBundleAbsolute(path + level.Audio);

                    return false;
                }
            }

            // First, we download all the entities, don't instantiate it yet
            foreach (Entity entity in level.Entities)
            {
                _counter++;
                ReportProgress(mainGame, _counter, totalDownloads);

                string bundle = path + entity.FilePath;

                // return false if the download is not completed
                asset = AssetsManager.DownloadAssetBundleAbsolute(bundle);

                if (asset.isDone == false)
                {
                    return false;
                }

                if (asset.error != null)
                {
                    Debug.LogError("LoadWorld: error downloading " + path + level.Skybox + "=> " + asset.error);
                    asset = AssetsManager.RetryDownloadAssetBundleAbsolute(bundle);
                    return false;
                }
            }

            ReportProgress(mainGame, totalDownloads, totalDownloads);

            // Instantiate the skybox
            if (level.Skybox != "")
            {
                AssetBundle bundle = AssetsManager.Bundles[path + level.Skybox].assetBundle;
                UnityEngine.Object obj = bundle.mainAsset;
                OnInstantiateSkybox(mainGame, obj);
                bundle.Unload(false);
            }

            // Instantiate the Lightmaps
            if (level.Lightmap.lightmaps.Count > 0)
            {
                OnInstantiateLightmaps(mainGame, level.Lightmap);
            }

            // Insntatiate the audio
            if (level.Audio != "")
            {
                UnityEngine.Object obj = AssetsManager.Sounds[path + level.Audio].GetAudioClip(false);
                OnInstantiateAudio(mainGame, obj);
            }

            // Now, we have all the entities downloaded, instantiate them all
            foreach (Entity entity in level.Entities)
            {
                string bundlePath = path + entity.FilePath;

                AssetBundle bundle = AssetsManager.Bundles[bundlePath].assetBundle;
                UnityEngine.Object obj = bundle.mainAsset;

                // Set the entity position and rotation
                Vector3 pos = new Vector3(entity.Position.x, entity.Position.y, entity.Position.z);
                Vector3 rot = new Vector3(entity.Rotation.x, entity.Rotation.y, entity.Rotation.z);

                Vector4 tilingOffset = new Vector4(entity.LightmapTilingOffset.x, entity.LightmapTilingOffset.y, entity.LightmapTilingOffset.z, entity.LightmapTilingOffset.w);

                OnInstantiateLevelEntity(mainGame, obj, pos, rot, entity.Tag, entity.LightmapIndex, tilingOffset);

                bundle.Unload(false);
            }

            return true;
        }
        else
        {
            mainGame.Game.Listener.LogError(mainGame.Game, "Level " + mainGame.Game.WorldData.Name + "  is invalid");
            mainGame.Game.SetDisconnected(StatusCode.Exception);
        }

        return false;
    }
示例#36
0
    protected void OnWorldLoaded(GameControllerBase mainGame)
    {
        //loadingProgress = 0;
        MainController.SetLoadingProgess(0);

        // Setup the Inventories and Quests
        SetupInventoriesAndQuests(mainGame.Game);

        // Enter World only when we are not in the private room
        mainGame.Game.Avatar.EnterWorld();

        PBGameMaster.GameState = GameStateType.EnterWorld;
    }
示例#37
0
 public void Initialize(GameControllerBase mainGame)
 {
     _gameController = mainGame;
 }
示例#38
0
    public override void Update(GameControllerBase mainGame)
    {
        base.Update(mainGame);

        if (_isDownload)
        {
            switch (_downloadState)
            {
                case DownloadStateType.Level:
                    {
                        if (DownloadWorldLevel(mainGame))
                        {
                            _downloadState = DownloadStateType.GameData;
                        }
                    }
                    break;

                case DownloadStateType.GameData:
                    {
                        //_statusText = GameDataLoader.GetCurrentStatusText;
                        //loadingProgress = GameDataLoader.CurrentProgress;
                        MainController.SetLoadingText(GameDataLoader.GetCurrentStatusText);
                        MainController.SetLoadingProgess(GameDataLoader.CurrentProgress);
                        if (GameDataLoader.Download())
                        {
                            _isDownload = false;
                            OnWorldLoaded(mainGame);
                        }
                    }
                    break;

            }
        }
    }
示例#39
0
    public override void OnEquipmentsReceived(GameControllerBase mainGame, Equipments equipments)
    {
        base.OnEquipmentsReceived(mainGame, equipments);

        InventoryEngine.Instance.SetEquipments(equipments);
    }
示例#40
0
 public void SetGame(GameControllerBase controller)
 {
     gameController = controller;
     controller.HandleStartup();
 }
示例#41
0
    protected void OnInstantiateLightmaps(GameControllerBase mainGame, PB.Common.LightmapInfo lightmap)
    {
        if (lightmap.lightmapsMode != "" && lightmap.lightmapsMode != null && lightmap.lightmaps.Count > 0)
        {
            LightmapsMode mode = (LightmapsMode)Enum.Parse(typeof(LightmapsMode), lightmap.lightmapsMode);
            LightmapSettings.lightmapsMode = mode;

            List<LightmapData> maps = new List<LightmapData>();
            Level level = mainGame.Game.WorldData.Level;
            foreach (LightmapDataInfo lmData in level.Lightmap.lightmaps)
            {
                LightmapData data = new LightmapData();

                string nearKey = string.Format("{0}{1}/{2}.unity3d", PopBloopSettings.LevelAssetsUrl, level.Path, lmData.nearLightmap);
                string farKey = string.Format("{0}{1}/{2}.unity3d", PopBloopSettings.LevelAssetsUrl, level.Path, lmData.farLightmap);

                if (lmData.nearLightmap != "" && AssetsManager.Bundles.ContainsKey(nearKey))
                {
                    WWW www = AssetsManager.Bundles[nearKey];

                    if (www.assetBundle != null)
                    {
                        data.lightmapNear = (Texture2D)www.assetBundle.mainAsset;
                    }
                    else
                    {
                        Debug.LogWarning("OnInstantiateLightmaps.NearLightMaps: AssetBundle not found on " + nearKey);
                    }
                }

                // Setup Far Lightmap if there is
                if (lmData.farLightmap != "" && AssetsManager.Bundles.ContainsKey(farKey))
                {
                    WWW www = AssetsManager.Bundles[farKey];

                    if (www.assetBundle != null)
                    {
                        data.lightmapFar = (Texture2D)www.assetBundle.mainAsset;
                    }
                    else
                    {
                        Debug.LogWarning("OnInstantiateLightmaps.FarLightMaps: AssetBundle not found on " + farKey);
                    }
                }

                maps.Add(data);
            }

            if (maps.Count > 0)
            {
                LightmapSettings.lightmaps = maps.ToArray();
            }
        }
    }
示例#42
0
 public virtual void OnAction(GameControllerBase game)
 {
 }