//获得操作物品
        public ActionItem EnumItem(int nIndex)
        {
            //查询物品
            ActionItem luaItem;

            CActionItem pActionItem = CActionSystem.Instance.EnumAction(nIndex, ActionNameType.bankItem);

            if (pActionItem != null)
            {
                luaItem.actionItem = pActionItem;

                if (((CObject_Item)(pActionItem.GetImpl())).IsLocked())
                {
                    luaItem.isLock = true;
                }
                else
                {
                    luaItem.isLock = false;
                }
                return(luaItem);
            }

            //非法ActionItem
            luaItem.actionItem = null;
            luaItem.isLock     = false;

            return(luaItem);
        }
    public void Player_UseSkill(int idSkill)
    {
        CActionItem pAction = (CActionItem)CActionSystem.Instance.GetAction_SkillID(idSkill);

        if (pAction == null)
        {
            return;
        }

        //取得技能数据
        SCLIENT_SKILL pSkill = (SCLIENT_SKILL)pAction.GetImpl();

        if (pSkill == null)
        {
            return;
        }

        CAI_Base pMySelfAI = CObjectManager.Instance.getPlayerMySelf().CharacterLogic_GetAI();

        //发送消息
        SCommand_AI cmdTemp = new SCommand_AI();

        cmdTemp.m_wID = (int)AICommandDef.AIC_USE_SKILL;
        cmdTemp.SetValue(0, pSkill.m_pDefine.m_nID);
        cmdTemp.SetValue(1, pSkill.m_nLevel);
        cmdTemp.SetValue(2, MacroDefine.INVALID_ID);
        cmdTemp.SetValue(3, -1.0f);
        cmdTemp.SetValue(4, -1.0f);
        cmdTemp.SetValue(5, -1.0f);
        cmdTemp.SetValue(6, MacroDefine.INVALID_GUID);
        pMySelfAI.PushCommand(cmdTemp);

        //发送事件
        CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_ON_SKILL_ACTIVE, idSkill);
    }
    void UpdateEnchanseSelectedEquip()
    {
        ClearEnchanseSelected();
        if (mSelectedItem != null)
        {
            mEnchanseSelectedAction.SetActionItem(mSelectedItem.GetID());

            CObject_Item_Equip equip = mSelectedItem as CObject_Item_Equip;
            if (equip != null)
            {
                int gemCount = equip.GetGemCount();
                for (int i = 0; i < gemCount; i++)
                {
                    int nIdTable = equip.GetGemTableId(i);
                    if (nIdTable != 0)
                    {
                        CObject_Item gemItem = ObjectSystem.Instance.NewItem((uint)nIdTable);
                        CActionItem  action  = CActionSystem.Instance.GetAction_ItemID(gemItem.GetID(), false);
                        mEnchanseGemInfo[i].enchanseGem.SetActionItemByActionId(action.GetID());
                    }
                }
            }
        }
        UpdateEnchanseGemStates();
    }
    public CActionItem getAttackableSkill()
    {
        for (int i = shortCutTokenID_; i < MAX_SHORTCUT_COUNT; i++)
        {
            CActionItem curItem = mItems[i];
            if (isAttackableSkill(curItem))
            {
                shortCutTokenID_++;
                shortCutTokenID_ %= MAX_SHORTCUT_COUNT;
                return(curItem);
            }
        }

        for (int i = 0; i < shortCutTokenID_; i++)
        {
            CActionItem curItem = mItems[i];
            if (isAttackableSkill(curItem))
            {
                shortCutTokenID_  = i + 1;
                shortCutTokenID_ %= MAX_SHORTCUT_COUNT;
                return(curItem);
            }
        }
        return(null);
    }
