Exemplo n.º 1
0
    public sdGameItem Clone()
    {
        sdGameItem item = new sdGameItem();

        item.templateID     = templateID;
        item.instanceID     = instanceID;
        item.mdlPath        = mdlPath;
        item.mdlPartName    = mdlPartName;
        item.anchorNodeName = anchorNodeName;
        item.equipPos       = equipPos;
        item.bagIndex       = bagIndex;
        item.count          = count;
        item.itemClass      = itemClass;
        item.subClass       = subClass;
        item.quility        = quility;
        item.level          = level;
        item.upExp          = upExp;
        item.upLevel        = upLevel;
        item.gemNum         = gemNum;
        item.gemList        = gemList;
        item.equiped        = equiped;
        item.newFlag        = newFlag;
        item.suitId         = suitId;
        item.isLock         = isLock;
        item.score          = score;
        item.isFormulaItem  = isFormulaItem;
        return(item);
    }
Exemplo n.º 2
0
    void Update()
    {
        if (needUpdate && jobBack != null && sdConfDataMgr.Instance().jobAtlas != null)
        {
            jobBack.GetComponent <UISprite>().atlas      = sdConfDataMgr.Instance().jobAtlas;
            jobBack.GetComponent <UISprite>().spriteName = sdConfDataMgr.Instance().GetJobBack(sdGameLevel.instance.mainChar.Property["Job"].ToString());
            needUpdate = false;
        }

        if (equipBtn != null)
        {
            if (sdSlotMgr.Instance.selectedItem.Count == 1)
            {
                sdSlotIcon icon = sdSlotMgr.Instance.selectedItem[0];
                sdGameItem item = sdGameItemMgr.Instance.getItem(ulong.Parse(icon.itemid));
                if (item != null && item.CanEquip(sdGameLevel.instance.mainChar))
                {
                    ;
                }
                {
                    equipBtn.GetComponent <UIButton>().enabled = true;
                }
            }
            else
            {
                equipBtn.GetComponent <UIButton>().enabled = false;
            }
        }
    }
Exemplo n.º 3
0
    public Hashtable GetAllItem(int bagIndex, int itemFilter)
    {
        Hashtable table = new Hashtable();

        foreach (DictionaryEntry item in itemDB)
        {
            sdGameItem info = (sdGameItem)item.Value;
            if (info.bagIndex == bagIndex)
            {
                if (itemFilter == (int)ItemFilter.All)
                {
                    table[item.Key] = info;
                }
                else if (itemFilter == (int)ItemFilter.Other)
                {
                    if (info.itemClass != 0 && info.itemClass != 1 && info.itemClass != 2)
                    {
                        table[item.Key] = info;
                    }
                }
                else if (itemFilter == info.itemClass)
                {
                    table[item.Key] = info;
                }
            }
        }

        return(table);
    }
Exemplo n.º 4
0
    // 穿上默认装备aa
    public bool takeOnNake(sdGameActor_Impl kActor)
    {
        if (mdlPartName.Length > 0)
        {
            kActor.changeAvatar(mdlPath, mdlPartName, anchorNodeName);
        }

        foreach (DictionaryEntry entry in kActor.itemInfo)
        {
            sdGameItem item = entry.Value as sdGameItem;
            if (item.equipPos == equipPos)
            {
                item.equiped = false;
                kActor.itemInfo.Remove(item.instanceID);
                break;
            }
        }

        // 主角需要保存属性信息aa
        if (sdGameLevel.instance != null && kActor == sdGameLevel.instance.mainChar)
        {
            sdGameLevel.instance.storeLevelInfo();
        }

        return(true);
    }
