コード例 #1
0
ファイル: PrefamceInfo.cs プロジェクト: zwong91/Titan
    public void Update()
    {
        if (Input.GetKey(KeyCode.Keypad0) && Input.GetKey(KeyCode.PageDown) && Input.GetKeyUp(KeyCode.KeypadEnter))
        {
            Initialize.isDebugMode = true;
        }
#if ENABLE_YUNYING_MODE
        if (Input.GetKeyUp(KeyCode.F8))
        {
            OptimitzedControlPlane.Instance.EanableUI = !OptimitzedControlPlane.Instance.EanableUI;
            if (OptimitzedControlPlane.Instance.EanableUI)
            {
                USpeedUI.UISystem.Instance.OpenUI();
            }
            else
            {
                USpeedUI.UISystem.Instance.CloseUI();
            }
        }
#endif
        if (Input.GetKeyUp(KeyCode.F11))
        {
            bShow = !bShow;
            ResetState();

            if (!bShow)
            {
                // 关闭指定实体属性值
                GameLogicAPI.onEntityEvent(EntityFactory.MainHeroID, (int)EntityLogicDef.ENTITY_CMD_ENTITY_PROPERTY_DRAGONBALL_CLOSE, 0, "", IntPtr.Zero, 0);
            }
            else
            {
                if (curUid == 0)
                {
                    return;
                }

                cmd_Entity_Property_Prefamce_Req data = new cmd_Entity_Property_Prefamce_Req();
                data.uidReq = (uint)curUid;
                IntPtrHelper helper = new IntPtrHelper();
                IntPtr       ptr    = helper.toPtr <cmd_Entity_Property_Prefamce_Req>(ref data);
                int          len    = Marshal.SizeOf(data);
                GameLogicAPI.onEntityEvent(EntityFactory.MainHeroID, (int)EntityLogicDef.ENTITY_CMD_ENTITY_PROPERTY_DRAGONBALL, len, "", ptr, len);
            }
        }
        deltaTime += (Time.deltaTime - deltaTime) * 0.1f;
    }
コード例 #2
0
ファイル: PrefamceInfo.cs プロジェクト: zwong91/Titan
    private void DebugEntityInfo(int _nScreenWidth, int _nScreenHeight)
    {
        if (!CheckVisible(EPreframeArea.EPA_Entity))
        {
            return;
        }

        if (InputManager.GetMouseButtonUp(0))
        {
            RaycastHit hit;
            Ray        ray = Initialize.mainCam.ScreenPointToRay(InputManager.MousePosition);
            if (Physics.Raycast(ray, out hit, 100, bDebugScreenRayCastLayer))
            {
                BaseStateMachine bs = hit.transform.GetComponentInParent <BaseStateMachine>();
                if (bs)
                {
                    Debug_CurrentSelectEntity = EntityFactory.getEntityViewByID(bs.entityID);

                    // 请求指定实体的属性值
                    if (curUid == bs.entityID)
                    {
                        return;
                    }

                    curUid = bs.entityID;
                    cmd_Entity_Property_Prefamce_Req data = new cmd_Entity_Property_Prefamce_Req();
                    data.uidReq = (uint)curUid;
                    IntPtrHelper helper = new IntPtrHelper();
                    IntPtr       ptr    = helper.toPtr <cmd_Entity_Property_Prefamce_Req>(ref data);
                    int          len    = Marshal.SizeOf(data);
                    GameLogicAPI.onEntityEvent(EntityFactory.MainHeroID, (int)EntityLogicDef.ENTITY_CMD_ENTITY_PROPERTY_DRAGONBALL, len, "", ptr, len);
                }
            }
        }
        string str_id          = "-";
        string str_name        = "-";
        string str_clientpos   = "-";
        string str_serverpos   = "-";
        string str_state       = "-";
        string Gravity         = "";
        string SyncVectory     = "";
        string SyncPosition    = "";
        string SkinID          = "";
        string strSkinInstance = "";
        string VisibleState    = "";
        string MaskValue       = "";
        string LayerName       = "";

        if (null != Debug_CurrentSelectEntity)
        {
            if (Debug_CurrentSelectEntity.StateMachine)
            {
                //打开请求服务器位置开关
                Debug_CurrentSelectEntity.StateMachine.requestServerPos = true;
                str_id = Debug_CurrentSelectEntity.ID.ToString();
                if (null != Debug_CurrentSelectEntity.Property)
                {
                    str_id += "[" + Debug_CurrentSelectEntity.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_ID).ToString() + "]";
                }
                str_name      = Debug_CurrentSelectEntity.Property.CreatureName;
                str_clientpos = Debug_CurrentSelectEntity.StateMachine.creature.position.ToString();
                str_state     = Debug_CurrentSelectEntity.StateMachine.GetState().ToString();
                str_serverpos = Debug_CurrentSelectEntity.StateMachine.ServerPos.ToString();
                CreatureStateMachine csm = Debug_CurrentSelectEntity.StateMachine as CreatureStateMachine;
                if (csm)
                {
                    SyncVectory  = csm.syncVelocity.ToString();
                    SyncPosition = csm.syncPosition.ToString();
                }

                Gravity         = Debug_CurrentSelectEntity.StateMachine.currentGravity.ToString();
                VisibleState    = "OnView:\n" + Debug_CurrentSelectEntity.StateMachine.m_OnViewVisible + "\n" + "MaskVisible:" + Debug_CurrentSelectEntity.StateMachine.m_MaskVisible;
                SkinID          = SkinID = Debug_CurrentSelectEntity.StateMachine.SkinControl.currentSkinId.ToString();
                strSkinInstance = "No SkinInstance";
                if (Debug_CurrentSelectEntity.StateMachine.SkinControl.CurrentSkinInstance != null)
                {
                    strSkinInstance = Debug_CurrentSelectEntity.StateMachine.SkinControl.CurrentSkinInstance.nSkinID.ToString();
                }

                MaskValue = Debug_CurrentSelectEntity.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_MASK).ToString();
                LayerName = LayerMask.LayerToName(Debug_CurrentSelectEntity.gameObject.layer);
            }
        }
        string EntityMessageText;

        EntityMessageText = EntityFormatText("实体调试信息:", " ") + EntityFormatText("ID:", str_id) + EntityFormatText("Name:", str_name) +
                            EntityFormatText("ClientPos:", str_clientpos) + EntityFormatText("ServerPos:", str_serverpos) + EntityFormatText("CurrentState:", str_state) +
                            EntityFormatText("攻击力:", str_pa) + EntityFormatText("生命值:", str_hp) + EntityFormatText("护甲值:", str_pd) +
                            EntityFormatText("魔抗值:", str_md) + EntityFormatText("重力速度:", Gravity) + EntityFormatText("SyncVectory:", SyncVectory) + EntityFormatText("SyncPosition:", SyncPosition) +
                            EntityFormatText("SkinID:", SkinID) + EntityFormatText("SkinInstance:", strSkinInstance) + EntityFormatText("VisibleState:", VisibleState) + EntityFormatText("MaskValue:", MaskValue)
                            + EntityFormatText("LayerName:", LayerName);

        DebugMessageTemplate(EPreframeArea.EPA_Entity, EntityMessageText, new Rect(_nScreenWidth - _nScreenWidth * 0.2f - 10, 10, _nScreenWidth * 0.2f, _nScreenHeight));
    }