Ejemplo n.º 1
0
    public override void OnMessage(Message message)
    {
        string name = message.Name;

        object[] body = message.Params;
        switch (name)
        {
        case MessageConst.CMD_TAKEPHOTOS_SHOW_SCORE:
            TakePhotosGameShowState cur = (TakePhotosGameShowState)body[0];

            _model = GetData <TakePhotosGameModel>();
            var vo = AddPhotoResult(cur);
            if (vo == null)
            {
                return;
            }

            bool isfinished = _model.GetRunningInfo().CheckFinished();
            scoreView.SetData(vo, cur, isfinished);
            scoreView.Show();
            break;

        case MessageConst.CMD_TAKEPHOTOSGAME_SCORE_VIEW_ONCLICK:
            View.UpdateScore(_model.GetRunningInfo().GetCurScore());
            View.ShowCurShowState();
            if (_model.GetRunningInfo().GetCurPhotoVo().isFinished)
            {
                _model.GetRunningInfo().DoNext();
                SendMessage(new Message(MessageConst.MODULE_TAKEPHOTOSGAME_GOTO_COUNTDOWN_PANEL));
            }
            break;
        }
    }
Ejemplo n.º 2
0
    public void SetData(TakePhotoGameStateVo vo, TakePhotosGameShowState state, bool isFinished = false)
    {
        SetStep(0);
        _isFinished = isFinished;

        SetAccuracy(vo.accuracy, state);
        SetScore(vo.score);
        ClientTimer.Instance.DelayCall(() => { DoNext(); }, 1.5f);
        ClientTimer.Instance.DelayCall(() => { DoNext(); }, 3f);
    }
Ejemplo n.º 3
0
    /// <summary>
    /// 传入准确率a
    /// </summary>
    /// <param name="state"></param>
    /// <param name="v"></param>
    public TakePhotoGameStateVo AddCurPhotoResult(TakePhotosGameShowState state, int a)
    {
        var vo = GetCurPhotoVo();

        if (vo == null)
        {
            return(null);
        }
        return(vo.SetStateVo(state, a));
    }
Ejemplo n.º 4
0
    private TakePhotoGameStateVo AddPhotoResult(TakePhotosGameShowState state)
    {
        var r = GetData <TakePhotosGameModel>().GetRunningInfo();

        switch (state)
        {
        case TakePhotosGameShowState.Scale:
            return(r.AddCurPhotoResult(state, CalculationsAccForScale()));

        case TakePhotosGameShowState.Move:
            return(r.AddCurPhotoResult(state, CalculationsAccForMove()));

        case TakePhotosGameShowState.Blur:
            DoGenerateT();
            return(r.AddCurPhotoResult(state, CalculationsAccForBlur()));
        }
        return(null);
    }
Ejemplo n.º 5
0
    public TakePhotoGameStateVo SetStateVo(TakePhotosGameShowState state, int accuracy)
    {
        var vo = _takePhotoGameStateVos.Find((m) => { return(m.showState == state); });

        if (vo == null)
        {
            vo           = new TakePhotoGameStateVo();
            vo.showState = state;
            vo.accuracy  = accuracy;
            vo.score     = GetScore(accuracy);//通过计算出分数
            _takePhotoGameStateVos.Add(vo);
        }

        if (state == TakePhotosGameShowState.Blur)
        {
            isFinished = true;
        }

        return(vo);
    }
Ejemplo n.º 6
0
    private void SetAccuracy(float accc, TakePhotosGameShowState state)
    {
        Image  accuracy = transform.Find("Accuracy/Image").GetImage();
        string r_path   = "UIAtlas_TakePhotosGame_Score" + state.ToString();

        accuracy.sprite = AssetManager.Instance.GetSpriteAtlas(r_path);

        int acc  = (int)accc;
        var nums = GetEveryNumString(acc);

        int showIdx = 0;

        for (int i = 0; i < 4; i++)
        {
            Image img = transform.GetImage("Accuracy/Num/Image" + i.ToString());
            if (showIdx > nums.Count)
            {
                img.gameObject.Hide();
                continue;
            }
            img.gameObject.Show();
            string path = "";
            if (showIdx < nums.Count)
            {
                path = "UIAtlas_TakePhotosGame_Score" + nums[showIdx];
            }
            else
            {
                path = "UIAtlas_TakePhotosGame_Percent";
            }

            img.sprite = AssetManager.Instance.GetSpriteAtlas(path);
            img.SetNativeSize();
            showIdx++;
        }
    }
Ejemplo n.º 7
0
 private Transform GetObjByState(TakePhotosGameShowState showState)
 {
     return(transform.Find(showState.ToString()));
 }
Ejemplo n.º 8
0
 public void SetCurShowState(TakePhotosGameShowState showState)
 {
     HideAllShowState();
     _curShowState = showState;
 }
Ejemplo n.º 9
0
 static public int ShowState2Proto(TakePhotosGameShowState state)
 {
     return((int)state - 1);
 }