Exemplo n.º 5
0
    void Update()
    {
        if (selectType == SelectType.ItemSell)
        {
            int       price    = 0;
            Hashtable iconList = sdSlotMgr.Instance.GetIconList(PanelType.Panel_ItemSelect);
            foreach (DictionaryEntry info in iconList)
            {
                sdSlotIcon icon = info.Value as sdSlotIcon;
                if (icon.isActiveAndEnabled && icon.isSelected)
                {
                    sdGameItem item = sdGameItemMgr.Instance.getItem(ulong.Parse(icon.itemid));
                    if (item == null)
                    {
                        continue;
                    }
                    Hashtable table = sdConfDataMgr.Instance().GetItemById(item.templateID.ToString());
                    if (table == null)
                    {
                        continue;
                    }
                    price += (int.Parse(table["Value"].ToString()) * item.count);
                }
            }

            moneyNum.text = price.ToString();
        }
    }
Exemplo n.º 6
0
    public bool init(bool testMode)
    {
        if (testMode)
        {
            Hashtable itemInfo = new Hashtable();
            globalData["MainCharItemInfo"] = itemInfo;

            sdGameItem item = null;
            item = sdGameItemMgr.Instance.getItem(1000 + sdGameItemMgr.testIndex);
            itemInfo[item.instanceID] = item;

            item = sdGameItemMgr.Instance.getItem(1001 + sdGameItemMgr.testIndex);
            itemInfo[item.instanceID] = item;

            item = sdGameItemMgr.Instance.getItem(1002 + sdGameItemMgr.testIndex);
            itemInfo[item.instanceID] = item;

            item = sdGameItemMgr.Instance.getItem(1003 + sdGameItemMgr.testIndex);
            itemInfo[item.instanceID] = item;

            item = sdGameItemMgr.Instance.getItem(1005 + sdGameItemMgr.testIndex);
            itemInfo[item.instanceID] = item;

            item = sdGameItemMgr.Instance.getItem(1006 + sdGameItemMgr.testIndex);
            itemInfo[item.instanceID] = item;
        }

        return(true);
    }
Exemplo n.º 7
0
    public void MoveItem(int fromPanel, int toPanel, UInt64 uuId, UInt64 uuOtherId)
    {
        sdMainChar mc = sdGameLevel.instance.mainChar;

        sdGameItem itemFrom = getItem(uuId);
        sdGameItem itemTo   = getItem(uuOtherId);

        if (itemFrom != null)
        {
            itemFrom.bagIndex = toPanel;
            if (toPanel == 0)
            {
                itemDB.Remove(uuId);
            }
        }
        if (itemTo != null)
        {
            itemTo.bagIndex = fromPanel;
        }

        if (fromPanel == (int)PanelType.Panel_Bag)
        {
            //从背包穿装备..
            if (toPanel == (int)PanelType.Panel_Equip)
            {
                if (itemTo != null)
                {
                    itemTo.takeOff(mc);
                }
                if (itemFrom != null)
                {
                    itemFrom.takeOn(mc);
                }
            }
            //出售装备..
            else if (toPanel == 0)
            {
            }
        }
        else if (fromPanel == (int)PanelType.Panel_Equip)
        {
            if (itemFrom != null)
            {
                itemFrom.takeOff(mc);
            }
            Hashtable  info  = sdConfDataMgr.Instance().GetItemById(itemFrom.templateID.ToString());
            sdGameItem dummy = mc.getStartItem(int.Parse(info["Character"].ToString()));
            if (dummy != null)
            {
                dummy.takeOnNake(mc);
            }
        }

        int type = 0;

        type |= fromPanel;
        type |= toPanel;
        sdSlotMgr.Instance.Notify(type);
    }
Exemplo n.º 8
0
    void OnUnActiveOtherBtn()
    {
        Hashtable itemTable = sdGameItemMgr.Instance.GetAllItem((int)PanelType.Panel_Bag, (int)ItemFilter.Other);

        foreach (DictionaryEntry info in itemTable)
        {
            sdGameItem temp = info.Value as sdGameItem;
            temp.isNew = false;
        }
        otherBtn.HideRedTip();
    }
