public static ManagerManager GetInstance()
 {
     if (_instance == null)
     {
         _instance = new ManagerManager();
         _instance.Init();
     }
     return _instance;
 }
    private void Awake()
    {
        ManagerManager.SetManagers(this);
        _nameText  = inventoryObject.transform.Find("Name").GetComponent <Text>();
        _countText = inventoryObject.transform.Find("Count").GetComponent <Text>();
        _slots     = new InventorySlot[_x * _y];
        int i = 0;

        for (int y = 0; y < _y; y++)
        {
            for (int x = 0; x < _x; x++)
            {
                _slots[i] = Instantiate(slotPrefab).GetComponent <InventorySlot>();
                _slots[i].transform.SetParent(inventoryObject.transform);
                _slots[i].GetComponent <RectTransform>().anchoredPosition = new Vector2(x * _size, -y * _size);
                _slots[i].gameObject.SetActive(false);
                i++;
            }
        }
        Close();
    }
示例#3
0
        private void btnSubmit_Click(object sender, System.EventArgs e)
        {
            string id              = this.txtId.Text;
            string name            = this.txtName.Text;
            string password        = this.txtPassword.Text;
            string passwordConfirm = this.txtConfirm.Text;
            int    property        = this.cmbProperty.SelectedIndex;

            if (id == "" || name == "")
            {
                MessageBox.Show("登陆名或密码不能为空!");
                return;
            }
            if (password != passwordConfirm)
            {
                MessageBox.Show("密码不一致!");
                return;
            }
            if (MainForm.Form.CurrentManager.Property == 1 && property == 1)
            {
                MessageBox.Show("您无此权限!");
                return;
            }
            if (property < 0)
            {
                MessageBox.Show("请选择正确的用户权限!");
                return;
            }
            int i = ManagerManager.CreateManager(id, name, password, property);

            if (i == -1)
            {
                MessageBox.Show("该用户已经存在,请选择不同的登陆名!");
                return;
            }

            this.DialogResult = DialogResult.OK;

            this.Close();
        }
示例#4
0
        private void btnLogin_Click(object sender, System.EventArgs e)
        {
            string id       = this.txtId.Text.Trim();
            string password = this.txtPassword.Text.Trim();

            if (id.Length == 0)
            {
                MessageBox.Show("用户名不能为空!");
                return;
            }
            if (password.Length == 0)
            {
                MessageBox.Show("密码不能为空!");
                return;
            }
            try
            {
                if (ManagerManager.ValidateManager(id, password) > 0)
                {
                    DataTable tbl = ManagerManager.GetManager(id);
                    //创建一个当前的用户
                    MainForm.Form.CurrentManager          = new Manager();
                    MainForm.Form.CurrentManager.Id       = id;
                    MainForm.Form.CurrentManager.Name     = tbl.Rows[0]["name"].ToString();
                    MainForm.Form.CurrentManager.Password = tbl.Rows[0]["password"].ToString();
                    MainForm.Form.CurrentManager.Property = Int32.Parse(tbl.Rows[0]["property"].ToString());

                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                else
                {
                    MessageBox.Show("用户名或密码错误!");
                }
            }
            catch (Exception e1)
            {
                MessageBox.Show(e1.InnerException.Message);
            }
        }
示例#5
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string M_Name     = txtName.Text.Trim();
            string M_Password = txtPassword.Text.Trim();
            //获取验证码
            string checkCode = txtCheckcode.Text;

            try
            {
                if (Request.Cookies["checkCode"].Value == checkCode)
                {
                    SqlDataReader dr = ManagerManager.Login(M_Name, M_Password);
                    if (dr.Read())
                    {
                        Session["M_Id"]   = dr[0];
                        Session["M_Name"] = dr[1].ToString();
                        Session["role"]   = 3;
                        if (Session["callerh"] != null)
                        {
                            Response.Redirect(Session["callerh"].ToString());
                        }
                        Response.Redirect("~/index.aspx");
                    }
                    else
                    {
                        label1.Text = "用户名或密码错误!";
                    }
                }
                else
                {
                    label1.Text = "验证码输入有误!";
                }
            }
            catch (Exception ex)
            {
                Response.Write("错误原因:" + ex.Message);
            }
        }
示例#6
0
    public void write_data(byte[] aData, string aName)
    {
        if (StorageCreated && !IsWriting)
        {
            //Debug.Log("trying to write data " + aData.Length);
            IsWriting = true;
            DataMap toSave = DataMap.Create();
            toSave.AddOrReplaceBuffer(aName, aData);
            mStorage.SubmitUpdatesAsync(toSave, null, delegate(ContainerContext Storage2, SubmitDataMapUpdatesAsyncOp op2)
            {
                bool ok = op2.Success && op2.Status == ConnectedStorageStatus.SUCCESS;

                ManagerManager.Log("write data success " + ok + " " + op2.Success + " " + op2.Status);
                //TODO confirm success??

                IsWriting = false;
            });
        }
        else
        {
            ManagerManager.Log("error, could not write " + StorageCreated + " " + IsWriting);
        }
    }
