public void Awake() {
     if (Instance != null && Instance != this) {
         Destroy(Instance.gameObject);
     }
     Instance = this; //shitty singleton, but anything more ruins everything for whatever reason.
                      // I'm not even mad rn.
 }
 void Start()
 {
     dm = displayManagerObject.GetComponent<DisplayManager> ();
     currVol = 0;
     nextVol = 0;
     t = this.GetComponent<Text> ();
 }
    void Awake()
    {
        modalPanel = ModalPanel.Instance();
        displayManager = DisplayManager.Instance();

        //myOpt1Action = new UnityAction(TestOpt1);
        //myOpt2Action = new UnityAction(TestOpt2);
        //myOpt3Action = new UnityAction(TestOpt3);
    }
Beispiel #4
0
    void Awake()
    {
        modalPanel = ModalPanel.Instance();
        displayMan = DisplayManager.Instance();

        myYesAction = new UnityAction(TestYesFunc);			//
        myNoAction = new UnityAction(TestNoFunc);			//unityactions are assigned to their respective functions
        myCancelAction = new UnityAction(TestCancelFunc);	//
    }
 public static DisplayManager Instance () {
     if (!displayManager) {
         displayManager = FindObjectOfType(typeof (DisplayManager)) as DisplayManager;
         if (!displayManager)
             Debug.LogError ("There needs to be one active DisplayManager script on a GameObject in your scene.");
     }
     
     return displayManager;
 }
Beispiel #6
0
		public void Init()
		{
			PresentationPanel = new PresentationPanel(this, GL);
			CR_GL = GLManager.GetContextForIGL(GL);
			DisplayManager = new DisplayManager(PresentationPanel, GL ,GLManager);

			Controls.Add(PresentationPanel);
			Controls.SetChildIndex(PresentationPanel, 0);
		}
Beispiel #7
0
 public void setPayed(bool cardPayed)
 {
     if (cardPayed)
     {
         gameObject.GetComponent <UISprite>().color = DisplayManager.HexToColor("404242");
     }
     else
     {
         gameObject.GetComponent <UISprite>().color = DisplayManager.HexToColor("ffffff");
     }
 }
Beispiel #8
0
 public void cmdDisconnect_Click(object sender, object e)
 {
     if (UVDLPApp.Instance().m_deviceinterface.Connected) // disconnect
     {
         DebugLogger.Instance().LogRecord("Disconnecting from Printer");
         UVDLPApp.Instance().m_deviceinterface.Disconnect();
         UVDLPApp.Instance().RaiseAppEvent(eAppEvent.eMachineDisconnected, "Printer connection closed");
     }
     //terminate connections to projector Drivers
     DisplayManager.Instance().DisconnectAllMonitorSerial();
 }
Beispiel #9
0
 public void EnterZone(object sender, CommandCenterEventArgs args)
 {
     //the GameInterface_Graphics Graphics is loaded only once
     if (DisplayManager.GameInterfaceLoaded == false)
     {
         LoadGameInterfaceGraphics(args.ZoneName);
     }
     else
     {
         DisplayManager.DisplayGame();
     }
 }
        /**
         * Constructs the DisplayRotationHelper but does not register the listener yet.
         *
         * @param context the Android {@link Context}.
         */
        public DisplayRotationHelper(Context context)
        {
            ///mContext = context;
            ///mDisplay = context.GetSystemService(Java.Lang.Class.FromType(typeof(IWindowManager)))
            ///                  .JavaCast<IWindowManager>().DefaultDisplay;

            mDisplayManager = (DisplayManager)context.GetSystemService(Context.DisplayService);
            mCameraManager  = (CameraManager)context.GetSystemService(Context.CameraService);
            ///WindowManager windowManager = (IWindowManager)context.GetSystemService(Context.WindowService);
            mDisplay = context.GetSystemService(Java.Lang.Class.FromType(typeof(IWindowManager)))
                       .JavaCast <IWindowManager>().DefaultDisplay;
        }