Exemple #5
0
    public void UpdateItemFromAction(CActionItem action)
    {
        //断开和原来的Action的联系
        if (currActionItem != null && currActionItem != action)
        {
            currActionItem.RemoveRefrence(this);
        }

        currActionItem = action;

        if (currActionItem == null)
        {
            ClearAction();
            return;
        }

        //EnableDrag();

        //绑定逻辑和ui
        currActionItem.AddReference(this, false);

        SetIcon(currActionItem.GetIconName());

        // 更新cooldown [3/15/2012 Ivan]
        currActionItem.UpdateCoolDown();

        if (action.GetNum() > 1)
        {
            SetCornerChar(CORNER_NUMBER_POS.ANP_BOTRIGHT, action.GetNum().ToString());
        }
    }
    public CActionItem getSuitAbleSkill(CObject_Character target)
    {
        if (!canUseNextSkill_)
        {
            return(null);
        }

        for (int i = shortCutTokenID_; i < MAX_SHORTCUT_COUNT; i++)
        {
            CActionItem curItem = mItems[i];
            if (CanUseSkill(curItem, target))
            {
                shortCutTokenID_++;
                waitNextSkillTime_ = GameProcedure.s_pTimeSystem.GetTimeNow();
                shortCutTokenID_  %= MAX_SHORTCUT_COUNT;
                canUseNextSkill_   = false;
                return(curItem);
            }
        }

        for (int i = 0; i < shortCutTokenID_; i++)
        {
            CActionItem curItem = mItems[i];
            if (CanUseSkill(curItem, target))
            {
                waitNextSkillTime_ = GameProcedure.s_pTimeSystem.GetTimeNow();
                shortCutTokenID_   = i + 1;
                shortCutTokenID_  %= MAX_SHORTCUT_COUNT;
                canUseNextSkill_   = false;
                return(curItem);
            }
        }
        return(null);
    }
Exemple #7
0
    void RefreshPetSkill(int petIndex)
    {
        CActionItem curItem = CActionSystem.Instance.EnumPetAction(petIndex, 0);

        petSkill1_.UpdateItemFromAction(curItem);
        curItem = CActionSystem.Instance.EnumPetAction(petIndex, 1);
        petSkill2_.UpdateItemFromAction(curItem);
        curItem = CActionSystem.Instance.EnumPetAction(petIndex, 2);
        petSkill3_.UpdateItemFromAction(curItem);
        curItem = CActionSystem.Instance.EnumPetAction(petIndex, 3);
        petSkill4_.UpdateItemFromAction(curItem);
    }
Exemple #8
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="itemId">该ID对应objectSystem创建新物体NewItem时的ID</param>
    public void UpdateItem(int itemId)
    {
        CActionItem action = CActionSystem.Instance.GetActionByItemId(itemId);

//         if (action == null)
//         {
//             //LogManager.LogWarning("item is null,id:" + itemId);
//             ClearAction();
//             return;
//         }
        UpdateItemFromAction(action);
    }
Exemple #9
0
    void SetLocked(ActionButton actionBtn, CActionItem actionItem)
    {
        CObject_Item item = actionItem.GetImpl() as CObject_Item;

        if (item.isLocked)
        {
            actionBtn.Disable();
        }
        else
        {
            actionBtn.Enable();
        }
    }
Exemple #10
0
    private void ClearAction()
    {
        //断开和原来的Action的联系
        if (currActionItem != null)
        {
            currActionItem.RemoveRefrence(this);
        }
        currActionItem = null;
        ClearAllChar();
        SetIcon("");
        //DisableDrag();

        // 清空的时候关闭Tooltip [3/15/2012 Ivan]
        CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SUPERTOOLTIP, "0");
    }
