public override void OnShow(object param)
        {
            base.OnShow(param);

            GameEvents.UIEvents.UI_GameEntry_Event.OnMaskBGVisible.SafeInvoke(true);

            MessageHandler.RegisterMessageHandler(MessageDefine.SCEnterResponse, OnScResponse);



            this.m_task_id = -1;

            if (null != param)
            {
                List <long> my_param = param as List <long>;
                this.m_scene_id = my_param[0];
                this.m_task_id  = my_param[1];
                m_view.Refresh(this.m_scene_id, this.m_task_id);

                Dictionary <UBSParamKeyName, object> _params = new Dictionary <UBSParamKeyName, object>()
                {
                    { UBSParamKeyName.ContentID, ConfJigsawScene.Get(this.m_scene_id).sceneInfoId },
                };
                UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.Pintu_start, null, _params);
            }

            m_is_started = false;
        }
        public override void OnScResponse(object s)
        {
            base.OnScResponse(s);

            if (s is SCEnterResponse)
            {
                var rsp = s as SCEnterResponse;

                m_is_started = false;

                if (!MsgStatusCodeUtil.OnError(rsp.Result))
                {
                    this.RefreshCostItemNum();

                    Dictionary <UBSParamKeyName, object> _params = new Dictionary <UBSParamKeyName, object>()
                    {
                        { UBSParamKeyName.Success, 1 },
                        { UBSParamKeyName.SceneID, this.m_scene_id },
                        { UBSParamKeyName.ContentID, ConfJigsawScene.Get(this.m_scene_id).sceneInfoId },
                    };
                    UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.Pintu_begin, null, _params);

                    FrameMgr.OpenUIParams ui_param = new FrameMgr.OpenUIParams(UIDefine.UI_JIGSAW);

                    ui_param.Param = new List <long> {
                        this.m_scene_id, ConfJigsawScene.Get(this.m_scene_id).sceneInfoId
                    };

                    EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(ui_param);

                    this.CloseFrame();
                    EngineCoreEvents.UIEvent.HideUIEvent.SafeInvoke(UIDefine.UI_CHAPTER);
                }
                else
                {
                    //#if UNITY_DEBUG
                    //                    FrameMgr.OpenUIParams ui_param = new FrameMgr.OpenUIParams(UIDefine.UI_JIGSAW);

                    //                    ui_param.Param = new List<long> { this.m_scene_id, ConfJigsawScene.Get(this.m_scene_id).sceneInfoId };

                    //                    EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(ui_param);

                    //                    this.CloseFrame();
                    //                    EngineCoreEvents.UIEvent.HideUIEvent.SafeInvoke(UIDefine.UI_CHAPTER);
                    //#else

                    Dictionary <UBSParamKeyName, object> _params = new Dictionary <UBSParamKeyName, object>()
                    {
                        { UBSParamKeyName.Success, 0 },
                        { UBSParamKeyName.Description, rsp.Result },
                        { UBSParamKeyName.SceneID, this.m_scene_id },
                        { UBSParamKeyName.ContentID, ConfJigsawScene.Get(this.m_scene_id).sceneInfoId },
                    };
                    UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.Pintu_begin, null, _params);
                    //#endif
                }
            }
        }
        private void RefreshCostItemNum()
        {
            ConfJigsawScene data = ConfJigsawScene.Get(m_scene_id);

            if (data.costPropIds.Length > 0)
            {
                long prop_id         = data.costPropIds[0];
                int  item_in_bag_num = null != GlobalInfo.MY_PLAYER_INFO.GetBagInfosByID(prop_id) ? GlobalInfo.MY_PLAYER_INFO.GetBagInfosByID(prop_id).Count : 0;

                if (item_in_bag_num >= 1)
                {
                    GlobalInfo.MY_PLAYER_INFO.ReducePropForBag(prop_id);
                }
            }
        }
Example #4
0
        public void Refresh(long scene_id_, long task_id_ = -1)
        {
            m_task_id = task_id_;
            ConfJigsawScene data = ConfJigsawScene.Get(scene_id_);

            m_desc_txt.Text = LocalizeModule.Instance.GetString(data.desc2);

            m_output_title_txt.Text = LocalizeModule.Instance.GetString("ui.event.Output");

            m_time_txt.Text = CommonTools.SecondToStringMMSS(data.percent4);


            m_thumbnail_tex.TextureName = data.thumbnail;

            RefreshOutputData(data);
            RefreshOutputView();

            //m_drop_title_txt.Text = LocalizeModule.Instance.GetString("ui.event.CommonDrop");

            //if (data.propId > 0)
            //{
            //    List<long> ids = CommonHelper.GetDropOuts(data.propId);

            //    m_drop_grid.EnsureSize<DropItemIcon>(ids.Count);

            //    for (int i = 0; i < m_drop_grid.ChildCount; ++i)
            //    {
            //        m_drop_grid.GetChild<DropItemIcon>(i).InitSprite(ConfProp.Get(ids[i]).icon, 0, ids[i]);
            //        m_drop_grid.GetChild<DropItemIcon>(i).Visible = true;
            //    }

            //}
            //else
            //{
            //    m_drop_grid.Clear();
            //}

            m_case_name_txt.Text = LocalizeModule.Instance.GetString(data.name);

            if (data.costPropIds.Length > 0)
            {
                long prop_id = data.costPropIds[0];
                m_ticket_icon.Sprite = ConfProp.Get(prop_id).icon;
                m_item_in_bag_num    = null != GlobalInfo.MY_PLAYER_INFO.GetBagInfosByID(prop_id) ? GlobalInfo.MY_PLAYER_INFO.GetBagInfosByID(prop_id).Count : 0;
                m_item_cost_num      = data.costPropNums[0];

                m_action_btn_num_txt.Text = string.Format("{0}/{1}", m_item_in_bag_num, m_item_cost_num);

                if (m_item_in_bag_num >= m_item_cost_num)
                {
                    m_action_btn_num_txt.color = Color.white;
                }
                else
                {
                    m_action_btn_num_txt.color = Color.red;
                }
            }
            else
            {
                m_action_btn_num_txt.Text = "";
            }
        }