Beispiel #11
0
        public SfM(FileManager fileManager, DisplayManager displayManager, MainForm winForm, CameraManager cameraManager)
        {
            Directory.CreateDirectory(tempDirectory);
            DetectedKeyPoints   = new SortedList <int, KeyPointModel>();
            ComputedDescriptors = new SortedList <int, DescriptorModel>();
            FoundedMatches      = new List <DescriptorsMatchModel>();

            this.fileManager    = fileManager;
            this.displayManager = displayManager;
            this._winForm       = winForm;
            this.cameraManager  = cameraManager;
        }
Beispiel #12
0
 public void LoadGame(object sender, MainMenuEventArgs args)
 {
     //the CommandCenter Graphics is loaded only once
     if (DisplayManager.CommandCenterLoaded == false)
     {
         LoadCommandCenterGraphics();
     }
     else
     {
         DisplayManager.InstanciateInterface(IOOperation.CommandCenter);
     }
 }
Beispiel #13
0
 public static DisplayManager Instance()
 {
     if (!displayManager)
     {
         displayManager = FindObjectOfType(typeof(DisplayManager)) as DisplayManager;
         if (!displayManager)
         {
             Debug.LogError("There can be only one");
         }
     }
     return(displayManager);
 }
Beispiel #14
0
 /**
  * Initializes manager
  */
 public override void Start()
 {
     if (displayManager == null)
     {
         DontDestroyOnLoad(gameObject);
         displayManager = this;
     }
     else if (displayManager != this)
     {
         Destroy(gameObject);
     }
 }
        public ScreensModule(DisplayManager screenManager)
            : base("screens")
        {
            _screenManager = screenManager;

            Get["/"]           = GetScreens;
            Get["/{clientid}"] = GetScreensById;

            Post["/regions/{clientid}"]   = PostRegion;
            Put["/regions/{clientid}"]    = PutRegion;
            Delete["/regions/{clientid}"] = DeleteRegion;
        }
Beispiel #16
0
 void OnEnable()
 {
     manager = FindObjectOfType <DisplayManager>();
     if (screenShowWait > 0.0f)
     {
         GetComponent <Image>().enabled = false;
     }
     if (autoStart)
     {
         StartDisplay();
     }
 }
    // This function sets the current tweet for the user.
    public void setTweet(Status tweet)
    {
        if (tweet == null)
        {
            DisplayManager.PushNotification("Something went wrong! Can't select the current tweet.");
            homeTimelineOverviewObjects.SetActive(true);
            homeTimeLineObjects.SetActive(false);
            return;
        }

        twitterHandle.text = "@" + tweet.User.ScreenName;
        realName.text      = tweet.User.Name;
        bodyText.text      = tweet.Text;

        if (tweet.FullText != null && string.IsNullOrEmpty(tweet.FullText))
        {
            bodyText.text = tweet.FullText;
        }
        else
        {
            bodyText.text = tweet.Text;
        }

        retweetsCount.text  = tweet.RetweetCount.Value.ToString();
        favoritesCount.text = tweet.FavoriteCount.Value.ToString();

        Debug.Log("Reply to screename: " + tweet.InReplyToScreenName);
        Debug.Log("Reply to status: " + tweet.InReplyToStatusId);

        if (!string.IsNullOrEmpty(tweet.InReplyToScreenName))
        {
            replyToUsername.text = "In Reply To @" + tweet.InReplyToScreenName;
        }
        else if (tweet.IsRetweeted.Value)
        {
            replyToUsername.text = "Retweeted from @" + tweet.RetweetedStatus.User.ScreenName;
        }

        // Set the time stamp to be text such as "2 seconds ago"
        timeStamp.text = Utilities.ElapsedTime(tweet.CreatedAt.DateTime);

        // If there are no images in the tweet, disable the button
        Boolean imageButtonEnabled = tweet.Entities != null && tweet.Entities.Media != null && tweet.Entities.Media.Length > 0;

        imagesButton.enabled      = imageButtonEnabled;
        imagesButton.interactable = imageButtonEnabled;

        privateMessageButton.enabled      = tweet.User.IsFollowRequestSent.Value;
        privateMessageButton.interactable = tweet.User.IsFollowRequestSent.Value;

        // Populate the profile picture for the user, requires a separate thread to run.
        StartCoroutine(setProfilePic(Utilities.cleanProfileImageURL(tweet)));
    }
    // Contact the twitter api to send a message to the user
    public void Message(string msg)
    {
        try {
            authHandler.makeTwitterAPICallNoReturnVal(() => authHandler.Interactor.createDM(currentTweet.User.ScreenName, msg));               // send the message to the user
            DisplayManager.PushNotification("Messaged!");
        } catch (Exception e) {
            DisplayManager.PushNotification("Failed to message: Connection error. Please check your internet.");

            Debug.Log("Failed to message " + e);
            Crashlytics.RecordCustomException("Twitter Exception", "thrown exception", e.StackTrace);
        }
    }