Exemple #11
0
    //void Awake()
    //{
    //gameObject.SetActiveRecursively(true);


    //	EZScreenPlacement ScreenPlacement = gameObject.GetComponent<EZScreenPlacement>();
    //    if (ScreenPlacement != null)
    //ScreenPlacement.SetCamera(UISystem.Instance.UiCamrea);
    //		ScreenPlacement.RenderCamera = UISystem.Instance.UiCamrea;

    //     CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_NEW_ITEM, OnEvent);
    //CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_PACKAGE_ITEM_CHANGED, OnEvent);
    //     CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_HP,OnEvent);

    //     actionButton.AddInputDelegate(OnActionButtonClicked);

    //     gameObject.SetActiveRecursively(false);
    //  }

    void OnEvent(GAME_EVENT_ID gAME_EVENT_ID, List <string> vParam)
    {
        if (gAME_EVENT_ID == GAME_EVENT_ID.GE_NEW_ITEM)
        {
            int         id         = int.Parse(vParam[0]);
            CActionItem actionItem = CActionSystem.Instance.GetAction_ItemID(id, false);
            if (actionItem == null)
            {
                return;
            }

            actionId = actionItem.GetID();
            actionButton.SetActionItemByActionId(actionItem.GetID());

            CObject_Item item = actionItem.GetImpl() as CObject_Item;
            if (item != null)
            {
                titleText.Text = UIString.Instance.ParserString_Runtime("#{GET_NEW_ITEM}");
                descText.Text  = UIString.Instance.ParserString_Runtime("#{NEW_ITEM_DESC}");
            }
            UIWindowMng.Instance.ShowWindow("NewItemWindow");
        }
        //else if (gAME_EVENT_ID == GAME_EVENT_ID.GE_PACKAGE_ITEM_CHANGED)
        //{
        //CActionItem actionItem = CActionSystem.Instance.GetActionByActionId(actionId);
        //if (actionItem == null)
        // OnClose();
        // }
        else if (gAME_EVENT_ID == GAME_EVENT_ID.GE_UNIT_HP)
        {
            float hp = PlayerMySelf.Instance.GetHPPercent();
            if (hp <= 0.4)
            {
                CObject_Item item = CDataPool.Instance.GetMedicial();
                if (item != null)
                {
                    actionButton.UpdateItem(item.GetID());
                    titleText.Text = "血量剩余40%";
                    descText.Text  = UIString.Instance.ParserString_Runtime("#{NEW_ITEM_DESC}");
                    UIWindowMng.Instance.ShowWindow("NewItemWindow");
                }
            }
            else
            {
                OnClose();
            }
        }
    }
Exemple #12
0
    public void SetActionItemByActionId(int actionId)
    {
        if (actionId == -1)
        {
            ClearAction();
            return;
        }
        CActionItem action = CActionSystem.Instance.GetActionByActionId(actionId);

        if (action == null)
        {
            //LogManager.LogWarning("item is null,id:" + itemId);
            ClearAction();
            return;
        }
        UpdateItemFromAction(action);
    }
    void OnEvent(GAME_EVENT_ID eventid, List <string> vParam)
    {
        switch (eventid)
        {
        case GAME_EVENT_ID.GE_CHANGE_BAR:
        {
            for (int i = 0; i < MAX_SHORTCUT_COUNT; i++)
            {
                int actionID = CActionSystem.Instance.MainMenuBar_Get(i);
                mItems[i] = null;
                CActionItem pItem = CActionSystem.Instance.GetActionByActionId(actionID);
                if (pItem != null)
                {
                    switch (pItem.GetType())
                    {
                    case ACTION_OPTYPE.AOT_SKILL:
                    {
                        SCLIENT_SKILL pSkill = pItem.GetImpl() as SCLIENT_SKILL;
                        if (pSkill == null)
                        {
                            break;
                        }
                        mItems[i] = pItem;
                    }
                    break;

                    case ACTION_OPTYPE.AOT_PET_SKILL:
                    {
                        PET_SKILL pPetSkill = pItem.GetImpl() as PET_SKILL;
                        if (pPetSkill == null)
                        {
                            break;
                        }
                        mItems[i] = pItem;
                    }
                    break;
                    }
                }
            }
        }
        break;
        }
    }
    public void Player_UseSkill(int idSkill, float fDir)
    {
        //判断是否为合法的范围技能
        CActionItem pAction = (CActionItem)CActionSystem.Instance.GetAction_SkillID(idSkill);

        if (pAction != null)
        {
            return;
        }

        //取得技能数据
        SCLIENT_SKILL pSkill = (SCLIENT_SKILL)pAction.GetImpl();

        if (pSkill != null)
        {
            return;
        }


        //检测目标是否合法

        //	if(!(pSkill->IsValidTarget(idObj))) return;


        CAI_Base pMySelfAI = CharacterLogic_GetAI();

        //发送消息
        SCommand_AI cmdTemp = new SCommand_AI();

        cmdTemp.m_wID = (int)AICommandDef.AIC_USE_SKILL;
        cmdTemp.SetValue(0, pSkill.m_pDefine.m_nID);
        cmdTemp.SetValue(1, pSkill.m_nLevel);
        cmdTemp.SetValue(2, MacroDefine.INVALID_ID);
        cmdTemp.SetValue(3, -1.0f);
        cmdTemp.SetValue(4, -1.0f);
        cmdTemp.SetValue(5, fDir);
        cmdTemp.SetValue(6, -1.0f);
        cmdTemp.SetValue(7, MacroDefine.INVALID_GUID);
        pMySelfAI.PushCommand(cmdTemp);

        //发送事件
        CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_ON_SKILL_ACTIVE, idSkill);
    }