示例#7
0
    public static Pose snap_pose(ManagerManager manager)
    {
        Pose p = new Pose();

        foreach (KeyValuePair <ZgJointId, ZgJointId> e in sPairs)
        {
            PoseElement pe = new PoseElement();
            //ZigInputJoint A = manager.mZigManager.Joints[e.Key];
            //ZigInputJoint B = manager.mZigManager.Joints[e.Value];
            //pe.angle = manager.mProjectionManager.get_relative(A, B);
            pe.weight = 1;
            pe.angle  = manager.mProjectionManager.get_smoothed_relative(e.Key, e.Value);
            pe.joint  = e.Key;
            p.mElements.Add(pe);
        }
        PoseElement waist = new PoseElement();

        waist.angle = manager.mProjectionManager.mWaist.current;
        //waist.angle = manager.mProjectionManager.get_waist(manager.mZigManager.Joints[ZigJointId.Waist], manager.mZigManager.Joints[ZigJointId.LeftHip], manager.mZigManager.Joints[ZigJointId.RightHip]);
        waist.joint = ZgJointId.Waist;
        p.mElements.Add(waist);
        return(p);
    }
示例#8
0
        protected void saveButton_Click(object sender, EventArgs e)
        {
            aManager = new ManagerManager();
            if (userIdTextBox.Text == "" || userNameTextBox.Text == "" || typeDropDownList.SelectedItem.Text == "" || userPassTextBox.Text == "")
            {
                msgLabel.Text = "please enter the value";
            }
            else
            {
                account = new UserAccount();

                account.UserId   = userIdTextBox.Text;
                account.UserName = userNameTextBox.Text;
                account.UserType = typeDropDownList.SelectedItem.Text;
                account.Password = userPassTextBox.Text;

                msgLabel.Text = aManager.Save(account);

                GridView1.Visible = true;
                PopulateGridView();
                ClearTextBox();
            }
        }
示例#9
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            aManager = new ManagerManager();
            int     r  = e.RowIndex;
            TextBox t1 = (TextBox)GridView1.Rows[r].FindControl("idTextBox");
            TextBox t2 = (TextBox)GridView1.Rows[r].FindControl("nameTextBox");
            TextBox t3 = (TextBox)GridView1.Rows[r].FindControl("typeTextBox");
            TextBox t4 = (TextBox)GridView1.Rows[r].FindControl("passTextBox");

            bool flag = aManager.Update(int.Parse(t1.Text), t2.Text, t3.Text, t4.Text);

            if (flag == true)
            {
                msgLabel.Text        = "Update Successfully";
                GridView1.DataSource = aManager.ShowAllUser();
                GridView1.EditIndex  = -1;
                GridView1.DataBind();
            }
            else
            {
                msgLabel.Text = "Not Updated, Sorry!!!!!";
            }
        }
示例#10
0
    //OTHER
    bool SanityCheckApplicationSetup()
    {
        // We sanity check some things before we allow you to run, achievements and other live services
        // really do not like to be used against the wrong sandbox or with the wrong TID/SCID.
        string warningText = "";

        if (ConsoleUtilsManager.SandboxId() != "PRFW.0")
        {
            warningText += "\n\nERROR: SandboxId not set to PRFW.0 sample will not run";
            warningText += "\n       >> Current Id: \"" + ConsoleUtilsManager.SandboxId() + "\"";
            warningText += "\n       >> Suppose to be: \"PRFW.0\"";
        }

        if (ConsoleUtilsManager.PrimaryServiceConfigId() != "f3530100-c251-40ff-9d13-078c4a0a3432")
        {
            warningText += "\n\nERROR: SCID not set to f3530100-c251-40ff-9d13-078c4a0a3432 sample will not run";
            warningText += "\n       >> Current Id: " + ConsoleUtilsManager.PrimaryServiceConfigId();
        }

        if (ConsoleUtilsManager.TitleIdHex() != "4A0A3432")
        {
            warningText += "\n\nERROR: TID not set to 4A0A3432 sample will not run";
            warningText += "\n       >> Current Id: " + ConsoleUtilsManager.TitleIdHex();
        }

        bool ok = warningText == "" && UsersManager.IsSomeoneSignedIn;

        if (!ok)
        {
            ManagerManager.Log(warningText);
            return(false);
        }
        ManagerManager.Log("Sanity check OK");

        return(ok);
    }
示例#11
0
 public void read_data(string aName, System.Action <byte[]> aResponse)
 {
     if (StorageCreated)
     {
         mStorage.GetAsync(new string[] { aName },
                           delegate(ContainerContext storage, GetDataMapViewAsyncOp op, DataMapView view) {
             if (op.Success)
             {
                 var data = view.GetBuffer(aName);
                 aResponse(data);
             }
             else
             {
                 aResponse(null);
             }
         }
                           );
     }
     else
     {
         ManagerManager.Log("error trying to read data before storage is created");
         aResponse(null);
     }
 }
示例#12
0
 void OnUsersChanged(int id, bool wasAdded)
 {
     ManagerManager.Log("OnUsersChanged " + id + " " + GetUserName(id) + " " + wasAdded);
 }
示例#13
0
 void OnPresenceSet(bool setOk, int resultCode)
 {
     ManagerManager.Log("Presence: [" + (setOk ? "Ok" : "Failed") + "] resultCode: [" + resultCode + "]");
 }
示例#14
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;
        }
    }
示例#15
0
 void Awake()
 {
     ManagerManager.SetManagers(this);
     mapNameText.text = StaticDatas.mapName;
 }
示例#16
0
 void OnUserDisplayInfoChange(int id)
 {
     ManagerManager.Log("OnUserDisplayInfoChange " + id);
 }
示例#17
0
        private void cmbName_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            DataTable tbl = ManagerManager.GetManager(this.cmbName.SelectedValue.ToString());

            this.cmbProperty.SelectedIndex = Int32.Parse(tbl.Rows[0]["property"].ToString());
        }