Beispiel #19
0
 /// <summary>
 /// Creates and allows one instance of this object.
 /// </summary>
 private void CreateSingleton()
 {
     if (displayManager == null)
     {
         DontDestroyOnLoad(gameObject.transform.parent.gameObject);
         displayManager = this;
     }
     else if (displayManager != this)
     {
         Destroy(gameObject);
     }
 }
 public RfcommServiceManager(
     PlaybackService playbackService,
     DisplayManager displayManager,
     CommandProcessor.CommandProcessor commandProcessor,
     HttpServer httpServer)
 {
     this.playbackService  = playbackService;
     this.displayManager   = displayManager;
     this.commandProcessor = commandProcessor;
     this.httpServer       = httpServer;
     this.commandProcessor.NotifyCallerEventHandler += this.CommandProcessor_NotifyCallerEventHandler;
 }
 public static DisplayManager Instance()
 {
     if (!displayManager)
     {
         displayManager = FindObjectOfType(typeof(DisplayManager)) as DisplayManager;
         if (!displayManager)
         {
             Debug.LogError("There needs to be one active DisplayManager script on a GameObject in your scene.");
         }
     }
     return(displayManager);
 }
 /// <summary>
 /// Starts Hebrew Words.
 /// </summary>
 static public void OpenHebrewWordsGoToVerse(string reference, string path)
 {
     if (File.Exists(path))
     {
         SystemManager.RunShell(path, "--verse " + reference);
     }
     else
     if (DisplayManager.QueryYesNo(HebrewTranslations.AskToDownloadHebrewWords.GetLang()))
     {
         SystemManager.RunShell(Globals.AuthorProjectsURL + "/hebrew-words");
     }
 }
 /// <summary>
 /// Starts Hebrew Words.
 /// </summary>
 static public void OpenHebrewWordsSearchTranslated(string word, string path)
 {
     if (File.Exists(path))
     {
         SystemManager.RunShell(path, "--translated " + word);
     }
     else
     if (DisplayManager.QueryYesNo(HebrewTranslations.AskToDownloadHebrewWords.GetLang()))
     {
         SystemManager.RunShell(Globals.AuthorProjectsURL + "/hebrew-words");
     }
 }