Exemple #15
0
        //    // 装备镶嵌消息 [9/16/2011 edit by ZL]
        //    void Send_EnchaseMsg(int type);
        //    // 返回装备上,总共有多少颗宝石。
        //    INT GetEquip_GemCount(INT nIndexEquip );
        //    // 返回装备上,总共可以镶嵌多少个宝石
        ////	INT GetEquip_GemCount( );
        //    // 返回宝石的级别。
        ////	INT Compound_Preparation(  );
        //    // 是否可以镶嵌
        //    INT	Can_Enchase( INT nIndexEquip, INT nIndexGem );
        //    // 是否可以合成
        //    bool Can_Combine( INT nIndexGem1, INT nIndexGem2 );
        //    // 物品可以放到镶嵌界面这个位置。
        //    bool Enchase_Preparation( INT nIndexInterface, INT nIndexPacket );
        //    // 物品可以放到合成界面这个位置。
        //    bool Compound_Preparation( INT nIndexPacket );
        //    //////////////////////////////////////////////////////////////////////////
        //    INT	Stiletto_GetEquipOwner();
        //    // 装备打孔检测,必须先将装备拖到目标位置上 [7/14/2011 ivan edit]
        //    Lua_SLOT_COST Stiletto_Preparation(INT nEquipIndex, INT equipOwner);
        //    // 装备打孔 [7/15/2011 ivan edit]
        //    INT	Do_Stilietto(int equipOwner = -1, int equipPos = -1);

        //    // 装备强化预览 [9/14/2011 edit by ZL]
        //    CActionItem*	GetStrengthenPreView(INT actionId);
        //    // 装备强化预览 [9/14/2011 edit by ZL]

        // 升档预览 [4/11/2012 SUN]
        public CActionItem      GetEquipUpdatePreView(int actionId)
        {
            CActionItem_Item action = CActionSystem.Instance.GetActionByActionId(actionId) as CActionItem_Item;

            if (action == null)
            {
                throw new NullReferenceException("Can not find actionitem: " + actionId);
            }
            CObject_Item_Equip equip = action.GetImpl() as CObject_Item_Equip;

            if (equip == null)
            {
                return(null);
            }

            CObject_Item_Equip resEquip = CDataPool.Instance.PreviewEquip;
            int nNextTableId            = equip.GetEquipBaseDefine().nNextDangCiItemSN;

            if (resEquip != null && resEquip.GetIdTable() != nNextTableId)
            {
                CDataPool.Instance.PreviewEquip = null;
            }

            resEquip = ObjectSystem.Instance.NewItem((uint)nNextTableId) as CObject_Item_Equip;
            resEquip.CloneForUpLevel(equip);

            resEquip.TypeOwner = ITEM_OWNER.IO_QUESTVIRTUALITEM;
            // 必须保存回去 [10/25/2011 Ivan edit]
            CDataPool.Instance.PreviewEquip = resEquip;

            CActionItem pActionItem = CActionSystem.Instance.GetAction_ItemID(resEquip.GetID(), false);

            if (pActionItem != null)
            {
                return(pActionItem);
            }
            else
            {
                return(CActionItem.s_InvalidAction);
            }
        }
 void UpdateEnchanseGemStates()
 {
     for (int i = 0; i < mEnchanseGemInfo.Length; i++)
     {
         if (mEnchanseGemInfo[i].bFlag == 2)
         {
             mEnchanseGemInfo[i].enchanseGem.SetMaskTexture("maskout");
         }
         else if (mEnchanseGemInfo[i].bFlag == 1)
         {
             //todo add
             if (mEnchanseGemInfo[i].nGemType != -1)
             {
                 CObject_Item gemItem    = CDataPool.Instance.UserBag_GetItemById(mEnchanseGemInfo[i].nGemType);
                 CObject_Item newGemItem = ObjectSystem.Instance.NewItem((uint)gemItem.GetIdTable());
                 CActionItem  action     = CActionSystem.Instance.GetAction_ItemID(newGemItem.GetID(), false);
                 mEnchanseGemInfo[i].enchanseGem.SetActionItemByActionId(action.GetID());
                 mEnchanseGemInfo[i].enchanseGem.SetMaskTexture("maskin");
             }
         }
     }
 }
