Exemplo n.º 1
0
    public override void Update()
    {
        if (mManager.mZigManager.has_user() && mManager.mZigManager.is_skeleton_tracked_alternative())
        {
            CurrentPose = ProGrading.snap_pose(mManager);
        }
        else
        {
            CurrentPose = mManager.mReferences.mDefaultPose.to_pose();
        }

        if (GS == GameState.NORMAL)
        {
            if (KeyMan.GetKeyDown("Pause"))
            {
                if (!mModeNormalPlay.Paused)
                {
                    mManager.GameEventDistributor("PAUSE", null);
                }
                else
                {
                    mManager.GameEventDistributor("RESUME", null);
                }
            }
            if (!mModeNormalPlay.Paused)
            {
                mModeNormalPlay.update();
            }
        }
        else if (GS == GameState.TEST)
        {
            mModeTesting.update();
        }
        else if (GS == GameState.SIMIAN)
        {
            mModeSimian.update();
        }
        else if (GS == GameState.CHALLENGE)
        {
            mModeChallenge.update();
        }

        if (GS != GameState.SIMIAN)
        {
            //reader connected and no user
            if (!mManager.mZigManager.has_user() && mManager.mZigManager.is_reader_connected() == 2)
            {
                mIdleTimer.update(Time.deltaTime);
            }
            else
            {
                mIdleTimer.reset();
            }
            if (mIdleTimer.isExpired())
            {
                mIdleTimer.reset();
                mManager.restart_game();
            }
        }
    }
Exemplo n.º 2
0
    bool can_start(float aTime)
    {
        /*
         * mManager.mDebugString = (GameConstants.ALLOW_NO_KINECT + " " + mManager.mZigManager.is_reader_connected() + " " +
         *                       mManager.mCharacterBundleManager.is_initial_loaded() + " " +
         *                       mManager.mZigManager.ZgInterface.can_start() + " " +
         *                       (GameConstants.UNLOCK_ALL || mManager.mMetaManager.SaveDataRead) + " " +
         *                       aTime + " " +
         *                       (mManager.mZigManager.has_user()) + " " +
         *                       (KeyMan.GetKey("HardSkip") || KeyMan.GetKey("SoftSkip"))  + " " +
         *                       GameConstants.FORCE_START);
         */

        if (!GameConstants.ALLOW_NO_KINECT && mManager.mZigManager.is_reader_connected() == 0)
        {
            return(false);
        }

        return
            (mManager.mCharacterBundleManager.is_initial_loaded() &&
             mManager.mZigManager.ZgInterface.can_start() &&
             (GameConstants.UNLOCK_ALL || mManager.mMetaManager.SaveDataRead) && //we don't care about save data if we are in unlock all mode
             ((aTime > 3.5f && mManager.mZigManager.has_user()) ||
              KeyMan.GetKey("HardSkip") || KeyMan.GetKey("SoftSkip") ||
              GameConstants.FORCE_START));
    }
Exemplo n.º 3
0
    void Update()
    {
        //try{
        Vector2 newScreenSize = new Vector2(Screen.width, Screen.height);

        if (mLastScreenSize != newScreenSize)
        {
            //TODO screen sized changed callback
        }
        mLastScreenSize = newScreenSize;

        if (mUpdateDelegates != null)
        {
            mUpdateDelegates();
        }

        if (KeyMan.GetKeyDown("Quit"))
        {
            Application.Quit();
        }
        if (KeyMan.GetKeyDown("Restart"))
        {
            restart_game();
        }

        //mDebugString = ((int)(1 / Time.deltaTime)).ToString();
        //}

        /*
         * catch(System.Exception e)
         * {
         *  mDebugString2 = e.ToString();
         *  throw e;
         * }*/
    }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            #region Initialize
            ConsoleMan.Initialize("ScreenTest", new Pixel(ConsoleColor.Black));
            KeyMan.Start();

            ConsoleComponent console = new ConsoleComponent("Text1", DrawableComponentBuilder.MakeConsole());
            TextComponent    text    = new TextComponent("CursorPosition", new
                                                         DrawableComponent("CursorPosition", 20, 1, 20, 20, 0.0f));

            ConsoleMan.Add(console);
            ConsoleMan.Add(text);
            ConsoleMan.Start();
            #endregion

            Console.OutputEncoding = UTF32Encoding.UTF8;

            console.WriteLine("SHIT");
            string x = console.ReadLine();
            console.Write(x);
            while (true)
            {
                text.Text = System.Windows.Forms.Cursor.Position.ToString() + "\u0627";
            }

            ConsoleMan.Stop();
            KeyMan.Stop();

            return;
        }