示例#18
0
    public void set_for_GRAVE(List <PerformanceStats> aStats)
    {
        //timing vars
        float gIntroText      = 4.5f;
        float gPreScoreCount  = 0.03f;
        float gScoreCount     = 0.2f;
        float gPostScoreCount = 0.07f;
        float gRestart        = 29;

        //disable the depth warning
        mManager.mZigManager.ForceShow = 2;

        //add the gravestone to the scene
        add_character(CharacterIndex.sGrave, true, false);

        //remove the grave
        if (aStats.Last().Character.Age == 999)
        {
            aStats.RemoveAt(aStats.Count - 1);
        }

        //add in fetus in case we skipped it in debug mode
        if (aStats.First().Character.Age != 0)
        {
            aStats.Insert(0, new PerformanceStats(new CharacterIndex(0, 0)));
        }

        //fake it for testing...

        /* TODO DELETE move this into ModeNormalPlay on force kill
         * mCharacters.Last().destroy(); //remove the grave
         * mElement.Remove(mCharacters.Last());
         * mCharacters.RemoveAt(mCharacters.Count -1);
         * Random.seed = 123;
         * for(int i = 0; i < 8; i++)
         * {
         *      if(aStats.Last().Character.Age < (new CharacterIndex(i,0)).Age)
         *      {
         *              PerformanceStats stat = new PerformanceStats(new CharacterIndex(i,Random.Range(0,4)));
         *              stat.update_score(0,Random.value);
         *              stat.update_score(1,Random.value);
         *              stat.Stats = mManager.mGameManager.CharacterHelper.Characters[stat.Character];
         *              aStats.Add(stat);
         *
         *              add_character(stat.Character,false);
         *      }
         * }
         * add_character(CharacterIndex.sGrave,false); //add the grave back in
         */


        //this is all a hack to get the score to show up right...
        float           scoreIncrementor = 0;
        FlatElementText finalScoreText   = new FlatElementText(mManager.mNewRef.serifFont, 70, "0", 21);

        finalScoreText.HardColor = (GameConstants.UiGraveText);
        FlatElementText finalAgeText   = new FlatElementText(mManager.mNewRef.serifFont, 50, "0", 21);
        float           ageIncrementer = 0;

        finalAgeText.HardColor = (GameConstants.UiGraveText);
        //perfectPercent.Text = ((int)(100*aStats.Sum(e=>e.Stats.Perfect+1)/(float)(aStats.Count*3))).ToString() + "%";
        //TODO why this no work??
        finalAgeText.Text = "0";        //aStats.Last().Character.Age.ToString();

        //hack to put things into bg camera
        foreach (Renderer f in finalScoreText.PrimaryGameObject.GetComponentsInChildren <Renderer>())
        {
            f.gameObject.layer = 4;
        }
        foreach (Renderer f in finalAgeText.PrimaryGameObject.GetComponentsInChildren <Renderer>())
        {
            f.gameObject.layer = 4;
        }
        //foreach (Renderer f in perfectEngraving.PrimaryGameObject.GetComponentsInChildren<Renderer>()) f.gameObject.layer = 4;

        Vector3 graveCenter = mCharacters[mCharacters.Count - 1].HardPosition + new Vector3(0, 50, 0);

        finalScoreText.HardPosition = graveCenter + new Vector3(30, -180, 0);
        finalAgeText.HardPosition   = graveCenter + new Vector3(25, 0, 0);
        mElement.Add(finalScoreText);
        //mElement.Add(perfectEngraving);
        mElement.Add(finalAgeText);

        graveCleanup.Add(finalScoreText);
        graveCleanup.Add(finalAgeText);


        TimedEventDistributor.TimedEventChain chain = TED.empty_chain();

        chain = chain.then_one_shot(
            delegate {
            set_sun();
        }
            , 0);
        chain = chain.then(
            low_skippable_text_bubble_event(GameStrings.GetString("SM1"), gIntroText), 3);

        /*.then( //wait a little bit to let the fading finish
         *      low_skippable_text_bubble_event("HERE IS YOUR LIFE STORY",gIntroText)
         *  );*/

        for (int i = 1; i < aStats.Count; i++)
        {
            PerformanceStats ps = aStats[i];


            chain = chain.then_one_shot(
                delegate() {
                if (ps.Character != CharacterIndex.sOneHundred)
                {
                    show_score(ps.Character, (int)ps.AdjustedScore, gPreScoreCount + gScoreCount + gPostScoreCount + 1.5f);
                }
            }
                , gPreScoreCount).then(
                delegate(float aTime)
            {
                if (aTime < gScoreCount)
                {
                    float displayScore  = scoreIncrementor + (aTime / gScoreCount) * ps.AdjustedScore;
                    float displayAge    = ageIncrementer + (aTime / gScoreCount) * (ps.Character.Age - ageIncrementer);
                    finalScoreText.Text = "" + (int)displayScore;
                    finalAgeText.Text   = "" + (int)displayAge;
                }
                if (aTime > gScoreCount + gPostScoreCount)
                {
                    scoreIncrementor   += ps.AdjustedScore;
                    ageIncrementer      = ps.Character.Age;
                    finalScoreText.Text = "" + (int)scoreIncrementor;
                    finalAgeText.Text   = "" + (int)ageIncrementer;
                    return(true);
                }
                return(false);
            },
                0);
        }

        chain = chain.wait(2.5f);

        //CONNECTIONS
        for (int i = 1; i < aStats.Count; i++)
        {
            PerformanceStats ps = aStats[i];



            float gFirstConnectionText = 5f;
            float gConnectionText      = 5f;
            float gPreParticle         = 2f;


            //TODO grave connections
            CharIndexContainerString connections;

            //TODO
            bool wasHard = ps.Stats.Difficulty > 1;
            if (wasHard)
            {
                connections = mManager.mCharacterBundleManager.get_character_stat(ps.Character).CharacterInfo.HardConnections;
            }
            else
            {
                connections = mManager.mCharacterBundleManager.get_character_stat(ps.Character).CharacterInfo.EasyConnections;
            }


            //for each connection, check if it is relevent to the currently looping character
            for (int j = 1; j < aStats.Count; j++)
            {
                var targetCharacter  = aStats[j].Character;                             //charcter we are connecting to
                var targetConnection = connections[targetCharacter];                    //message
                if (targetConnection != null && targetConnection != "")
                {
                    int accumChange = 0;                     //accum change is targetCharacters effect on the current character
                    accumChange = aStats[j].CutsceneChangeSet.accumulative_changes()[ps.Character];

                    if ((wasHard && accumChange > 0) ||                   //if was hard and effect was positive (i.e. hard)
                        (!wasHard && accumChange < 0))                    //if was easy and effect was negative (i.e. easy)
                    {
                        string []       conText = targetConnection.Replace("<S>", "@").Split('@');
                        PopupTextObject npo     = null;
                        chain = chain.then(
                            delegate(float aTime)
                        {
                            if (npo == null)
                            {
                                npo = add_timed_text_bubble(conText[0], gFirstConnectionText + gConnectionText, -0.6f, 1);
                                set_popup_color_for_cutscene_particles(npo, wasHard);
                                create_shine_over_character(targetCharacter, !wasHard, gFirstConnectionText + gConnectionText);
                                TED.add_one_shot_event(
                                    delegate() {
                                    create_shine_over_character(ps.Character, !wasHard, gFirstConnectionText + gConnectionText - 0.3f);
                                }
                                    , 0.3f);
                            }
                            if (npo.IsDestroyed || aTime > gPreParticle)
                            {
                                return(true);
                            }
                            return(false);
                        }
                            , 0);

                        System.Func <FlatElementBase, float, bool> jiggleDelegate =
                            delegate(FlatElementBase aBase, float aTime2)
                        {
                            aBase.mLocalRotation = Quaternion.AngleAxis(Mathf.Sin(aTime2 * Mathf.PI * 2 * 8) * 10f, Vector3.forward);
                            if (aTime2 >= (gFirstConnectionText - gPreParticle) / 4f)
                            {
                                aBase.mLocalRotation = Quaternion.identity;
                                return(true);
                            }
                            return(false);
                        };

                        chain = chain.then_one_shot(
                            delegate()
                        {
                            if (npo != null)
                            {
                                mCharacters[char_to_list_index(targetCharacter)].Events.add_event(jiggleDelegate, 0);
                                ManagerManager.Manager.mMusicManager.play_sound_effect("graveShine");
                            }
                            //create the shine
                        }
                            ).then_one_shot(
                            delegate()
                        {
                            if (npo != null && !npo.IsDestroyed)                                    //if we used softskip, npo could be destroyed at this point
                            {
                                npo.Text = conText.Last();
                                mCharacters[char_to_list_index(ps.Character)].Events.add_event(jiggleDelegate, 0);
                                ManagerManager.Manager.mMusicManager.play_sound_effect("graveShine");
                            }
                        },
                            gFirstConnectionText - gPreParticle).then(
                            delegate(float aTime){
                            if (npo.IsDestroyed || aTime > gConnectionText)
                            {
                                npo = null;
                                return(true);
                            }
                            return(false);
                        }
                            );
                    }
                }
            }
        }

        string deathSentence = "";

        if (aStats[aStats.Count - 1].DeathTime != -1)
        {
            deathSentence += GameStrings.GetString("SM2");
        }
        else
        {
            deathSentence += GameStrings.GetString("SM3");
        }
        if (!aStats [aStats.Count - 1].Character.IsDescriptionAdjective)
        {
            if ("aeiouAEIOU".IndexOf(aStats[aStats.Count - 1].Character.Description[0]) >= 0)
            {
                deathSentence += GameStrings.GetString("SM4");
            }
            else
            {
                deathSentence += GameStrings.GetString("SM5");
            }
        }
        deathSentence += aStats[aStats.Count - 1].Character.Description;

        chain = chain.then(
            low_skippable_text_bubble_event(deathSentence, gIntroText)
            , 1);


        foreach (CharacterIndex e in CharacterIndex.sAllCharacters)
        {
            UnlockRequirements.UnlockData unlockData;
            if (mManager.mMetaManager.UnlockManager.unlockedThisGame.TryGetValue(new UnlockRequirements.FakeCharIndex(e), out unlockData))
            {
                if (unlockData != null)
                {
                    ManagerManager.Log("announcing unlock " + e.StringIdentifier);
                    CharacterIndex ce = new CharacterIndex(e);
                    chain = chain.then_one_shot(
                        delegate(){
                        mUnlockAnnouncer.announce_unlock(ce, unlockData);
                    }
                        , 0).then(
                        delegate(float aTime){
                        return(!mUnlockAnnouncer.IsAnnouncing);
                    }
                        , 0);
                }
            }
        }

        //so we don't announce unlock again when we restart
        mManager.mMetaManager.UnlockManager.unlockedThisGame.Clear();



        if (GameConstants.showReward && aStats[aStats.Count - 1].Character.LevelIndex >= 7)
        {
            FlatElementImage rewardImage = null;
            FlatElementImage rewardFrame = null;
            mModeNormalPlay.mGiftManager.set_background_for_render();
            chain = chain.then_one_shot(
                delegate()  {
                var frameImg = mManager.mCharacterBundleManager.get_image("GIFT_frame");
                rewardFrame  = new FlatElementImage(frameImg.Image, frameImg.Data.Size, 24);
                rewardImage  = new FlatElementImage(mModeNormalPlay.mGiftManager.render_gift(0), new Vector2(2001, 1128), 23);

                //TODO play sound effect
                rewardImage.HardPosition = mFlatCamera.get_point(0, 3);
                rewardFrame.HardPosition = rewardImage.HardPosition;
                rewardImage.SoftPosition = mFlatCamera.get_point(Vector3.zero) + new Vector3(0, 150, 0);
                rewardFrame.SoftPosition = rewardImage.SoftPosition + new Vector3(0, 70, 0);
                mElement.Add(rewardImage);
                mElement.Add(rewardFrame);
                graveCleanup.Add(rewardImage);
                graveCleanup.Add(rewardFrame);

                var subChain = TED.empty_chain().wait(4);
                if (mModeNormalPlay.mGiftManager.gift_count() > 0)
                {
                    for (int i = 1; i < 100; i++)
                    {
                        int localIndex = i % mModeNormalPlay.mGiftManager.gift_count();
                        subChain       = subChain.then_one_shot(
                            delegate(){
                            //TODO sound effect
                            mModeNormalPlay.mGiftManager.render_gift(localIndex);
                        }
                            , 1f);
                    }
                }
            }
                , 2);
            //chain = chain.wait(6);
            //chain = chain.then(skippable_text_bubble_event("YOU ARE THE PERFECT WOMAN!",5,-0.8f,2),0);
        }



        //variables for credits animation..
        float lastTime = 0;

        FlatElementImage[] logos = null;
        //PopupTextObject gameOver = null;
        List <FlatElementText> creditsText = new List <FlatElementText>();
        float scrollSpeed = 820;

        mGraveCompleteCb = delegate()
        {
            Vector3 barYPosition = mFlatCamera.get_point(Vector3.zero) + new Vector3(0, -700, 0);
            TED.add_one_shot_event(
                delegate()
            {
                mManager.mMusicManager.fade_in_extra_music("creditsMusic");
                mManager.mMusicManager.fade_out();
                var imgData         = mManager.mCharacterBundleManager.get_image("BAR");
                var barImg          = new FlatElementImage(imgData.Image, imgData.Data.Size, 24);
                barImg.HardPosition = barYPosition + new Vector3(0, -1000, 0);
                barImg.SoftPosition = barYPosition;
                mElement.Add(barImg);
                graveCleanup.Add(barImg);
            }
                , 0).then_one_shot(
                delegate()
            {
                float lastXPosition = mFlatCamera.get_point(Vector3.zero).x - mFlatCamera.Width / 2 - 100;
                int counter         = 0;
                foreach (string e in GameConstants.credits)
                {
                    string val = e;
                    if (System.Text.RegularExpressions.Regex.IsMatch(e, @"^\d+$"))
                    {
                        val = GameStrings.GetString("GCcredits" + e);
                    }

                    var text          = new FlatElementText(mManager.mNewRef.genericFont, 70, val, 25);
                    float textWidth   = text.BoundingBox.width;
                    text.HardColor    = new Color(1, 1, 1, 1);
                    text.HardPosition = new Vector3(lastXPosition - textWidth / 2f, barYPosition.y, 0);
                    lastXPosition    += -textWidth - 75;
                    creditsText.Add(text);
                    mElement.Add(text);
                    graveCleanup.Add(text);
                    counter++;
                }

                if (GameConstants.SHOW_LOGOS)
                {
                    logos               = new FlatElementImage[3];
                    lastXPosition      += -200;
                    string[] imageNames = new string[] { "LOGO_FA", "LOGO_AI", "LOGO_GL" };
                    for (int i = 0; i < imageNames.Length; i++)
                    {
                        var imgData      = mManager.mCharacterBundleManager.get_image(imageNames[i]);
                        var img          = new FlatElementImage(imgData.Image, imgData.Data.Size, 25);
                        float imgWidth   = img.BoundingBox.width;
                        img.HardPosition = new Vector3(lastXPosition - imgWidth / 2, barYPosition.y, 0);
                        lastXPosition   += -img.BoundingBox.width / 2f - 500;
                        logos[i]         = img;
                        mElement.Add(img);
                        graveCleanup.Add(img);
                    }
                }
            }
                , 1).then_one_shot(
                delegate()
            {
                /* this will fade everything out super slowly
                 * List<FlatElementBase> graveItems = new List<FlatElementBase>(){finalScoreText,perfectPercent};
                 * foreach(FlatElementBase e in
                 *  mCharacters.Cast<FlatElementBase>()
                 *  .Concat(mDiffLabels.Cast<FlatElementBase>())
                 *  .Concat(mScoreLabels.Cast<FlatElementBase>())
                 *  .Concat(mScoreTexts.Cast<FlatElementBase>())
                 *  .Concat(graveItems.Cast<FlatElementBase>()))
                 * {
                 *  e.ColorInterpolationLimit = 0.05f;
                 *  e.SoftColor = GameConstants.UiWhiteTransparent;
                 * }*/
            }
                , 0).then(
                delegate(float aTime)
            {
                //scroll contents down
                Vector3 scroll = new Vector3(scrollSpeed * (aTime - lastTime), 0, 0);
                foreach (FlatElementText e in creditsText)
                {
                    e.SoftPosition = e.SoftPosition + scroll;
                }

                if (logos != null)
                {
                    foreach (FlatElementImage e in logos)
                    {
                        e.SoftPosition = e.SoftPosition + scroll;
                    }
                }

                lastTime = aTime;
                if (Input.GetKeyDown(KeyCode.Alpha0))
                {
                    return(true);
                }

                if (aTime > gRestart)
                {
                    return(true);
                }
                return(false);
            }
                , 0).then_one_shot(
                delegate(){
                mManager.mMusicManager.fade_out_extra_music();
                mManager.restart_game();
            }
                , 0);
            mGraveCompleteChain = TED.LastEventKeyAdded;
        };

        chain = chain.then_one_shot(
            delegate()
        {
            mGraveCompleteCb();
            mGraveCompleteCb = null;
            mGraveChain      = null;
        }
            , 1);

        mGraveChain = TED.LastEventKeyAdded;
    }