Exemple #17
0
    public ActionButton yuPeiBtn;    //玉佩
    void Equip_RefreshEquip()
    {
        CActionItem weapon = CActionSystem.Instance.EnumAction(0, ActionNameType.Equip);

        if (weaponBtn != null)
        {
            if (weapon != null)
            {
                weaponBtn.UpdateItemFromAction(weapon);
                SetLocked(weaponBtn, weapon);
            }
            else
            {
                weaponBtn.SetActionItem(-1);
            }
        }
        CActionItem cap = CActionSystem.Instance.EnumAction(1, ActionNameType.Equip);

        if (capBtn != null)
        {
            if (cap != null)
            {
                capBtn.UpdateItemFromAction(cap);
                SetLocked(capBtn, cap);
            }
            else
            {
                capBtn.SetActionItem(-1);
            }
        }
        CActionItem armor = CActionSystem.Instance.EnumAction(2, ActionNameType.Equip);

        if (armorBtn != null)
        {
            if (armor != null)
            {
                armorBtn.UpdateItemFromAction(armor);
                SetLocked(armorBtn, armor);
            }
            else
            {
                armorBtn.SetActionItem(-1);
            }
        }
        CActionItem boot = CActionSystem.Instance.EnumAction(4, ActionNameType.Equip);

        if (bootBtn != null)
        {
            if (boot != null)
            {
                bootBtn.UpdateItemFromAction(boot);
                SetLocked(bootBtn, boot);
            }
            else
            {
                bootBtn.SetActionItem(-1);
            }
        }
        CActionItem shoulder = CActionSystem.Instance.EnumAction(15, ActionNameType.Equip);

        if (shoulderBtn != null)
        {
            if (shoulder != null)
            {
                shoulderBtn.UpdateItemFromAction(shoulder);
                SetLocked(shoulderBtn, shoulder);
            }
            else
            {
                shoulderBtn.SetActionItem(-1);
            }
        }
        CActionItem ring = CActionSystem.Instance.EnumAction(6, ActionNameType.Equip);

        if (ringBtn != null)
        {
            if (ring != null)
            {
                ringBtn.UpdateItemFromAction(ring);
                SetLocked(ringBtn, ring);
            }
            else
            {
                ringBtn.SetActionItem(-1);
            }
        }
        CActionItem necklace = CActionSystem.Instance.EnumAction(7, ActionNameType.Equip);

        if (necklaceBtn != null)
        {
            if (necklace != null)
            {
                necklaceBtn.UpdateItemFromAction(necklace);
                SetLocked(necklaceBtn, necklace);
            }
            else
            {
                necklaceBtn.SetActionItem(-1);
            }
        }
        CActionItem back = CActionSystem.Instance.EnumAction(5, ActionNameType.Equip);

        if (backBtn != null)
        {
            if (back != null)
            {
                backBtn.UpdateItemFromAction(back);
                SetLocked(backBtn, back);
            }
            else
            {
                backBtn.SetActionItem(-1);
            }
        }
        CActionItem yupei = CActionSystem.Instance.EnumAction(13, ActionNameType.Equip);

        if (yuPeiBtn != null)
        {
            if (yupei != null)
            {
                yuPeiBtn.UpdateItemFromAction(yupei);
                SetLocked(yuPeiBtn, yupei);
            }
            else
            {
                yuPeiBtn.SetActionItem(-1);
            }
        }
        CActionItem wrist = CActionSystem.Instance.EnumAction(3, ActionNameType.Equip);

        if (wristBtn != null)
        {
            if (wrist != null)
            {
                wristBtn.UpdateItemFromAction(wrist);
                SetLocked(wristBtn, wrist);
            }
            else
            {
                wristBtn.SetActionItem(-1);
            }
        }
    }