Exemplo n.º 5
0
        public void CanRoundtripToken_TamperedTokenIsInvalid()
        {
            using (var keyMan = new KeyMan(TestConfig.ValidKey))
            {
                var token = keyMan.Encode(new Dictionary <string, string>
                {
                    { "username", "joe" }
                });

                var tamperedToken = TamperSomehow(token);

                Console.WriteLine($@"Token:

{token}

TAMPERED token:

{tamperedToken}
");

                var decodingResult = keyMan.Decode(tamperedToken);

                Assert.That(decodingResult.IsValid, Is.False);
            }
        }
Exemplo n.º 6
0
        public void DoesNotGenerateSameKeyTwice()
        {
            var firstKey  = KeyMan.GenerateKey();
            var secondKey = KeyMan.GenerateKey();

            Console.WriteLine(firstKey);
            Console.WriteLine();
            Console.WriteLine(secondKey);

            Assert.That(firstKey, Is.Not.EqualTo(secondKey));
        }
Exemplo n.º 7
0
 /// <summary>
 /// Reads a character from the console component
 /// </summary>
 /// <returns>The character read</returns>
 public char Read()
 {
     Reading = true;
     KeyMan.Focus(this);
     while (Reading)
     {
         ;             //Wait for user to enter input
     }
     KeyMan.Unfocus();
     return((char)In.Read());
 }
Exemplo n.º 8
0
        public void DoesNotDieOnInvalidClientKey(string dirtyInput)
        {
            var keyMan = Using(new KeyMan(KeyMan.GenerateKey()));

            var result = keyMan.Decode(dirtyInput);

            Assert.That(result.IsValid, Is.False);
            Assert.That(result.Details.HasValidSignature, Is.False);
            Assert.That(result.Details.IsCorrectFormat, Is.False);
            Assert.That(result.Details.IsExpired, Is.False);
            Assert.That(result.Details.IsNotValidYet, Is.False);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Reads a segment/string from input
        /// </summary>
        /// <returns>The read string</returns>
        public string ReadLine()
        {
            Reading = true;
            KeyMan.Focus(this);
            while (Reading)
            {
                ;             //Wait for user to enter input
            }
            KeyMan.Unfocus();

            return(In.ReadLine());
        }
Exemplo n.º 10
0
    public void Update()
    {
        if (KeyMan.GetKeyDown("LeftThumbstick"))
        {
            /*StatisticsManager.GetSingleUserStatisticsAsync(mAll.LastActiveUser.Id,mAll.LastActiveUser.UID,"f3530100-c251-40ff-9d13-078c4a0a3432","TimesBorn",delegate(UserStatisticsResult obj, UnityAOT.GetObjectAsyncOp<UserStatisticsResult> op) {
             *  ManagerManager.Log("stat callback " + op.Success.ToString() + " " + op.IsComplete + " " + obj.Length);
             * foreach(var e in obj)
             *  {
             *      ManagerManager.Log("Made it in " + e.Length + " " + e.ServiceConfigurationId);
             *      foreach(var f in e)
             *      {
             *          ManagerManager.Log(f.Name + " " + f.Value);
             *      }
             *  }
             * });*/

            /*
             * //TODO DELETE
             * //this is test stuff and will crash if there is no user logged on at start of game
             * var currentUser = mAll.LastActiveUser;
             * ManagerManager.Log("querying for stats userid, uid, scid " + currentUser.Id + " " + currentUser.UID + " " + ConsoleUtilsManager.PrimaryServiceConfigId());;
             * StatisticsManager.GetSingleUserStatisticsAsyncMultipleStats(
             *  currentUser.Id,
             *  currentUser.UID,
             *  ConsoleUtilsManager.PrimaryServiceConfigId(),
             *  new string[]{"TimesBorn","HighScore","TimesDied","TimesGruesomeDeath"},
             * delegate(UserStatisticsResult obj, UnityAOT.GetObjectAsyncOp<UserStatisticsResult> op)
             * {
             *  ManagerManager.Log("inside stat callback " + op.ToString());
             *  ManagerManager.Log("Stat retrieval op: " + op.Success + " userid: " + obj.XboxUserId + " cnt " + obj.Length);
             *  ManagerManager.Log("inside stat callback 2");
             *  foreach (ServiceConfigurationStatistic ss in obj)
             *  {
             *      ManagerManager.Log("inside2");
             *      ManagerManager.Log(ss.ServiceConfigurationId + " cnt " + ss.Length);
             *      foreach (Statistic stat in ss)
             *      {
             *          ManagerManager.Log(stat.Type.ToString() + " " + stat.Value);
             *      }
             *  }
             * }
             * );*/
        }
    }
Exemplo n.º 11
0
        public void CanRoundtripToken()
        {
            using (var keyMan = new KeyMan(TestConfig.ValidKey))
            {
                var token = keyMan.Encode(new Dictionary <string, string>
                {
                    { "username", "joe" }
                });

                var decodingResult = keyMan.Decode(token);

                Assert.That(decodingResult.IsValid, Is.True);

                var decodedProperties = decodingResult.Properties;

                Assert.That(decodedProperties.ContainsKey("username"));
                Assert.That(decodedProperties["username"], Is.EqualTo("joe"));
            }
        }
Exemplo n.º 12
0
        public virtual void HandleCurrentInput(ConsoleKeyInfo Key)
        {
            if (Key.Key == ConsoleKey.Enter)
            {
                _inputActionCallBack(_sCurrentInput);
                KeyMan.Unfocus();
                _sCurrentInput = "";
            }
            else if (Key.Key == ConsoleKey.Backspace)
            {
                _sCurrentInput =
                    _sCurrentInput.Remove(_sCurrentInput.Length - 1);
            }
            else
            {
                _sCurrentInput += Key.KeyChar;
            }

            Text = _sCurrentInput;
        }
Exemplo n.º 13
0
    public void transition_to_CHOICE()
    {
        GS = NormalPlayGameState.PRECHOICE;

        mSunsetManager.add_character(NGM.CurrentCharacterLoader.Character, !CurrentPerformanceStat.BadPerformance);
        slide_image(mFlatCamera, null, mSunsetImage, false);
        CharacterIndex[] chars = available_choices(NGM.CurrentCharacterIndex.get_future_neighbor(0));
        mChoiceHelper.shuffle_and_set_choice_poses(chars.Length, mChoosingManager);
        mChoosingManager.set_bb_choices(chars);

        if (!KeyMan.GetKey("HardSkip")) //if we are still holding the skip key at this point, go straight to choosing
        {
            //switch over to choice screen
            float gAgeDisplayDur = 7f;
            TED.add_event(
                delegate(float aTime){
                //mSunsetManager.fade_characters(true,true);
                mSunsetManager.set_sun();
                return(true);
            }
                , 5);
            TED.add_event(
                NGM.CurrentCharacterIndex == CharacterIndex.sFetus ?
                mSunsetManager.low_skippable_text_bubble_event(GameStrings.GetString("MNPtrans1"), gAgeDisplayDur) :
                mSunsetManager.low_skippable_text_bubble_event(GameStrings.GetString("MNPtrans2", NGM.CurrentCharacterIndex.get_future_neighbor(0).Age.ToString()), gAgeDisplayDur)
                , 2.5f).then_one_shot(
                delegate(){
                slide_image(mFlatCamera, null, mChoosingImage);
                mManager.mMusicManager.fade_in_extra_music("choiceMusic");
                GS = NormalPlayGameState.CHOICE;
            }
                , 0);
        }
        else
        {
            mSunsetManager.set_sun();
            slide_image(mFlatCamera, null, mChoosingImage);
            mManager.mMusicManager.fade_in_extra_music("choiceMusic");
            GS = NormalPlayGameState.CHOICE;
        }
    }
Exemplo n.º 14
0
    }                                   //0 default, 1 forceshow, 2 noshow
    public override void Update()
    {
        if (KeyMan.GetKeyDown("DepthToggle"))
        {
            ForceShow = (ForceShow + 1) % 3;
        }

        if (ForceShow == 1 ||
            (ForceShow != 2 && (is_reader_connected() == 2 && !is_user_in_screen())))
        {
            DepthView.show_indicator(true);
            mManager.mTransitionCameraManager.EnableDepthWarning = true;
        }
        else
        {
            DepthView.show_indicator(false);
            mManager.mTransitionCameraManager.EnableDepthWarning = false;
        }

        ZgInterface.update();
        DepthView.update();
    }
Exemplo n.º 15
0
        protected override void SetUp()
        {
            _keyMan = new KeyMan(ValidKey);

            Using(_keyMan);
        }
Exemplo n.º 16
0
    public void update_PLAY()
    {
        TimeRemaining -= KeyMan.GetKey("Fast") ? Time.deltaTime * 5 : Time.deltaTime;

        if (NGM.CurrentPose != null)        //this should never happen but just in case
        {
            if (KeyMan.GetKey("Perfect"))
            {
                mManager.mBodyManager.set_target_pose(NGM.CurrentTargetPose);
            }
            else
            {
                mManager.mBodyManager.set_target_pose(NGM.CurrentPose);
            }
        }


        //this basically means we aren't 0 or 100 or 999
        if (NGM.CurrentPoseAnimation != null && NGM.CurrentCharacterIndex.LevelIndex != 0)
        {
            NGM.CurrentTargetPose = NGM.CurrentPoseAnimation.get_pose(Time.time);
            mManager.mTransparentBodyManager.set_target_pose(NGM.CurrentTargetPose);

            mGrading.update(mManager.mBodyManager.get_current_pose(), mManager.mTransparentBodyManager.get_current_pose());
            float grade = ProGrading.grade_pose(mManager.mBodyManager.get_current_pose(), mManager.mTransparentBodyManager.get_current_pose());
            grade = ProGrading.grade_to_perfect(grade);

            //old smooth grading

            /*
             *          float newGrade = mLastGrade*0.95f + grade*0.05f;
             *          if(newGrade < mLastGrade)
             *                  mLastGrade = Mathf.Max(newGrade,mLastGrade - Time.deltaTime/6f);
             *          else mLastGrade = newGrade;
             *          grade = mLastGrade;*/

            //new smooth grading, this version gives grace to sudden drops in performance
            if (grade < mLastGrade)
            {
                float newGrade = mLastGrade * 0.95f + grade * 0.05f;
                if (newGrade < mLastGrade)
                {
                    grade = Mathf.Max(newGrade, mLastGrade - Time.deltaTime / 2f);
                }
                else
                {
                    grade = newGrade;
                }
            }
            mLastGrade = grade;

            bool switchEffect = false;
            if (PercentTimeCompletion > 0.01f)
            {
                mParticles.create_particles(mGrading, true);
                if (GameConstants.NEW_POSE_SWITCHING)
                {
                    //TODO test if switch conditions are right
                    //TODO switch
                }
                else
                {
                    if (NGM.CurrentPoseAnimation.does_pose_change_precoginitive(Time.time, Time.deltaTime, 0.07f))
                    {
                        switchEffect = true;
                        //TODO give 1 second of bonus score for being close right when pose switches
                    }
                }
            }


            if (TimeRemaining > 0) //insurance, something funny could happen if music runs slightly longer than it should.
            {
                CurrentPerformanceStat.update_score(PercentTimeCompletion, grade);
            }

            //TODO needs to be tested
            //improve score for good switches
            if (switchEffect)
            {
                CurrentPerformanceStat.adjust_score(PercentTimeCompletion, grade * GameConstants.switchBonusScoreMultiplier, NGM.CurrentPoseAnimation.ChangeTime);
            }

            //trigger effects after adjusting score
            if (switchEffect)
            {
                mGiftManager.capture_player();
                mParticles.create_particles(mGrading);
                if (grade > GameConstants.playSuperCutoff && IsFever)
                {
                    mManager.mMusicManager.play_sound_effect("pose5", 0.6f);
                }
                else
                {
                    mManager.mMusicManager.play_sound_effect("pose" + Mathf.Clamp((int)(5 * grade), 0, 4), 0.8f);
                }
            }

            //mManager.mCameraManager.set_camera_effects(grade);
            //update score
            mInterfaceManager.update_bb_score(TotalScore);
        }
        else if (NGM.CurrentCharacterIndex.LevelIndex == 0 && true)   //fetus
        {
            if (NGM.CurrentTargetPose != null)
            {
                mManager.mTransparentBodyManager.set_target_pose(NGM.CurrentTargetPose);
                float grade = ProGrading.grade_pose(mManager.mBodyManager.get_current_pose(), NGM.CurrentTargetPose); //should be mManager.mTransparentBodyManager.get_current_pose() but it does not matter
                grade = ProGrading.grade_to_perfect(grade);

                //this is a total hack, but we don't use mTotalScore for the fetus anyways
                FieldInfo scoreProp = typeof(PerformanceStats).GetField("mTotalScore", BindingFlags.NonPublic | BindingFlags.Instance);
                float     oldGrade  = (float)scoreProp.GetValue(CurrentPerformanceStat);
                float     newGrade  = oldGrade * 0.93f + grade * 0.07f;
                scoreProp.SetValue(CurrentPerformanceStat, newGrade);
                if (newGrade > GameConstants.playFetusPassThreshold)
                {
                    //this may or may not work depending on which update gets called first
                    SkipSingle();
                    scoreProp.SetValue(CurrentPerformanceStat, 0);
                    mManager.mMusicManager.play_sound_effect("cutGood");
                    TimeRemaining = 0;
                }
            }
        }
        else if (NGM.CurrentCharacterIndex == CharacterIndex.sOneHundred)
        {
            mAstronaut.update_astro();
        }
        else
        {
            CurrentPerformanceStat.update_score(PercentTimeCompletion, 0.5f);
        }

        //warning
        if (NGM.CurrentPoseAnimation != null && NGM.CurrentCharacterIndex.LevelIndex != 0)
        {
            float perc = 3f / GameConstants.playDefaultPlayTime;
            if (PercentTimeCompletion > GameConstants.warningMinTime && CurrentPerformanceStat.last_score(perc) / (perc) < 0.2f)
            {
                mInterfaceManager.enable_warning_text(true);
            }
            else
            {
                mInterfaceManager.enable_warning_text(false);
            }
        }

        //make sure music is finished too!
        //if((TimeRemaining <= 0 && !mManager.mMusicManager.IsMusicSourcePlaying) || TimeRemaining < -4) //but don't wait too long
        if (TimeRemaining <= 0)
        {
            CurrentPerformanceStat.Finished = true;
            mInterfaceManager.enable_warning_text(false);
            transition_to_CUTSCENE();

            //if we don't want fetus to have a cutscene use this
            //if(CurrentPerformanceStat.Character.Index != 0)
            //	transition_to_CUTSCENE();
            //else transition_to_CHOICE();

            //handle astronaut
            //note maybe we want to use physics for cutscene as well in which case we should move this into transition_to_CUTSCENE
            if (NGM.CurrentCharacterIndex == CharacterIndex.sOneHundred)
            {
                mAstronaut.finish_astro();
            }

            return;
        }

        //if we don't want the music to play during the cutscenes and whatont...
        //if(GS != NormalPlayGameState.PLAY)
        //	mManager.mMusicManager.fade_out();



        //early death
        bool die = false;

        die |= KeyMan.GetKeyDown("Die");
        //if (NGM.CurrentPoseAnimation != null && mManager.mZigManager.has_user() && NGM.CurrentCharacterIndex.LevelIndex != 0)
        if (NGM.CurrentPoseAnimation != null && mManager.mZigManager.is_reader_connected() == 2 && NGM.CurrentCharacterIndex.LevelIndex != 0)
        {
            if (PercentTimeCompletion > GameConstants.deathMinTime)
            {
                float perc = GameConstants.deathRequiredTime / GameConstants.playDefaultPlayTime;
                if (CurrentPerformanceStat.last_score(perc) / perc < GameConstants.deathPerformanceThreshold)
                {
                    die |= true;
                }
            }
        }

        float perc2 = GameConstants.deathRequiredTime / GameConstants.playDefaultPlayTime;

        //ManagerManager.Manager.mDebugString = CurrentPerformanceStat.last_score(perc2).ToString("#.##") + " " + (CurrentPerformanceStat.last_score(perc2) / perc2).ToString("#.##") + " " + (PercentTimeCompletion).ToString("#.##");

        if (die && NGM.CurrentCharacterIndex != CharacterIndex.sOneHundred)    //can't die as astronaut, even if we want to
        {
            if (NGM.CurrentCharacterIndex != CharacterIndex.sFetus)            //this only happens if we try and force die on fetus
            {
                mGiftManager.capture_player();
            }
            CurrentPerformanceStat.Finished = true;
            mInterfaceManager.enable_warning_text(false);
            transition_to_DEATH();
        }
    }
Exemplo n.º 17
0
    public void update()
    {
        //cheater keys for skipping
        if (KeyMan.GetKeyDown("HardSkip"))
        {
            DoSkipMultipleThisFrame = true;
        }
        if (KeyMan.GetKeyDown("SoftSkip"))
        {
            DoSkipSingleThisFrame = true;
        }

        //TODO not sure why I put this here but this most most def. does not work
        //if(Input.GetKeyDown(KeyCode.Alpha8))
        //transition_to_TRANSITION_play(new CharacterIndex("999"));
        //mManager.mTransparentBodyManager.transition_character_in(GameConstants.UiWhiteTransparent);


        //handle cheater keys for choosing
        if (GS == NormalPlayGameState.CHOICE)
        {
            //cheater keys for difficulty
            if (
                NGM.CurrentCharacterIndex.LevelIndex < 7 &&
                (Input.GetKeyDown(KeyCode.Q) ||
                 Input.GetKeyDown(KeyCode.W) ||
                 Input.GetKeyDown(KeyCode.E) ||
                 Input.GetKeyDown(KeyCode.R)))
            {
                if (Input.GetKeyDown(KeyCode.Q))
                {
                    NGM.CharacterHelper.Characters[NGM.CurrentCharacterIndex.get_future_neighbor(0)].Difficulty += 1;
                }
                if (Input.GetKeyDown(KeyCode.W))
                {
                    NGM.CharacterHelper.Characters[NGM.CurrentCharacterIndex.get_future_neighbor(1)].Difficulty += 1;
                }
                if (Input.GetKeyDown(KeyCode.E))
                {
                    NGM.CharacterHelper.Characters[NGM.CurrentCharacterIndex.get_future_neighbor(2)].Difficulty += 1;
                }
                if (Input.GetKeyDown(KeyCode.R))
                {
                    NGM.CharacterHelper.Characters[NGM.CurrentCharacterIndex.get_future_neighbor(3)].Difficulty += 1;
                }
                for (int i = 0; i < 4; i++)
                {
                    NGM.CharacterHelper.Characters[NGM.CurrentCharacterIndex.get_future_neighbor(i)].Difficulty %= 4;
                }
                mChoosingManager.set_bb_choices(NGM.CurrentCharacterIndex.get_future_neighbor(0).get_neighbors());
            }

            //KeyCode[] levelKeys = new KeyCode[]{KeyCode.Q,KeyCode.W,KeyCode.E,KeyCode.R,KeyCode.T,KeyCode.Z,KeyCode.U,KeyCode.I};
            //KeyCode[] choiceKeys = new KeyCode[]{KeyCode.Alpha1,KeyCode.Alpha2,KeyCode.Alpha3,KeyCode.Alpha4};
            string[] levelKeys  = new string[] { "lvl1", "lvl2", "lvl3", "lvl4", "lvl5", "lvl6", "lvl7", "lvl8" };
            string[] choiceKeys = new string[] { "Choice1", "Choice2", "Choice3", "Choice4" };
            for (int i = 0; i < levelKeys.Length; i++)
            {
                if (KeyMan.GetKey(levelKeys[i]))
                {
                    for (int j = 0; j < choiceKeys.Length; j++)
                    {
                        if (KeyMan.GetKeyDown(choiceKeys[j]))
                        {
                            slide_image(mFlatCamera, mChoosingImage, null);
                            slide_image(mFlatCamera, mSunsetImage, null, false);
                            mManager.mMusicManager.fade_out_extra_music();
                            mManager.mMusicManager.fade_out(0);
                            mManager.mAssetLoader.new_load_character((new CharacterIndex(i + 1, j)).StringIdentifier, mManager.mCharacterBundleManager);
                        }
                    }
                }
            }
        }



        mInterfaceManager.Update();
        mSunsetManager.update();
        mChoosingManager.update();
        mGiftManager.update();

        //TODO only draw if necessary
        draw_render_texture(mSunsetManager.mFlatCamera);
        draw_render_texture(mChoosingManager.mFlatCamera);
        //draw_render_texture(mInterfaceManager.mFlatCamera);

        mFlatCamera.update(Time.deltaTime);
        foreach (FlatElementBase e in mElement)
        {
            e.update(Time.deltaTime);
        }


        if (GS == NormalPlayGameState.PLAY)
        {
            //if(Input.GetKeyDown(KeyCode.P))
            //	mParticles.create_particles(mGrading);
            update_PLAY();
            if (KeyMan.GetKeyDown("HardSkip"))
            {
                TimeRemaining = -5;                 //0;
            }
        }
        else if (GS == NormalPlayGameState.CHOICE)
        {
            update_CHOICE();
        }

        mParticles.update(Time.deltaTime);
        TED.update(Time.deltaTime);


        //hacks
        if (DoSkipMultipleThisFrame)
        {
            mInterfaceManager.skip_cutscene();

            mSunsetManager.skip_grave();

            //grave skipping lul
            DoSkipMultipleThisFrame = false;
        }

        if (DoSkipSingleThisFrame)
        {
            DoSkipSingleThisFrame = false;
        }
    }
Exemplo n.º 18
0
    //returns choice
    public int update(SetChoiceInterface aInterface)
    {
        if (mChoicePoses == null || mChoicePoses.Length == 0)
        {
            throw new UnityException("problem with choice poses");
        }

        string output   = "";
        int    minIndex = 0;
        float  minGrade = 99999;

        for (int i = 0; i < mChoicePoses.Length; i++)
        {
            if (mChoicePoses[i] != null)
            {
                float grade = 9999999;                 //important that there are more 9s here than above!
                if (CurrentPose != null && mChoicePoses[i] != null)
                {
                    grade = ProGrading.grade_pose(CurrentPose, mChoicePoses[i], false);
                }
                if (grade < minGrade)
                {
                    minGrade = grade;
                    minIndex = i;
                }

                output += grade.ToString("##.###") + " ";
            }
        }

        //ManagerManager.Manager.mDebugString = minGrade.ToString("##.###") + "       " + output;

        //Debug.Log(output);
        if (minGrade > SELECTION_THRESHOLD)
        {
            NextContendingChoice = -1;
        }
        else
        {
            NextContendingChoice = minIndex;
        }

        float growthRate = CHOOSING_PERCENTAGE_GROWTH_RATE;

        //hack choice testing
        if (KeyMan.GetKey("Choice1"))
        {
            NextContendingChoice = 0;
            growthRate           = 1;
        }
        else if (KeyMan.GetKey("Choice2"))
        {
            NextContendingChoice = 1;
            growthRate           = 1;
        }
        else if (KeyMan.GetKey("Choice3"))
        {
            NextContendingChoice = 2;
            growthRate           = 1;
        }
        else if (KeyMan.GetKey("Choice4"))
        {
            NextContendingChoice = 3;
            growthRate           = 1;
        }
        //else if(Input.GetKey(KeyCode.Alpha4))
        //	NextContendingChoice = 3;


        if (NextContendingChoice != -1 && LastContendingChoice != NextContendingChoice)
        {
            ManagerManager.Manager.mMusicManager.play_sound_effect("choiceBlip");
        }



        aInterface.set_choice(NextContendingChoice);


        for (int i = 0; i < mChoicePoses.Length; i++)
        {
            if (NextContendingChoice == i)
            {
                ChoosingPercentages[i] = Mathf.Clamp01(ChoosingPercentages[i] + growthRate * Time.deltaTime);
            }
            else
            {
                ChoosingPercentages[i] = Mathf.Clamp01(ChoosingPercentages[i] - CHOOSING_PERCENTAGE_DECLINE_RATE * Time.deltaTime);
            }
            aInterface.set_choice_percentages(i, ChoosingPercentages[i]);

            if (ChoosingPercentages[i] == 1)
            {
                for (int j = 0; j < ChoosingPercentages.Length; j++)
                {
                    ChoosingPercentages[j] = 0;
                }
                LastContendingChoice = -1;
                ManagerManager.Manager.mMusicManager.play_sound_effect("choiceMade");
                return(NextContendingChoice);
            }
        }

        LastContendingChoice = NextContendingChoice;

        return(-1);
    }
Exemplo n.º 19
0
    public void Update()
    {
        User appCurrentUser = UsersManager.GetAppCurrentUser();

        ManagerManager.Manager.mDebugString = "firsttime: " + firstTime + " activeuserid: " + activeUserId + " user count: " + UsersManager.Users.Count + " toggle: " + KeyMan.GetKeyDown("DepthToggle", true)
                                              + " gettappcurrentuser: "******"null" : UsersManager.GetAppCurrentUser().Id.ToString());

        if (firstTime)
        {
            firstTime = false;
            SanityCheckApplicationSetup();

            //easiest way to set active user (rather than scanning for first input)
            ManagerManager.Log("first time sign in");
            RequestSignin();
        }
        else
        {
            //after initial user prompt, these if statements will catch the following things:

            if (activeUserId == -1)
            {
                RequestSignin();
            }
            if (UsersManager.Users.Count == 0) //no users
            {
                RequestSignin();
            }
            if (KeyMan.GetKeyDown("DepthToggle", true)) //menu key is tied to depth toggle for XB1
            {
                RequestSignin();
            }
            //I really have no idea what getappcurrentuser does, just don't use it..
            //if (appCurrentUser == null || (lastAppCurrentUserId != UsersManager.GetAppCurrentUser().Id && UsersManager.GetAppCurrentUser().Id != activeUserId))
            //RequestSignin();
        }

        if (!IsActiveUserInitialized && ManagerManager.Manager.mCharacterBundleManager.is_initial_loaded() && ActiveUser != null)
        {
            //title screen
            ManagerManager.Log("User Initialized " + ActiveUser.GameDisplayName);
            ManagerManager.Manager.mTransitionCameraManager.you_are_playing_as(ActiveUser.GameDisplayName);

            //game
            if (!XboxOnePLM.AmConstrained())
            {
                ManagerManager.Manager.GameEventDistributor("RESUME", null);
            }

            //event
            ManagerManager.Manager.GameEventDistributor("START", null);

            //rich user presence
            SetRichUserPresence(CharacterIndex.sGrave); //this is the "null" character index

            //storage
            MicrosoftZig.Inst.mStorage.InitializeUserStorage();
            ManagerManager.Manager.mMetaManager.StartSaveThread();

            IsActiveUserInitialized = true;
        }


        //debug stuff
        if (KeyMan.GetKeyDown("LeftThumbstick"))
        {
            //ManagerManager.Log("getSingle");
            //StatisticsManager.GetSingleUserStatisticsAsyncMultipleStats(UsersManager.Users[0].Id, UsersManager.Users[0].UID, ConsoleUtilsManager.PrimaryServiceConfigId(), stats,null);
        }

        /*
         * if (UsersManager.Users.Count == 0)
         *  ManagerManager.Manager.mDebugString = "NO USERS";
         * else
         *  ManagerManager.Manager.mDebugString = "Current user: "******" " + UsersManager.GetAppCurrentUser().GameDisplayName;
         */

        //this is for special case where the sign in dialog is canceled but the callback isn't called
        if (!MicrosoftZig.Inst.mPLM.Constrained && MicrosoftZig.Inst.mPLM.NotConstrainedTimer > 2)
        {
            siDialog = false;
        }
    }