示例#19
0
 public SunsetManager(ManagerManager aManager, ModeNormalPlay aNormalPlay)
 {
     mModeNormalPlay = aNormalPlay;
     mManager        = aManager;
     IsLoaded        = false;
 }
示例#20
0
    public void create_particles(AdvancedGrading aGrade, bool continuous = false)
    {
        ManagerManager man        = ManagerManager.Manager;
        BodyManager    activeBody = man.mBodyManager;



        /*foreach(var e in sJointGroups)
         * {
         *      float score = ProGrading.grade_to_perfect(aGrade.joint_aggregate_score(e.Value));
         *      //if(!continuous)
         *              //mParticles.emit_point(score,activeBody.mFlat.get_body_part_position(e.Key),200);
         *      //else
         *              mParticles.emit_continuous(score,activeBody.mFlat.get_body_part_position(e.Key));
         * }*/


        /*
         * foreach(var e in sConnectedGroups)
         * {
         *      float score = ProGrading.grade_to_perfect(aGrade.joint_score(e.Key));
         *      Vector3[] path = new Vector3[e.Value.Length+1];
         *      path[0] = activeBody.mFlat.get_body_part_position(e.Value[0]);
         *      path[1] = activeBody.mFlat.get_body_part_position(e.Key);
         *      if(e.Value.Length == 2)
         *              path[2] = activeBody.mFlat.get_body_part_position(e.Value[1]);
         *      PolygonalPath pPath = new PolygonalPath(path);
         *
         *      for(int i = 0; i < pPath.PathLength/20f; i++)
         *      {
         *              mParticles.emit_continuous(score,pPath.evaluate((float)i*20/pPath.PathLength));
         *      }
         *
         *      if(pPath.PathLength == 0)
         *              mParticles.emit_continuous(score,pPath.evaluate(0));
         * }*/



        if (!continuous)
        {
            bool fever = man.mGameManager.mModeNormalPlay.IsFever;

            float grade = ProGrading.grade_to_perfect(aGrade.CurrentGrade);

            int inc = Mathf.Clamp((int)(5 * grade), 0, 4);


            if (inc < 1)
            {
                //TODO sad particles
            }
            if (inc >= 2 && inc < 3)
            {
                //mParticles.emit_ring("silver",5,activeBody.mFlat.get_body_part_position(ZigJointId.Torso),600, 1.5f);
                mParticles.emit_ring("silver", 7, activeBody.mFlat.get_body_part_position(ZgJointId.Torso), 900, 1.5f);
            }
            if (inc >= 3 && inc < 4)
            {
                mParticles.emit_ring("silver", 5, activeBody.mFlat.get_body_part_position(ZgJointId.Torso), 700, 1.5f);
                mParticles.emit_ring("gold", 7, activeBody.mFlat.get_body_part_position(ZgJointId.Torso), 1000, 2f);
            }
            if (inc == 4)
            {
                if (grade > GameConstants.playSuperCutoff && fever)
                {
                    mParticles.emit_ring("gold", 20, activeBody.mFlat.get_body_part_position(ZgJointId.Torso), 2500, 2f);
                    //mParticles.emit_ring("gold",15,activeBody.mFlat.get_body_part_position(ZigJointId.Torso),1500,3f);
                    mParticles.emit_ring("silver", 12, activeBody.mFlat.get_body_part_position(ZgJointId.Torso), 1900, 3f);
                    mParticles.emit_ring("gold", 7, activeBody.mFlat.get_body_part_position(ZgJointId.Torso), 1200, 4f);
                    mParticles.emit_ring("silver", 10, activeBody.mFlat.get_body_part_position(ZgJointId.Torso), 600, 1.5f);
                }
                else
                {
                    mParticles.emit_ring("gold", 12, activeBody.mFlat.get_body_part_position(ZgJointId.Torso), 1900, 4f);
                    mParticles.emit_ring("silver", 7, activeBody.mFlat.get_body_part_position(ZgJointId.Torso), 1200, 1.5f);
                    mParticles.emit_ring("gold", 10, activeBody.mFlat.get_body_part_position(ZgJointId.Torso), 600, 3f);
                }
            }


            //float ag = (grade-0.4f)*(grade-0.4f);
            //int count = (int)(100*ag);

            /*
             * if(grade > 0.6f)
             *      mParticles.emit_point(count*1/3, activeBody.mFlat.get_body_part_position(ZigJointId.Torso),700);
             * if(grade > 0.8f)
             *      mParticles.emit_point(count*2/3, activeBody.mFlat.get_body_part_position(ZigJointId.Torso),1000);
             */
        }

        //TODO test this..
        if (continuous)
        {
            //if(man.mGameManager.mModeNormalPlay.IsFever)
            {
                //TODO this is the wrong camera lol...
                //FlatCameraManager cam = ManagerManager.Manager.mGameManager.mModeNormalPlay.mFlatCamera;
                //mParticles.emit_line("gold",1,cam.get_point(-1f,1.1f),cam.get_point(1f,1.1f),2);
            }
        }



        //mParticles.emit_rect(grade.CurrentScore,new Rect
    }