Beispiel #24
0
        // Center Fences
        private void createTopFence()
        {
            World world = Game1.GameInstance.getWorld();

            Rectangle gameScreenSize = Game1.GameInstance.gameScreenSize;

            // Sprite Animation ///////////

            Sprite wallSprite = (Sprite)DisplayManager.Instance().getDisplayObj(SpriteEnum.fenceCTop);

            DisplayManager.Instance().addDisplayObj(SpriteEnum.Wall, wallSprite);


            Sprite_Proxy wallProxy = new Sprite_Proxy(wallSprite, 150, 71, fenceScale, Color.White);

            Wall wall1 = new Wall(GameObjType.horzWalls, wallProxy);


            SBNode wallBatch = SpriteBatchManager.Instance().getBatch(batchEnum.boxs);

            wallBatch.addDisplayObject(wallProxy);

            //////////////////

            // Box2D /////////////

            var wallShape = new PolygonShape();

            wallShape.SetAsBox(wall1.spriteRef.sprite.width / 2, wall1.spriteRef.sprite.height / 2);

            var fd = new FixtureDef();

            fd.shape       = wallShape;
            fd.restitution = 0.9f;
            fd.friction    = 0.0f;
            fd.density     = 1.0f;
            fd.userData    = wall1;

            BodyDef bd = new BodyDef();

            bd.type     = BodyType.Static;
            bd.position = wall1.spriteRef.pos;

            var body = world.CreateBody(bd);

            body.CreateFixture(fd);
            body.SetUserData(wall1);
            body.Rotation = (float)(90.0f * (Math.PI / 180.0f));

            GameObjManager.Instance().addGameObj(wall1);
            PhysicsMan.Instance().addPhysicsObj(wall1, body);
            /////////////////////
        }
Beispiel #25
0
    private void Start()
    {
        bannerControl = FindObjectOfType <PlayerBanner>();

        cameraSetup = FindObjectOfType <CameraFollow>();
        players     = GameObject.Find("Ships").GetComponentsInChildren <Player>();
        dispManager = FindObjectOfType <DisplayManager>();
        if (newGame)
        {
            BeginGame();
        }
    }
Beispiel #26
0
        public ActivityDisplayManager(
            IOptions <WorkflowOptions> workflowOptions,
            IServiceProvider serviceProvider,
            IShapeFactory shapeFactory,
            IEnumerable <IShapePlacementProvider> placementProviders,
            ILogger <DisplayManager <IActivity> > displayManagerLogger,
            ILayoutAccessor layoutAccessor)
        {
            var drivers = workflowOptions.Value.ActivityDisplayDriverTypes.Select(x => serviceProvider.CreateInstance <IDisplayDriver <IActivity> >(x));

            _displayManager = new DisplayManager <IActivity>(drivers, shapeFactory, placementProviders, displayManagerLogger, layoutAccessor);
        }
Beispiel #27
0
        private void AlertedSeaBreezeDestroyed(FCSConnectableDevice obj)
        {
            if (obj == null || obj.GetPrefabIDString() == null)
            {
                return;
            }

            QuickLogger.Debug("OBJ Not NULL", true);
            SeaBreezes.Remove(obj.GetPrefabIDString());
            QuickLogger.Debug("Removed Seabreeze");
            DisplayManager.UpdateSeaBreezes();
        }
        private void Initialize()
        {
            _isRunning = Animator.StringToHash("IsRunning");
            _isInSub   = Player.main.IsInSubmarine();

            if (StorageManager == null)
            {
                StorageManager = new MFFStorageManager();
                StorageManager.Initialize(this);
            }

            if (PowerManager == null)
            {
                PowerManager = new PowerManager();
                PowerManager.Initialize(this);
                StartCoroutine(UpdatePowerState());
            }

            AnimationManager = gameObject.GetComponent <AnimationManager>();

            if (ColorManager == null)
            {
                ColorManager = new ColorManager();
                ColorManager.Initialize(gameObject, MiniFountainFilterBuildable.BodyMaterial);
            }

            if (TankManager == null)
            {
                TankManager = new TankManager();
                TankManager.Initialize(this);
            }

            if (PlayerManager == null)
            {
                PlayerManager = new PlayerManager();
                PlayerManager.Initialize();
            }

            if (AudioManager == null)
            {
                AudioManager = new AudioManager(gameObject.GetComponent <FMOD_CustomLoopingEmitter>());
            }

            if (DisplayManager == null)
            {
                DisplayManager = gameObject.AddComponent <MFFDisplayManager>();
                DisplayManager.Setup(this);
            }

            IsInitialized = true;

            QuickLogger.Debug($"Initialized");
        }
 /**
  * Initializes manager
  */
 public override void Start()
 {
     if (displayManager == null)
     {
         DontDestroyOnLoad(gameObject);
         displayManager = this;
     }
     else if (displayManager != this)
     {
         Destroy(gameObject);
     }
 }