Exemple #18
0
    void UpdateItems(TabMode tab, byte pageindex)
    {
        if (tab == TabMode.TAB_BUY)
        {
            int nTotalNum = UIInfterface.Instance.GetActionNum(ActionNameType.boothItem);
            int maxPage   = nTotalNum / MAX_ITEM_PERPAGE + 1;
            if (nTotalNum % MAX_ITEM_PERPAGE != 0)
            {
                maxPage++;
            }

            if (pageIndex < 1 || pageIndex > maxPage)
            {
                return;
            }

            int nUnit = Interface.NPCShop.Instance.GetShopType("unit");

            int startIndex = (pageIndex - 1) * MAX_ITEM_PERPAGE;

            for (int i = 0; i < MAX_ITEM_PERPAGE; i++)
            {
                CActionItem action = CActionSystem.Instance.EnumAction(i + startIndex, ActionNameType.boothItem);
                if (action == null)
                {
                    continue;
                }
                if (itemList[i] != null)
                {
                    itemList[i].SetActionItemByActionId(action.GetID());
                }

                uint price = Interface.NPCShop.Instance.EnumItemPrice(i);
                if (nUnit == 1)
                {
                    itemPriceCopper[i].Text = price.ToString();
                }

                itemNames[i].Text = action.GetName();
            }

            if (pageIndex < maxPage)
            {
                nextPageBtn.controlIsEnabled = true;
            }
            if (pageIndex > 1)
            {
                prePageBtn.controlIsEnabled = true;
            }
        }
        else if (tab == TabMode.TAB_REDEEM)
        {
            int ntype = Interface.NPCShop.Instance.GetShopType("callback");
            if (ntype <= 0)
            {
                return;
            }
            int nNum  = Interface.NPCShop.Instance.GetCallBackNum();
            int nUnit = Interface.NPCShop.Instance.GetShopType("unit");

            int maxPage = nNum / MAX_ITEM_PERPAGE + 1;
            if (nNum % MAX_ITEM_PERPAGE != 0)
            {
                maxPage++;
            }

            if (pageIndex < 1 || pageIndex > maxPage)
            {
                return;
            }

            int startIndex = (pageIndex - 1) * MAX_ITEM_PERPAGE;
            for (int i = 0; i < MAX_ITEM_PERPAGE; i++)
            {
                CActionItem action = Interface.NPCShop.Instance.EnumCallBackItem(i + startIndex);
                if (action != null)
                {
                    if (itemList[i] != null)
                    {
                        itemList[i].SetActionItemByActionId(action.GetID());
                    }

                    uint price = Interface.NPCShop.Instance.EnumItemSoldPrice(i);
                    if (nUnit == 1)
                    {
                        itemPriceCopper[i].Text = price.ToString();
                    }

                    itemNames[i].Text = action.GetName();
                }
            }
            if (pageIndex < maxPage)
            {
                nextPageBtn.controlIsEnabled = true;
            }
            if (pageIndex > 1)
            {
                prePageBtn.controlIsEnabled = true;
            }
        }
    }