示例#21
0
    public void Update()
    {
        //BODY
        //bool bodyReadSuccess = SensorManager.bodyFrameReader.AcquireLatestFrame(JointCoordType.DepthSpace);
        SensorManager.bodyFrameReader.AcquireLatestFrame(JointCoordType.DepthSpace);

        List <ulong> trackedIds = new List <ulong>();


        foreach (var e in SensorManager.BodyList.list)
        {
            if (e.isTracked)
            {
                trackedIds.Add(e.trackingId);
            }
        }

        if (trackedIds.Count > 0)
        {
            if (!trackedIds.Contains(mTrackingId))
            {
                mTrackingId = trackedIds [0];
                ManagerManager.Log("tracking " + mTrackingId);
            }
            IsTracking = true;
        }
        else
        {
            IsTracking = false;
        }

        //if(IsTracking)
        //ManagerManager.Manager.mDebugString2 = "tracking " + ((int)mTrackingId).ToString();
        //else ManagerManager.Manager.mDebugString2 = "NOT tracking " + ((int)mTrackingId).ToString();


        foreach (var e in SensorManager.BodyList.list)
        {
            if (IsTracking && e.trackingId == mTrackingId)
            {
                //ManagerManager.Manager.mDebugString2 = "real tracking " + ((int)mTrackingId).ToString();
                ZgTrackedUser tu = new ZgTrackedUser((int)mTrackingId);
                tu.SkeletonTracked = true;
                tu.PositionTracked = true;
                var jointsSeg = e.joints;
                for (int i = jointsSeg.Offset; i < (jointsSeg.Offset + jointsSeg.Count); i++)
                {
                    var jp = jointsSeg.Array[i];
                    for (int j = 0; j < tu.Skeleton.Count(); j++)
                    {
                        if (sJointTypeMap.ContainsKey(jp.jointType) && sJointTypeMap[jp.jointType] == tu.Skeleton[j].Id)
                        {
                            tu.Skeleton[j].Position     = GetVector3FromJoint(jp);
                            tu.Skeleton[j].GoodPosition = true;
                            //TODO rotation
                        }
                    }
                }

                /* this way does not seem to work for osme reason..
                 *              for(int i = 0; i < tu.Skeleton.Count(); i++)
                 *              {
                 *                      if(sJointTypeMap.Keys.Contains(tu.Skeleton[i].Id))
                 *                      {
                 *      try{
                 *                              tu.Skeleton[i].Position = GetVector3FromJoint(e.joints.Array.First(f=>f.jointType == sJointTypeMap[tu.Skeleton[i].Id]));
                 *                              tu.Skeleton[i].GoodPosition = true;
                 *      }catch{Debug.Log ("couldn't find joint " + tu.Skeleton[i].Id);}
                 *
                 *                      }
                 *              }*/
                ManagerManager.Manager.mZigManager.Zig_UpdateUser(tu);
                break;
            }
        }

        //TODO temporarily disabled to solf wrong format bug
        //DEPTH/IMAGE/USE
        FrameDescription depthFrameDesc;
        bool             depthFrameDescSuccess = SensorManager.depthFrameReader.GetFrameDescription(out depthFrameDesc);

        if (depthFrameDescSuccess)
        {
            //mDepthTexture = new Texture2D(depthFrameDesc.Width, depthFrameDesc.Height, TextureFormat.R16, false);
            //byte[] depthRawData = new byte[depthFrameDesc.BytesPerPixel * depthFrameDesc.LengthInPixels];
            //depthFrameDescSuccess = SensorManager.depthFrameReader.AcquireLatestFrame(mDepthTexture.GetNativeTexturePtr());
        }

        FrameDescription colorFrameDesc;
        bool             colorFrameDescSuccess = SensorManager.colorFrameReader.GetFrameDescription(out colorFrameDesc);

        if (colorFrameDescSuccess)
        {
            //byte[] colorRawData = new byte[colorFrameDesc.BytesPerPixel * colorFrameDesc.LengthInPixels];
            //colorFrameDescSuccess = SensorManager.colorFrameReader.AcquireLatestFrame(mColorTexture.GetNativeTexturePtr());
        }

        FrameDescription labelFrameDesc;
        bool             labelFrameDescSuccess = SensorManager.bodyIndexFrameReader.GetFrameDescription(out labelFrameDesc);

        if (labelFrameDescSuccess)
        {
            //byte[] labelRawData = new byte[labelFrameDesc.BytesPerPixel * labelFrameDesc.LengthInPixels];
            //labelFrameDescSuccess = SensorManager.bodyIndexFrameReader.AcquireLatestFrame(mLabelTexture.GetNativeTexturePtr());
        }
        //ManagerManager.Manager.mZigManager.DepthView.up
    }
        public ExecutionManager()
        {
            ThisExecutionManager = this;
            GlobalSettings.ApplicationSettings = new ApplicationSettings();
            GlobalSettings.SystemServices = new MackayFisher.Utilities.SystemServices(GlobalSettings.ApplicationSettings.BuildFileName(GlobalSettings.ApplicationSettings.LogFile));
            LastLogChange = DateTime.Today;
            GlobalSettings.ApplicationSettings.SetSystemServices(GlobalSettings.SystemServices);
            LoadLogSettings();

            ExecutionState = ExecutionState.Startup;
            SuspendRequested = false;

            GenThreadManager = new GenThreadManagement.GenThreadManager(GlobalSettings.SystemServices);
            ExecutionTimeLine = new ExecutionTimeLine();

            ManagerManager = new ManagerManager(this);
        }
 public CharacterBundleManager(ManagerManager aManager) : base(aManager)
 {
 }