Beispiel #30
0
    void Start()
    {
        CongratsContainer.SetActive(false);
        audio          = GetComponent <AudioSource>();
        displayManager = GameObject.FindGameObjectWithTag("DisplayManager").GetComponent <DisplayManager>();
        foreach (GameObject backgrounds in BackgroundTextures)
        {
            backgrounds.SetActive(false);
            ChipDropper.SetActive(false);
            CarRace.SetActive(false);
        }
        //BackgroundTextures[displayManager.currentScene.pointsGTData.SpriteAtlas].SetActive(true);
        switch (displayManager.currentScene.pointsGTData.SpriteAtlas)
        {
        case 0:
        case 1:
        case 2:
        case 3:
            CarRace.SetActive(true);
            Debug.Log("activating background:" + displayManager.currentScene.pointsGTData.SpriteAtlas);
            BackgroundTextures[displayManager.currentScene.pointsGTData.SpriteAtlas].SetActive(true);
            MainPgTaAtlas.replacement = SpriteAtlases[displayManager.currentScene.pointsGTData.SpriteAtlas];
            break;

        case 4:
            BackgroundTextures[displayManager.currentScene.pointsGTData.SpriteAtlas].SetActive(true);
            ChipDropper.SetActive(true);
            ChipDropper.GetComponent <ChipDropper>().StartTheDrop();
            break;

        case 5:
            BackgroundTextures[displayManager.currentScene.pointsGTData.SpriteAtlas].SetActive(true);
            ChipDropper.SetActive(true);
            //ChipDropper.GetComponent<ChipDropper>().StartTheDrop();
            break;

        case 6:
            ChipDropper.SetActive(true);
            BackgroundTextures[displayManager.currentScene.pointsGTData.SpriteAtlas].SetActive(true);
            break;
        }


        //TimePerSession = displayManager.currentScene.duration / displayManager.displayInfo.pgtSessions.Count;
        TimePerSession = 0;
        if (TimePerSession == 0)
        {
            TimePerSession = 30;
        }

        StartCoroutine("StartTimer");
    }