Exemplo n.º 9
0
 // 从装备属性表初始化装备aa
 public void SetItemInfo(Hashtable table)
 {
     if (table != null)
     {
         foreach (DictionaryEntry entry in table)
         {
             UInt64     itemID = UInt64.Parse(entry.Key.ToString());
             sdGameItem item   = entry.Value as sdGameItem;
             item.takeOn(this);
         }
     }
 }
Exemplo n.º 10
0
 public sdGameItem getEquipItemByPos(int pos)
 {
     foreach (DictionaryEntry item in itemDB)
     {
         sdGameItem info = (sdGameItem)item.Value;
         if (info.equipPos == pos && info.bagIndex == (int)PanelType.Panel_Equip)
         {
             return(info);
         }
     }
     return(null);
 }
Exemplo n.º 11
0
 public UInt64 getItemUIDByTID(int iTid)
 {
     foreach (DictionaryEntry info in itemDB)
     {
         sdGameItem item = info.Value as sdGameItem;
         if (item != null && item.templateID == iTid)
         {
             return(item.instanceID);
         }
     }
     return(UInt64.MaxValue);
 }
Exemplo n.º 12
0
 public bool hasItem(string tid)
 {
     foreach (DictionaryEntry info in itemDB)
     {
         sdGameItem item = info.Value as sdGameItem;
         if (item != null && item.templateID.ToString() == tid)
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 13
0
    public void Clear()
    {
        itemDB.Clear();

        upItem = null;
        itemUpList.Clear();

        suitInfo.Clear();

        selGemList.Clear();
        gemIndex    = -1;
        createGemId = 0;
    }
Exemplo n.º 14
0
    void    TakeOnDefaultHair()
    {
        sdGameItem kHairItem = getStartItem(1);

        if (kHairItem != null && !itemInfo.Contains(kHairItem.templateID))
        {
            //itemInfo[kHairItem.templateID] = kHairItem;
            if (kHairItem.mdlPartName.Length > 0)
            {
                changeAvatar(kHairItem.mdlPath, kHairItem.mdlPartName, kHairItem.anchorNodeName);
                isChangeFace = true;
            }
        }
    }
Exemplo n.º 15
0
    public int GetItemCount(int id)
    {
        int nCount = 0;

        foreach (DictionaryEntry info in itemDB)
        {
            sdGameItem item = info.Value as sdGameItem;
            if (item != null && item.templateID == id)
            {
                nCount += item.count;
            }
        }
        return(nCount);
    }
Exemplo n.º 16
0
    // 穿上装备aa
    public bool takeOn(sdGameActor_Impl kActor)
    {
        Hashtable info = sdConfDataMgr.Instance().GetItemById(templateID.ToString());

        if (info != null)
        {
            string obj = info["NeedJob"].ToString();
            int    job = 0;         //int.Parse(.ToString());
            if (obj != "")
            {
                job = int.Parse(obj);
            }
            int current = (int)kActor.GetJob();
            if (job != 0)
            {
                if ((job & (1 << current)) == 0)
                {
                    return(false);
                }
            }
        }

        //
        if (mdlPartName.Length > 0)
        {
            kActor.changeAvatar(mdlPath, mdlPartName, anchorNodeName);
        }

        foreach (DictionaryEntry entry in kActor.itemInfo)
        {
            sdGameItem item = entry.Value as sdGameItem;
            if (item.equipPos == equipPos)
            {
                item.equiped = false;
                kActor.itemInfo.Remove(item.instanceID);
                break;
            }
        }
        kActor.itemInfo[instanceID] = this;
        //equiped = true;

        // 主角需要保存属性信息aa
        if (sdGameLevel.instance != null && kActor == sdGameLevel.instance.mainChar)
        {
            sdGameLevel.instance.storeLevelInfo();
        }

        return(true);
    }
Exemplo n.º 17
0
    public List <sdGameItem> GetAllFormulaItems()
    {
        List <sdGameItem> table = new List <sdGameItem>();

        foreach (DictionaryEntry item in itemDB)
        {
            sdGameItem info = (sdGameItem)item.Value;
            if (info.isFormulaItem)
            {
                table.Add(info);
            }
        }

        return(table);
    }
Exemplo n.º 18
0
    public List <sdGameItem> GetAllEquipItems()
    {
        List <sdGameItem> table = new List <sdGameItem>();

        foreach (DictionaryEntry item in itemDB)
        {
            sdGameItem info = (sdGameItem)item.Value;
            if (info.itemClass == 0 || info.itemClass == 1 || info.itemClass == 2)
            {
                table.Add(info);
            }
        }

        return(table);
    }
Exemplo n.º 19
0
    static int OnSortScore(sdGameItem item, sdGameItem compare)
    {
        int score1 = sdConfDataMgr.Instance().GetItemScore(item.instanceID);
        int score2 = sdConfDataMgr.Instance().GetItemScore(compare.instanceID);

        if (score1 > score2)
        {
            return(1);
        }
        else if (score1 < score2)
        {
            return(-1);
        }
        return(0);
    }
Exemplo n.º 20
0
 static int CompareItem(sdGameItem item, sdGameItem compare)
 {
     if (compare.quility < item.quility)
     {
         return(-1);
     }
     else if (compare.quility > item.quility)
     {
         return(1);
     }
     else
     {
         if (compare.itemClass > item.itemClass)
         {
             return(-1);
         }
         else if (compare.itemClass < item.itemClass)
         {
             return(1);
         }
         else
         {
             if (compare.subClass > item.subClass)
             {
                 return(-1);
             }
             else if (compare.subClass < item.subClass)
             {
                 return(1);
             }
             else
             {
                 if (compare.level < item.level)
                 {
                     return(-1);
                 }
                 else if (compare.level > item.level)
                 {
                     return(1);
                 }
                 else
                 {
                     return(0);
                 }
             }
         }
     }
 }
Exemplo n.º 21
0
    private static void msg_SCID_ROLE_BAG_SINGLE_ENTER_NTF(int iMsgID, ref CMessage msg)
    {
        CliProto.SC_ROLE_BAG_SINGLE_ENTER_NTF refMsg = (CliProto.SC_ROLE_BAG_SINGLE_ENTER_NTF)msg;
        bool       isExist = sdGameItemMgr.Instance.getItem(refMsg.m_Item.m_UID) == null ? false : true;
        sdGameItem item    = sdGameItemMgr.Instance.createItem(refMsg.m_Item, (int)PanelType.Panel_Bag);

        if (refMsg.m_EnterType == (int)HeaderProto.EItemEnterType.ITEM_ENTER_TYPE_DEFAULT && !isExist)
        {
            item.isNew = true;
            sdNewInfoMgr.Instance.CreateNewInfo(NewInfoType.Type_Item);
        }
        sdSlotMgr.Instance.Notify((int)PanelType.Panel_Bag);
        sdSlotMgr.Instance.selectedItem.Clear();
        sdUICharacter.Instance.RefreshTip();
        sdUICharacter.Instance.UpdateBagNum();
    }
Exemplo n.º 22
0
    public void SetInfo(ulong id)
    {
        itemId = id;
        sdGameItem item = sdGameItemMgr.Instance.getItem(id);

        if (item == null)
        {
            return;
        }
        Hashtable info = sdConfDataMgr.Instance().GetItemById(item.templateID.ToString());

        bg.spriteName   = "IconFrame0";
        icon.spriteName = info["IconPath"].ToString();
        sdConfDataMgr.Instance().LoadItemAtlas(info["IconID"].ToString(), OnSetAtlas);
        color.spriteName = sdConfDataMgr.Instance().GetItemQuilityBorder(int.Parse(info["Quility"].ToString()));;
    }
Exemplo n.º 23
0
    static int OnSortEquiped(sdGameItem item, sdGameItem compare)
    {
        sdGameItem equip = sdGameItemMgr.Instance.getEquipItemByPos(item.equipPos);

        if (equip == item)
        {
            return(-1);
        }

        if (equip == compare)
        {
            return(1);
        }

        return(0);
    }
Exemplo n.º 24
0
    public List <sdGameItem> GetGemInBag(int gemLevel)
    {
        List <sdGameItem> table = new List <sdGameItem>();

        foreach (DictionaryEntry item in itemDB)
        {
            sdGameItem info = (sdGameItem)item.Value;
            if (info.bagIndex == (int)PanelType.Panel_Bag && info.itemClass == 51 &&
                info.subClass == 1 && (gemLevel == 0 || gemLevel == info.level))
            {
                table.Add(info.Clone());
            }
        }

        return(table);
    }
Exemplo n.º 25
0
    public List <sdGameItem> GetBagItemByEquipPos(int pos, bool needCanEquip)
    {
        List <sdGameItem> table = new List <sdGameItem>();

        foreach (DictionaryEntry item in itemDB)
        {
            sdGameItem info = (sdGameItem)item.Value;
            if (info.bagIndex == (int)PanelType.Panel_Bag && info.equipPos == pos)
            {
                if (!needCanEquip || info.CanEquip(sdGameLevel.instance.mainChar))
                {
                    table.Add(info);
                }
            }
        }
        return(table);
    }
Exemplo n.º 26
0
    public List <sdGameItem> GetItemByQuility(int quility, bool isLock)
    {
        List <sdGameItem> table = new List <sdGameItem>();

        foreach (DictionaryEntry item in itemDB)
        {
            sdGameItem info = (sdGameItem)item.Value;
            if (info.bagIndex == (int)PanelType.Panel_Bag && (quility & (1 << info.quility)) > 0)
            {
                if (info.isLock != isLock)
                {
                    continue;
                }
                table.Add(info);
            }
        }
        return(table);
    }
Exemplo n.º 27
0
    // 获取角色初始装备aa
    public sdGameItem getStartItem(int equipPos)
    {
        if (mNakeItemTable == null)
        {
            return(null);
        }

        foreach (DictionaryEntry kItem in mNakeItemTable)
        {
            sdGameItem kGameItem = (sdGameItem)kItem.Value;
            if (kGameItem.equipPos == equipPos)
            {
                return(kGameItem);
            }
        }

        return(null);
    }
Exemplo n.º 28
0
    public bool HasItemCount(int id, int nNeedCount)
    {
        int nTmpCount = 0;

        foreach (DictionaryEntry info in itemDB)
        {
            sdGameItem item = info.Value as sdGameItem;
            if (item != null && item.templateID == id)
            {
                nTmpCount += item.count;
                if (nTmpCount >= nNeedCount)
                {
                    return(true);
                }
            }
        }

        return(false);
    }
Exemplo n.º 29
0
    public List <sdGameItem> GetEquipItemsInBag(bool ignoreLock)
    {
        List <sdGameItem> table = new List <sdGameItem>();

        foreach (DictionaryEntry item in itemDB)
        {
            sdGameItem info = (sdGameItem)item.Value;
            if (info.bagIndex == (int)PanelType.Panel_Bag && (info.itemClass == 0 || info.itemClass == 1 || info.itemClass == 2))
            {
                if (!ignoreLock && info.isLock)
                {
                    continue;
                }
                table.Add(info);
            }
        }

        return(table);
    }
Exemplo n.º 30
0
    public void RemoveItem(UInt64 uuId)
    {
        sdGameItem item = getItem(uuId);

        if (item.bagIndex == (int)PanelType.Panel_Equip)
        {
            sdMainChar mc = sdGameLevel.instance.mainChar;
            if (mc != null)
            {
                item.takeOff(mc);
                Hashtable  info  = sdConfDataMgr.Instance().GetItemById(item.templateID.ToString());
                sdGameItem dummy = mc.getStartItem(int.Parse(info["Character"].ToString()));
                if (dummy != null)
                {
                    dummy.takeOnNake(mc);
                }
            }
        }
        itemDB.Remove(uuId);
    }