示例#24
0
 private void Start()
 {
     ManagerManager.SetManagers(this);
     _minimapManager.Register(this);
 }
示例#25
0
 void OnUserSignIn(int id)
 {
     ManagerManager.Log("OnUserSignIn " + id + " " + GetUserName(id));
 }
示例#26
0
 public void LoadDataFile(string strFileName, DataFileLoaderFunc completeFunc, eLoadDataPriority loadDataPriority = eLoadDataPriority.NORMAL)
 {
     ManagerManager.LoadDataFile(loadDataPriority, strFileName, completeFunc);
 }
示例#27
0
    public void Start()
    {
        //initialize vars
        ManagerManager.Manager.GameEventDistributor += game_event_listener;

        //initialize all plugins
        DataPlatformPlugin.InitializePlugin(0);
        TextSystemsManager.Create();
        UsersManager.Create();
        AchievementsManager.Create();
        StatisticsManager.Create();

        string words = "";

        using (StreamReader reader = new StreamReader(@"G:\Data\StreamingAssets\Events-PRFW.0-4A0A3432.man"))
        {
            words = reader.ReadToEnd();
        }
        EventManager.CreateFromText(words);
        Storage.StorageManager.Create();

        //setup callbacks
        TextSystemsManager.OnPresenceSet += OnPresenceSet;
        AchievementsManager.OnAchievementNotification += delegate(AchievementNotification notice) { ManagerManager.Log("Achievement unlocked " + notice.AchievementId); };
        UsersManager.OnUsersChanged          += OnUsersChanged;
        UsersManager.OnUserSignIn            += OnUserSignIn;
        UsersManager.OnUserSignOut           += OnUserSignOut;
        UsersManager.OnSignOutStarted        += OnUserSignOutStarted;
        UsersManager.OnDisplayInfoChanged    += OnUserDisplayInfoChange;
        UsersManager.OnAppCurrentUserChanged += OnAppCurrentUserChanged;

        UsersManager.OnSignInComplete += OnSignInComplete;
    }