Beispiel #31
0
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);

            EmuApi.InitDll();
            bool showUpgradeMessage = UpdateHelper.PerformUpgrade();

            ConfigManager.Config.Video.ApplyConfig();
            EmuApi.InitializeEmu(ConfigManager.HomeFolder, Handle, ctrlRenderer.Handle, false, false, false);

            ConfigManager.Config.InitializeDefaults();
            ConfigManager.Config.ApplyConfig();

            _displayManager = new DisplayManager(this, ctrlRenderer, pnlRenderer, mnuMain, ctrlRecentGames);
            _displayManager.SetScaleBasedOnWindowSize();
            _shortcuts = new ShortcutHandler(_displayManager);

            _notifListener = new NotificationListener();
            _notifListener.OnNotification += OnNotificationReceived;

            _commandLine.LoadGameFromCommandLine();

            SaveStateManager.InitializeStateMenu(mnuSaveState, true, _shortcuts);
            SaveStateManager.InitializeStateMenu(mnuLoadState, false, _shortcuts);
            BindShortcuts();

            Task.Run(() => {
                Thread.Sleep(25);
                this.BeginInvoke((Action)(() => {
                    ResizeRecentGames();
                    ctrlRecentGames.Initialize();

                    if (!EmuRunner.IsRunning())
                    {
                        ctrlRecentGames.Visible = true;
                    }
                }));
            });

            if (showUpgradeMessage)
            {
                MesenMsgBox.Show("UpgradeSuccess", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            if (ConfigManager.Config.Preferences.AutomaticallyCheckForUpdates)
            {
                UpdateHelper.CheckForUpdates(true);
            }

            InBackgroundHelper.StartBackgroundTimer();
            this.Resize += frmMain_Resize;
        }
Beispiel #32
0
        private void Initialize()
        {
            QuickLogger.Debug("Initializing");

            _isPinging    = Animator.StringToHash("IsPinging");
            IsRunningHash = Animator.StringToHash("IsRunning");

            AddToBaseManager();

            if (OxygenManager == null)
            {
                OxygenManager = new OxOxygenManager();
                OxygenManager.SetAmountPerSecond(QPatch.Configuration.OxygenPerSecond);
                OxygenManager.Initialize(this);
            }

            if (HealthManager == null)
            {
                HealthManager = new HealthManager();
                HealthManager.Initialize(this);
                HealthManager.SetHealth(100);
            }

            if (PowerManager == null)
            {
                PowerManager = gameObject.GetComponent <PowerManager>();
                PowerManager.Initialize(this);
                PowerManager.OnPowerUpdate += OnPowerUpdate;
            }

            if (AudioManager == null)
            {
                AudioManager = new AudioManager(gameObject.GetComponent <FMOD_CustomLoopingEmitter>());
                InvokeRepeating(nameof(UpdateAudio), 0, 1);
            }

            if (AnimationManager == null)
            {
                AnimationManager = gameObject.GetComponent <AnimationManager>();
                AnimationManager.SetBoolHash(IsRunningHash, true);
            }

            if (DisplayManager == null)
            {
                DisplayManager = gameObject.AddComponent <OxDisplayManager>();
                DisplayManager.Setup(this);
            }

            QuickLogger.Debug("Initialized");
            Mod.OnOxstationBuilt?.Invoke(this);
            _initialized = true;
        }
Beispiel #33
0
        static public void DisableAdaptiveSync()
        {
            DisplayManager.EnumDisplayDevicesAsync(true);
            GlobalSettingsPayload data;

            data = GlobalSettings.GetGlobalSettings();
            if (data.AdaptiveSync)
            {
                data.AdaptiveSync   = false;
                data.ChangedSetting = ApplyDriverSettings.AdaptiveSync;
                GlobalSettings.SetGlobalSettings(data);
            }
        }
Beispiel #34
0
 private void clearData()
 {
     TextureManager.Instance().clear();
     ImageManager.Instance().clear();
     SpriteBatchManager.Instance().clear();
     SpriteProxyManager.Instance().clear();
     DisplayManager.Instance().clear();
     AnimManager.Instance().clear();
     GameObjManager.Instance().clear();
     Timer.Clear();
     PlayerManager.Instance().clear();
     BombManager.Instance().clear();
 }
 public CountDownModule(IConfiguration configuration, IHubContext <CountDownHub> hub, DisplayManager displayManager)
 {
     Hub             = hub;
     Configuration   = configuration;
     _allCountDowns  = new List <CountDown>();
     _displayManager = displayManager;
     Configuration.Bind("CountDowns", _allCountDowns);
     _countDown = _allCountDowns.Find(x => x.Index == 0);
     _countDown.CurrentCount = _countDown.TargetCount;
     displayManager.WriteCountdownDisplays(_countDown);
     // _countDown = new CountDown();
     _countDownState = CountDownStatus.Reset;
 }
Beispiel #36
0
 void LoadScenes(VideoPlayer vp)
 {
     GameManager.SwitchScenes(SceneName);
     FindObjectOfType <AudioManager>().Play("FadeOutDrop");
     if (showUI)
     {
         DisplayManager.UnHideUI();
     }
     if (!showUI)
     {
         DisplayManager.HideUI();
     }
 }
Beispiel #37
0
    private IEnumerator StartTimer()
    {
        while (true)
        {
            displayManager = GameObject.FindGameObjectWithTag("DisplayManager").GetComponent <DisplayManager>();

            LoadSessionJson();
            UpdateRaceCarsJson();
            yield return(new WaitForSeconds(TimePerSession));

            resetCars();
        }
    }
Beispiel #38
0
        static void Main()
        {
            cube_thing.renderEngine.core.Settings.getInstance().setCurrentWindowSize(new int[] { 1024, 768 });

            DisplayManager window = new DisplayManager();
            //CAMERA setup

            GameObject camera = new GameObject("camera");   //Creating gameObject //String parameter is just a name
            AbstractCamera cam = new AbstractCamera();  //Creating camera
            World.getInstance().assingGameObject(camera);       //Adding gameobject to the world

            cam.setMain();                              //Sets this camera as main
            cam.setBackgroundColor(new Vector3(1,1,1)); //Sets background color  ->  RGB 0-1 at scale
            camera.addComponent(cam);                   //Adding the camera component to the gameobject
            camera.transform.position = new Vector3(0, 0, -5);
            renderEngine.tools.utils.Timer timer = renderEngine.tools.utils.Timer.getInstance();

           
            //EVENTS
            KBEvent.getInstance(Key.A).addKeyDown(() =>
            {
                camera.transform.rotation.Y-= 10*timer.getDeltaTime();         //timer.getDeltaTime() is for FPS drop to move always the same speed
            });
            KBEvent.getInstance(Key.D).addKeyDown(() =>
            {
                camera.transform.rotation.Y+= 10 * timer.getDeltaTime();
            });
            KBEvent.getInstance(Key.W).addKeyDown(() =>
            {
                camera.transform.rotation.X-= 10 * timer.getDeltaTime();
            });
            KBEvent.getInstance(Key.S).addKeyDown(() =>
            {
                camera.transform.rotation.X+= 10 * timer.getDeltaTime();
            });
            KBEvent.getInstance(Key.Q).addKeyDown(() =>
            {
                cam.transform.position.Z-=1 * timer.getDeltaTime();
            });
            KBEvent.getInstance(Key.E).addKeyDown(() =>
            {
                cam.transform.position.Z += 1* timer.getDeltaTime();
            });


            KBEvent.getInstance(Key.Escape).addKeyDown(() =>
            {
                window.getWindow().Exit();
            });

            MWheelEvent.getInstance().addScroll((y) =>
            {
                cam.transform.position.Z -= y * timer.getDeltaTime()*20;
            });
            MMoveEvent.getInstance().addMove((x, y) =>
            {
                camera.transform.rotation.Y += x * timer.getDeltaTime()*10;
                camera.transform.rotation.X += y * timer.getDeltaTime()*10;
            });

            KBEvent.getInstance(Key.F12).addKeyPress(() =>
            {
            if (GraphicsContext.CurrentContext == null)
                throw new GraphicsContextMissingException();

                Bitmap bmp = new Bitmap(window.getWindow().ClientSize.Width, window.getWindow().ClientSize.Height);
                System.Drawing.Imaging.BitmapData data =
                bmp.LockBits(window.getWindow().ClientRectangle, System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
                GL.ReadPixels(0, 0, window.getWindow().ClientSize.Width, window.getWindow().ClientSize.Height, OpenTK.Graphics.OpenGL.PixelFormat.Bgr, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, data.Scan0);
                bmp.UnlockBits(data);

                bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);

                bmp.Save(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\Screenshot\" +
                  DateTime.Now.ToString("yyy_MM_dd_h_mm_ss") + ".png");
            });

            //59
            float resolution = 69;
            camera.transform.position = new Vector3(resolution / 2f -0.5f, resolution / 2f - 0.5f, resolution / 2f-0.5f);
           cam.transform.position.Z = resolution;
            //Window's onLoad event, OpenGL dependent code has to be here

            VoxelList list = new VoxelList();

            Thread t = new Thread(delegate () {
                int R, G, B;
                R = G = B = 0;
                for (R = 0; R < resolution; R++)
                {
                    for (G = 0; G < resolution; G++)
                    {
                        for (B = 0; B < resolution; B++)
                        {
                            list = list.Add(new VoxelList(new int[] { R, G, B }, new float[] { R / resolution, G / resolution, B / resolution, 1 }));
                        }
                    }

                }
                Console.WriteLine("Done: "+VoxelList.length+" "+R+" "+G+" "+B);
            });
            t.Start();

            window.Load(() =>
            {
                /*
                //glDepthMask(false);
                for(int R = 0; R < resolution; R++)
                {
                    for (int G = 0; G < resolution; G++)
                    {
                        for (int B = 0; B < resolution; B++)
                        {
                            //Sample box setup
                            GameObject box = new GameObject("Box "+R+"-"+G+"-"+B);
                            box.transform.position = new Vector3(R, G, B);
                            DefaultMat material = new DefaultMat(); //Creating material component
                            material.setCullingEnabled(false);       //Backface culling enabled
                            material.setHasTransparency(true);
                            box.transform.scale = new Vector3(0.999f, 0.999f, 0.999f);
                            material.setColor(new Vector4(R/resolution, G/ resolution ,B/ resolution, 1));      //Setting the materials color
                            Renderer m = new Renderer(Primitives.Cube(), material);     //Creating renderer component -> Parameters Primitives.PRIMITIVE_NAME, material
                            box.addComponent(m);                    //Assing renderer to the gameobject
                            box.transform.createTransformationMatrix();
                            World.getInstance().assingGameObject(box);  //Add gameobject to the world

                            System.GC.Collect();
                        }
                    }
                }*/

            });

            //Starting the rendering at 60 Update/s with 60 FPS
            window.Start(60,60);
        }
Beispiel #39
0
        /// <summary>
        /// Initializes GUI components, connections to the Heads Up Display, the video analysis,
        /// the game client, and the hardware components throught Unity.
        /// Connects
        /// </summary>
        public ClientUi()
        {
            InitializeComponent();
            _allPlayers = new List<IPlayer>();
            _analyzer = new BlobDetectionAnalysis(45, 45, 800, 800, 15, .3f, 0.5f);
            _dispMan = new DisplayManager { DisplayTimer = true, DisplaySignalStrength = true };
            _client = new GameClient();
            _player = _client.GetPlayer();
            _guid = _client.GetGuid();
            _client.PlayerEventHandler += PlayerUpdateHandler;
            _client.AllPlayersEventHandler += AllPlayersUpdateHandler;
             var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            UnityConfigurationSection section = (UnityConfigurationSection)config.GetSection("unity");
            _container = new UnityContainer();
            section.Configure(_container, "container");

            _gamePlay = new GamePlay(_player);
            _gameEngine = new GameEngine(_container.Resolve<IWirelessStrengthMonitor>(), _container.Resolve<IGps>(), _player, _container.Resolve<IVideoInput>());

            _signal = _container.Resolve<IWirelessStrengthMonitor>();

            _running = true;

            /* // Threads for timer and positioning updating
            _timeThread = new Thread(TimeUpdateLoop) {IsBackground = true};
            _timeThread.Start();
            _positionThread = new Thread(PositionUpdateLoop);
            _positionThread.Start();
            */

            _gameTime = new TimeSpan(0,5,0);

            _timer = new Timer(1000);
            _timer.Elapsed += gameTimeSim;
        }
 void Start()
 {
     dm = displayManager.GetComponent<DisplayManager> ();
     rt = this.GetComponent<RectTransform> ();
     yPos = (-1) * rt.rect.height;
 }