Exemplo n.º 20
0
    public void update()
    {
        mPLM.Update();
        mAll.Update();
        mKinect.Update();
        mEvents.Update();

        if (mKinect.DepthTexture != null)
        {
            ManagerManager.Manager.mZigManager.DepthView.UpdateTexture(mKinect.DepthTexture);
        }

        //if (mKinect.ColorTexture != null)take_color_image();


        //defer system gestures
        var  gm    = mZig.mManager.mGameManager;
        bool defer = false;

        if (gm.GS == NewGameManager.GameState.NORMAL)
        {
            //defer if in choice or play but not paused
            if (!gm.mModeNormalPlay.Paused)
            {
                if (gm.mModeNormalPlay.GS == ModeNormalPlay.NormalPlayGameState.CHOICE)
                {
                    defer = true;
                }
                if (gm.mModeNormalPlay.GS == ModeNormalPlay.NormalPlayGameState.PLAY)
                {
                    defer = true;
                }
            }
        }
        //TODO OTHER DEFER CONDITIONS
        if (defer)
        {
            mKinect.DeferSystemGestures(1);
        }


        //testcode
        if (KeyMan.GetKeyDown("LeftThumbstick"))
        {
            ManagerManager.Log("clearing out saves");
            mZig.mManager.mMetaManager.UnlockManager.mUnlocked = new Unlockables();
            write_data(mZig.mManager.mMetaManager.UnlockManager.serialize(), "unlock");
        }
        if (KeyMan.GetKeyDown("RightThumbstick"))
        {
            ManagerManager.Log("EVERYTHING UNLOCKED");
            mZig.mManager.mMetaManager.UnlockManager.mUnlocked.unlock_all();
            write_data(mZig.mManager.mMetaManager.UnlockManager.serialize(), "unlock");

            //mEvents.SendDeathEvent();
            //ManagerManager.Log("Sent fake death event");

            //take_color_image();
            //read_data("unlock",delegate(byte[] obj) { mZig.mManager.mMetaManager.UnlockManager.deserialize(obj);});
        }

        if (initCounter == 3)
        {
            mZig.mManager.GameEventDistributor("OTHER_PLATFORM_INITIALIZE", null);
        }
        initCounter++;

        //ManagerManager.Manager.mDebugString2 = mKinect.IsTracking.ToString();
    }