示例#28
0
    void game_event_listener(string name, object[] args)
    {
        if (mAll.LastActiveUser == null)
        {
            ManagerManager.Log("XboneEvents.cs: LastActiveUser is null, can't send event " + name);
            return;
        }

        if (name == "NEW CHARACTER")
        {
            if ((CharacterIndex)args [0] == CharacterIndex.sFetus)
            {
                //this is sent on user login/logout instead now
                //Events.SendPlayerSessionStart(mAll.LastActiveUser.UID, ref mSessionId, "", 0, 0);
            }

            if (((CharacterIndex)args [0]).LevelIndex == 1)
            {
                //Debug.Log("BORN EVENT");
                ManagerManager.Log("BORN EVENT");
                Events.SendBorn(mAll.LastActiveUser.UID, ref mSessionId);
            }
            if ((CharacterIndex)args [0] == CharacterIndex.sOneHundred)
            {
                //Debug.Log("TRANSCEND EVENT");
                ManagerManager.Log("TRANSCEND EVENT");
                Events.SendTranscend(mAll.LastActiveUser.UID, ref mSessionId);
            }

            mAll.SetRichUserPresence((CharacterIndex)args [0]);
        }
        if (name == "DEATH")
        {
            var gruesome = mManager.mGameManager.mModeNormalPlay.CurrentPerformanceStat.BadPerformance;
            ManagerManager.Log("DEATH EVENT " + (gruesome ? "GRUESOME" : "NORMAL"));

            send_game_progress();

            Events.SendPassing(
                mAll.LastActiveUser.UID,
                ref mSessionId,
                (int)mManager.mGameManager.mModeNormalPlay.TotalScore);

            if (gruesome)
            {
                Events.SendGruesomePassing(
                    mAll.LastActiveUser.UID,
                    ref mSessionId,
                    mManager.mGameManager.mModeNormalPlay.CurrentPerformanceStat.Character.Index);
            }

            var performance = args[0] as List <PerformanceStats>;
            handle_ad_hoc_events(performance);
        }

        if (name == "START")
        {
            Events.SendPlayerSessionStart(mAll.LastActiveUser.UID, ref mSessionId, "", 0, 0);
        }
        if (name == "PAUSE")
        {
            Events.SendPlayerSessionPause(mAll.LastActiveUser.UID, ref mSessionId, "");
        }
        if (name == "RESUME")
        {
            Events.SendPlayerSessionResume(mAll.LastActiveUser.UID, ref mSessionId, "", 0, 0);
        }

        if (name == "TERMINATE")
        {
            Events.SendPlayerSessionEnd(mAll.LastActiveUser.UID, ref mSessionId, "", 0, 0, 0);
        }
    }
 private void Awake()
 {
     _text = spinnerObject.transform.Find("Text").GetComponent <Text>();
     ManagerManager.SetManagers(this);
 }
示例#30
0
 void Awake()
 {
     ManagerManager.SetManagers(this);
     _list = new List <AlertBox>();
 }
示例#31
0
 //ModeNormalPlay mModeNormalPlay;
 public GiftManager(ManagerManager aManager, ModeNormalPlay aNormalPlay)
 {
     //mModeNormalPlay = aNormalPlay;
     mManager = aManager;
 }
示例#32
0
 private void Awake()
 {
     ManagerManager.SetManagers(this);
 }