コード例 #1
0
        /// <summary>
        /// 计算结果
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int GetAnswer(LandingUIEntity entity)
        {
            int num1 = int.Parse(entity.questionText.Split('+')[0]);
            int num2 = int.Parse(entity.questionText.Split('+')[1]);

            return(num1 + num2);
        }
コード例 #2
0
        public override void ProcessLogic(PropertyMessage evt)
        {
            LandingUIEntity entity = (LandingUIEntity)GameObject.FindObjectOfType <LandingUiViewModel>().DataEntity;

            //Esc按钮
            if (evt.PropertyName.Equals("escBtn"))
            {
                if ((int)evt.NewValue > 0)
                {
                    Debug.Log("点击了退出按钮");
                }
            }
            //Landing按钮
            if (evt.PropertyName.Equals("landingBtn"))
            {
                if ((int)evt.NewValue > 0)
                {
                    if (!string.IsNullOrEmpty(entity.inputFieldText))
                    {
                        //答案校验
                        if (int.Parse(entity.inputFieldText).Equals(GetAnswer(entity)))
                        {
                            //开始场景切换
                            SenceLoadingDataEntity sceneEntity = (SenceLoadingDataEntity)GameObject.FindObjectOfType <SenceLoadingDataModel>().DataEntity;
                            sceneEntity.TargetSenceName = "031Main";
                            sceneEntity.IsShowLoadingUI = true;
                        }
                    }
                }
            }
        }