Exemple #19
0
    public void UpdateRef(int actionId)
    {
        CActionItem action = CActionSystem.Instance.GetActionByActionId(actionId);

        UpdateItemFromAction(action);
    }
 internal void SetActionItem(CActionItem action)
 {
     currAction = action;
 }
    bool isAttackableSkill(CActionItem item)
    {
        if (item == null)
        {
            return(false);
        }
        bool          result = false;
        SCLIENT_SKILL pSkill = item.GetImpl() as SCLIENT_SKILL;

        switch (item.GetType())
        {
        case ACTION_OPTYPE.AOT_SKILL:
        {
            if (pSkill == null)
            {
                break;
            }
            ENUM_SELECT_TYPE typeSel = (ENUM_SELECT_TYPE)pSkill.m_pDefine.m_nSelectType;
            switch (typeSel)
            {
            case ENUM_SELECT_TYPE.SELECT_TYPE_CHARACTER:
            case ENUM_SELECT_TYPE.SELECT_TYPE_DIR:
            case ENUM_SELECT_TYPE.SELECT_TYPE_POS:
            case ENUM_SELECT_TYPE.SELECT_TYPE_NONE:
                result = true;
                break;

            default:
                break;
            }
        }
        break;

        default:
            break;
        }

        if (result)
        {
            OPERATE_RESULT retVal = pSkill.IsCanUse_CheckCoolDown();
            if (retVal != OPERATE_RESULT.OR_OK)
            {
                return(false);
            }

            retVal = pSkill.IsCanUse_CheckPassive();
            if (retVal != OPERATE_RESULT.OR_OK)
            {
                return(false);
            }

            retVal = pSkill.IsCanUse_CheckLevel(CObjectManager.Instance.getPlayerMySelf().ID, pSkill.m_nLevel);
            if (retVal != OPERATE_RESULT.OR_OK)
            {
                return(false);
            }

            retVal = pSkill.IsCanUse_CheckFightState(CObjectManager.Instance.getPlayerMySelf().ID);
            if (retVal != OPERATE_RESULT.OR_OK)
            {
                return(false);
            }

            retVal = pSkill.IsCanUse_CheckDeplete(CObjectManager.Instance.getPlayerMySelf().ID);
            if (retVal != OPERATE_RESULT.OR_OK)
            {
                return(false);
            }

            retVal = pSkill.IsCanUse_Leaned();
            if (retVal != OPERATE_RESULT.OR_OK)
            {
                return(false);
            }
        }
        return(result);
    }
    /// <summary>
    /// 升档
    /// </summary>
    void UpdateShengDang()
    {
        ClearShengDangContext();
        mIsEnableSD = false;
        if (mSelectedItem != null)
        {
            mSDSelectedAction.SetActionItem(mSelectedItem.GetID());
            string text = mSelectedItem.GetWhiteAttribute(0);
            mSDSelectedAttriDesc.Text = UIString.Instance.ParserString_Runtime(text);
            text = mSelectedItem.GetWhiteAttribute(1);
            if (text == "")
            {
                mSDSelectedAttriDesc2.Hide(true);
            }
            else
            {
                mSDSelectedAttriDesc2.Hide(false);
                mSDSelectedAttriDesc2.Text = UIString.Instance.ParserString_Runtime(text);
            }


            CActionItem actionItem = LifeAbility.Instance.GetEquipUpdatePreView(mSDSelectedAction.CurrActionItem.GetID());
            if (actionItem != null)
            {
                mSDPreviewAction.SetActionItemByActionId(actionItem.GetID());

                CObject_Item previewItem = mSDPreviewAction.CurrActionItem.GetImpl() as CObject_Item;
                if (previewItem != null)
                {
                    text = previewItem.GetWhiteAttribute(0);
                    mSDPreviewAttriDesc.Text = UIString.Instance.ParserString_Runtime(text);
                    text = previewItem.GetWhiteAttribute(1);
                    if (text == "")
                    {
                        mSDPreviewAttriDesc2.Hide(true);
                    }
                    else
                    {
                        mSDPreviewAttriDesc2.Text = UIString.Instance.ParserString_Runtime(text);
                        mSDPreviewAttriDesc2.Hide(false);
                    }
                }
            }

            int nPrescrId = LifeAbility.Instance.GetPrescrID(mSelectedItem.GetIdTable());
            if (nPrescrId == -1)
            {
                NoPrescrHandler(mSelectedItem.GetIdTable());
                mSDOK.controlIsEnabled = false;
                return;
            }
            NoPrescrHandler(-1);
            //材料
            int nCount = LifeAbility.Instance.GetPrescrStuffCount(nPrescrId);
            //int nMaterial = -1;
            for (int i = 1; i < nCount; i++) //第一个材料为当前装备,跳过不显示
            {
                Stuff stuff = LifeAbility.Instance.GetPrescrStuff(i, nPrescrId);
                if (stuff.nID == -1)
                {
                    mSDMaterials[i - 1].SetActionItem(-1);
                    mSDMaterialTexts[i - 1].Text = "";
                    continue;
                }
                bool bCreateNew = true;
                if (mSDMaterials[i - 1].CurrActionItem != null)
                {
                    if (mSDMaterials[i - 1].CurrActionItem.GetIDTable() == stuff.nID)
                    {
                        bCreateNew = false;
                    }
                    else
                    {
                        mSDMaterials[i - 1].CurrActionItem.DestroyImpl();
                    }
                }
                if (bCreateNew)
                {
                    CObject_Item     pItemObj1   = ObjectSystem.Instance.NewItem((uint)stuff.nID);
                    CActionItem_Item actionItem1 = CActionSystem.Instance.GetAction_ItemID(pItemObj1.GetID(), false);

                    mSDMaterials[i - 1].SetActionItemByActionId(actionItem1.GetID());
                }

                int count = CDataPool.Instance.UserBag_CountItemByIDTable(stuff.nID);
                if (count >= stuff.nNum)
                {
                    count       = stuff.nNum;
                    mIsEnableSD = true;
                }
                else
                {
                    mIsEnableSD = false;
                }
                mSDMaterialTexts[i - 1].Text = count + "/" + stuff.nNum;
            }

            mSDOK.controlIsEnabled = mIsEnableSD;
        }
    }
    bool CanUseSkill(CActionItem skillItem, CObject_Character target)
    {
        if (skillItem == null)
        {
            return(false);
        }
        if (target == null)
        {
            return(false);
        }
        if (target.IsDie())
        {
            return(false);
        }
        switch (skillItem.GetType())
        {
        case ACTION_OPTYPE.AOT_SKILL:
        {
            SCLIENT_SKILL pSkill = skillItem.GetImpl() as SCLIENT_SKILL;
            if (pSkill == null)
            {
                break;
            }

            Vector3 avatarPos        = CObjectManager.Instance.getPlayerMySelf().GetPosition();
            Vector3 avatarPosOnPlane = new Vector3(avatarPos.x, 0, avatarPos.z);
            Vector3 targetPos        = new Vector3(-1, 0, -1);
            int     ServerID         = -1;
            targetPos = new Vector3(target.GetPosition().x, 0, target.GetPosition().z);
            ServerID  = target.ServerID;
            Vector3        PosOnPlane = new Vector3(targetPos.x, 0, targetPos.z);
            float          dir        = Vector3.Angle(avatarPosOnPlane, PosOnPlane);
            OPERATE_RESULT result     = pSkill.IsCanUse(CObjectManager.Instance.getPlayerMySelf().ID,
                                                        pSkill.m_nLevel,
                                                        ServerID,
                                                        targetPos.x,
                                                        targetPos.z,
                                                        dir);

            if (result == OPERATE_RESULT.OR_OK)
            {
                return(true);
            }
        }
        break;

        case ACTION_OPTYPE.AOT_PET_SKILL:
        {
            PET_SKILL pPetSkill = skillItem.GetImpl() as PET_SKILL;
            if (pPetSkill == null)
            {
                break;
            }
            if (Interface.Pet.Instance.IsFighting(pPetSkill.m_nPetNum))
            {
                return(true);
            }
        }
        break;
        }
        return(false);
    }