Пример #1
0
 public void RegisterSlot(sdSlotIcon slotIcon)
 {
     if (slotIcon == null)
     {
         return;
     }
     if (m_PanelList.ContainsKey(slotIcon.panel) && m_PanelList[slotIcon.panel] != null)
     {
         if (slotIcon.panel == PanelType.Panel_Bag && m_PanelList[PanelType.Panel_Bag].Count == 0)
         {
             copyItem = slotIcon.gameObject;
             //copyItem.SetActive(false);
         }
         if (!m_PanelList[slotIcon.panel].ContainsKey(slotIcon.index))
         {
             m_PanelList[slotIcon.panel].Add(slotIcon.index, slotIcon);
         }
     }
     else
     {
         Hashtable table = new Hashtable();
         table.Add(slotIcon.index, slotIcon);
         m_PanelList.Add(slotIcon.panel, table);
         if (slotIcon.panel == PanelType.Panel_Bag)
         {
             copyItem = slotIcon.gameObject;
             //copyItem.SetActive(false);
         }
     }
 }
Пример #2
0
    void Awake()
    {
        GameObject root = GameObject.Find("$PTWnd(Clone)");

        m_times = root.transform.FindChild("Label_times").GetComponent <UILabel>();
        sdPTManager.Instance.RefreshPT += Refresh;
        Hashtable ptTable = sdConfDataMgr.Instance().GetTable("dmdsxactivitytemplateconfig.pttemplates");

        for (int index = 1; index < 4; ++index)
        {
            if (ptTable.ContainsKey(index.ToString()))
            {
                Hashtable table  = ptTable[index.ToString()] as Hashtable;
                Transform child  = root.transform.FindChild("Sprite_level" + index.ToString());
                UISprite  btn_bg = child.FindChild("Button_PT_enter" + index.ToString()).FindChild("Background").GetComponent <UISprite>();
                btn_bg.spriteName = sdPTManager.Instance.m_PassLevel + 1 >= index ? "btn" : "btn_dis";

                UILabel lb_costliti = child.FindChild("Sprite_info").FindChild("Label_tili").GetComponent <UILabel>();
                lb_costliti.text = table["Tili"].ToString();
                UILabel lb_needlevel = child.FindChild("Sprite_info").FindChild("Label_level").GetComponent <UILabel>();
                lb_needlevel.text = table["RecLvl"].ToString();
                int level = int.Parse(table["LevelID"].ToString());
                for (int i = 0; i < sdLevelInfo.levelInfos.Length; ++i)
                {
                    if (sdLevelInfo.levelInfos[i].levelID == level)
                    {
                        string[] strItems = ((string)sdLevelInfo.levelInfos[i].levelProp["Drop"]).Split(';');
                        int      j        = 0;
                        for (; j < strItems.Length && j < 3; ++j)
                        {
                            Transform sprite_info = child.FindChild("Sprite_info");
                            sprite_info.transform.FindChild("Sprite_reward" + j).gameObject.SetActive(true);
                            sdSlotIcon sloticon = sprite_info.FindChild("Sprite_reward" + j.ToString()).GetComponent <sdSlotIcon>();
                            Hashtable  iteminfo = sdConfDataMgr.Instance().GetItemById(strItems[j].ToString());
                            if (iteminfo == null)
                            {
                                sprite_info.transform.FindChild("Sprite_reward" + j).gameObject.SetActive(false);
                                break;
                            }

                            UISprite sprite_item = sprite_info.transform.FindChild("Sprite_reward" + j).GetComponent <UISprite>();
                            sprite_item.atlas      = sdConfDataMgr.Instance().commonAtlas;
                            sprite_item.spriteName = "IconFrame0";
                            sloticon.SetInfo(strItems[j].ToString(), iteminfo);

                            UISprite sprite_quality = sprite_info.transform.FindChild("Sprite_reward" + j).FindChild("Sprite").GetComponent <UISprite>();
                            sprite_quality.atlas      = sdConfDataMgr.Instance().commonAtlas;
                            sprite_quality.spriteName = sdConfDataMgr.Instance().GetItemQuilityBorder(int.Parse(iteminfo["Quility"].ToString()));
                        }
                        for (; j < 3; ++j)
                        {
                            Transform sprite_info = child.FindChild("Sprite_info");
                            sprite_info.transform.FindChild("Sprite_reward" + j).gameObject.SetActive(false);
                        }
                        break;
                    }
                }
            }
        }
    }
Пример #3
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;
            }
        }
    }
Пример #4
0
    void OnOK()
    {
        if (selectType == SelectType.ItemSell)
        {
            bool      hasSelect = false;
            Hashtable iconList  = sdSlotMgr.Instance.GetIconList(PanelType.Panel_ItemSelect);
            foreach (DictionaryEntry info in iconList)
            {
                sdSlotIcon icon = info.Value as sdSlotIcon;
                if (icon.gameObject.active && icon.isSelected)
                {
                    hasSelect = true;
                    break;
                }
            }

            if (!hasSelect)
            {
                sdUICharacter.Instance.HideSelectWnd();
                return;
            }
            sdUICharacter.Instance.ShowOkCanelMsg(sdConfDataMgr.Instance().GetShowStr("SellMsg"), new sdMsgBox.OnConfirm(OnSell), null);
        }
        else
        {
            if (onClick.Count > 0)
            {
                EventDelegate.Execute(onClick);
            }
            sdUICharacter.Instance.HideSelectWnd();
        }
    }
Пример #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();
        }
    }
Пример #6
0
 public void RemoveSlot(sdSlotIcon icon)
 {
     if (icon == null)
     {
         return;
     }
     if (m_PanelList.ContainsKey(icon.panel) && m_PanelList[icon.panel] != null)
     {
         m_PanelList[icon.panel].Remove(icon.index);
     }
 }
Пример #7
0
 private int CompareSlotIcon(sdSlotIcon icon1, sdSlotIcon icon2)
 {
     if (icon1.index > icon2.index)
     {
         return(1);
     }
     if (icon1.index == icon2.index)
     {
         return(0);
     }
     return(-1);
 }
Пример #8
0
    void OnCopy()
    {
//      copyItem = GameObject.Instantiate(tempItem) as GameObject;
//      if (copyItem.GetComponent<sdSlotIcon>() !=  null)
//      {
//          copyItem.GetComponent<sdSlotIcon>().index = -1;
//      }
//      copyItem.transform.parent = targetBtn.gameObject.transform.parent;
//      copyItem.AddComponent<sdCopyItem>();
//         if (copyItem.GetComponent<sdShortCutIcon>() != null || copyItem.GetComponentInChildren<sdShortCutIcon>() != null)
//      {
//          copyItem.transform.localScale = new Vector3(1.2f,1.2f,1.2f);
//      }
//      else
//      {
//          copyItem.transform.localScale = new Vector3(1f,1f,1f);
//      }
//
//      copyItem.transform.position = tempItem.transform.position;
        sdSlotIcon icon = tempItem.GetComponent <sdSlotIcon>();

        if (icon != null && icon.panel == PanelType.Panel_Bag)
        {
            Transform pic = tempItem.transform.FindChild("icon");
            if (pic != null)
            {
                targetBtn.transform.position = pic.position;
            }
        }
        else
        {
            targetBtn.transform.position = tempItem.transform.position;
        }

        if (tempItem.GetComponent <BoxCollider>() == null)
        {
            targetBtn.GetComponent <BoxCollider>().size = new Vector3(2000, 2000, 1);
        }
        else
        {
            targetBtn.GetComponent <BoxCollider>().size = tempItem.GetComponent <BoxCollider>().size;
        }

        gameObject.SetActive(true);
    }
Пример #9
0
    void RefreshItem(SelectType selType, int SortType)
    {
        selectType = selType;
        if (copyItem != null)
        {
            copyItem.SetActive(false);
            UIDraggablePanel panel = copyItem.transform.parent.GetComponent <UIDraggablePanel>();
            if (panel != null)
            {
                panel.ResetPosition();
            }

            if (selType == SelectType.ItemUp)
            {
                itemTable = sdGameItemMgr.Instance.GetEquipItemsInBag(false);
                if (sdGameItemMgr.Instance.upItem != null)
                {
                    itemTable.Remove(sdGameItemMgr.Instance.upItem);
                }
                ShowBtnPanel(true);
            }
            else if (selectType == SelectType.ItemUpChange)
            {
                itemTable = sdGameItemMgr.Instance.GetAllEquipItems();
                if (sdGameItemMgr.Instance.upItem != null)
                {
                    itemTable.Remove(sdGameItemMgr.Instance.upItem);
                }
                ShowBtnPanel(false);
            }
            else if (selectType == SelectType.ItemMake)
            {
                itemTable = sdGameItemMgr.Instance.GetAllFormulaItems();
                if (sdGameItemMgr.Instance.upItem != null)
                {
                    itemTable.Remove(sdGameItemMgr.Instance.upItem);
                }
                ShowBtnPanel(false);
            }
            else if (selectType == SelectType.GemOn)
            {
                itemTable = sdGameItemMgr.Instance.GetGemOnInBag();
                ShowBtnPanel(false);
            }
            else if (selectType == SelectType.ItemSell)
            {
                itemTable = sdGameItemMgr.Instance.GetEquipByQuilityInBag(sellType, false);
                ShowBtnPanel(true);
            }
            else if (selectType == SelectType.EquipSelect)
            {
                itemTable = sdGameItemMgr.Instance.GetBagItemByEquipPos(equipPos, true);
                ShowBtnPanel(false);
            }
            else
            {
                ShowBtnPanel(false);
                if (sdGameItemMgr.Instance.selGemList.Count == 0)
                {
                    itemTable = sdGameItemMgr.Instance.GetGemInBag(0);
                }
                else
                {
                    IEnumerator itr = sdGameItemMgr.Instance.selGemList.GetEnumerator();
                    if (itr.MoveNext())
                    {
                        KeyValuePair <string, int> key = (KeyValuePair <string, int>)itr.Current;
                        sdGameItem gem = sdGameItemMgr.Instance.getItem(ulong.Parse(key.Key));
                        if (gem != null)
                        {
                            itemTable = sdGameItemMgr.Instance.GetGemInBag(gem.level);
                        }
                    }

                    itr.Reset();
                    while (itr.MoveNext())
                    {
                        KeyValuePair <string, int> key = (KeyValuePair <string, int>)itr.Current;
                        int num = key.Value;
                        for (int i = 0; i < num; ++i)
                        {
                            foreach (sdGameItem gem in itemTable)
                            {
                                if (gem.instanceID.ToString() == key.Key)
                                {
                                    if (gem.count > 1)
                                    {
                                        gem.count--;
                                    }
                                    else
                                    {
                                        itemTable.Remove(gem);
                                    }

                                    break;
                                }
                            }
                        }
                    }
                }
            }

            Hashtable list = sdSlotMgr.Instance.GetIconList(PanelType.Panel_ItemSelect);
            if (itemTable.Count > list.Count)
            {
                if (copyItem == null)
                {
                    Debug.LogWarning("NoCopyItem");
                }
                //copyItem.SetActive(true);
                for (int i = list.Count; i < itemTable.Count; ++i)
                {
                    GameObject tempItem = GameObject.Instantiate(copyItem) as GameObject;
                    tempItem.transform.parent = copyItem.transform.parent;
                    Vector3 pos = copyItem.transform.localPosition;
                    if (i % 2 == 1)
                    {
                        pos.x = 260;
                    }
                    pos.y -= (i / 2) * 120;
                    tempItem.transform.localPosition = pos;
                    tempItem.transform.localScale    = copyItem.transform.localScale;
                    sdSlotIcon icon = tempItem.GetComponent <sdSlotIcon>();

                    if (icon != null)
                    {
                        icon.index = i;
                        list.Add(i, icon);
                    }
                    icon.gameObject.SetActive(false);
                }
            }
            else if (itemTable.Count < list.Count)
            {
                foreach (DictionaryEntry item in list)
                {
                    sdSlotIcon icon = item.Value as sdSlotIcon;

                    if (icon != null && icon.index >= itemTable.Count)
                    {
                        if (icon.index == 0)
                        {
                            copyItem.SetActive(false);
                        }
                        else
                        {
                            icon.gameObject.SetActive(false);
                        }
                    }
                }
            }

            if (panel != null)
            {
                panel.ResetPosition();
            }
            IDictionaryEnumerator iter = list.GetEnumerator();

            if (itemTable != null)
            {
                itemTable.Sort();

                if (selectType == SelectType.ItemUpChange)
                {
                    itemTable.Sort(OnSortEquiped);
                }
                else
                {
                    if (SortType == 0)
                    {
                        itemTable.Sort(OnSortQuility);
                    }
                    else if (SortType == 1)
                    {
                        itemTable.Sort(OnSortLevel);
                    }
                    else
                    {
                        itemTable.Sort(OnSortScore);
                    }
                }

                foreach (sdGameItem info in itemTable)
                {
                    if (!iter.MoveNext())
                    {
                        break;
                    }
                    //sdGameItem info = (sdGameItem)item.Value;
                    //if (info.bagIndex != (int)PanelType.Panel_Bag) continue;
                    //if (info.slotIndex != num) continue;
                    Hashtable  table = new Hashtable();
                    sdSlotIcon icon  = (sdSlotIcon)iter.Value;
                    table.Add("uuid", info.instanceID);
                    table.Add("ID", info.templateID);
                    table.Add("count", info.count);
                    bool isSelect = icon.isActiveAndEnabled && icon.isSelected;
                    icon.SetInfo(info.instanceID.ToString(), table);
                    if (selType == SelectType.ItemSell)
                    {
                        if (!icon.gameObject.active)
                        {
                            icon.SetSelect(true);
                        }
                    }
                    icon.gameObject.SetActive(true);
                    if (selType == SelectType.ItemSell)
                    {
                        if (isSelect)
                        {
                            icon.SetSelect(true);
                        }
                    }
                    if (selectType == SelectType.ItemUp)
                    {
                        icon.SetSelect(sdGameItemMgr.Instance.hasSelectItemUp(info.instanceID.ToString()));
                        if (icon.isSelected)
                        {
                            AddSelectItem(info.instanceID.ToString());
                        }
                    }
                }
            }
        }
    }
Пример #10
0
    public bool AddSelectItem(string id)
    {
        bool isOver = true;

        if (selectType == SelectType.ItemUp)
        {
            isOver = false;
            if (selectNum >= 6)
            {
                return(false);
            }
        }
        else if (selectType == SelectType.ItemUpChange)
        {
            Hashtable iconList = sdSlotMgr.Instance.GetIconList(PanelType.Panel_ItemSelect);
            foreach (DictionaryEntry info in iconList)
            {
                sdSlotIcon icon = info.Value as sdSlotIcon;
                icon.SetSelect(false);
            }
            selectList.Clear();
        }
        else if (selectType == SelectType.ItemMake)
        {
            Hashtable iconList = sdSlotMgr.Instance.GetIconList(PanelType.Panel_ItemSelect);
            foreach (DictionaryEntry info in iconList)
            {
                sdSlotIcon icon = info.Value as sdSlotIcon;
                icon.SetSelect(false);
            }
            selectList.Clear();
        }
        else if (selectType == SelectType.GemOn)
        {
            Hashtable iconList = sdSlotMgr.Instance.GetIconList(PanelType.Panel_ItemSelect);
            foreach (DictionaryEntry info in iconList)
            {
                sdSlotIcon icon = info.Value as sdSlotIcon;
                icon.SetSelect(false);
            }
            selectList.Clear();
        }
        else if (selectType == SelectType.GemMerge)
        {
            Hashtable iconList = sdSlotMgr.Instance.GetIconList(PanelType.Panel_ItemSelect);
            foreach (DictionaryEntry info in iconList)
            {
                sdSlotIcon icon = info.Value as sdSlotIcon;
                icon.SetSelect(false);
            }
            selectList.Clear();
        }
        else if (selectType == SelectType.GemReplace)
        {
            Hashtable iconList = sdSlotMgr.Instance.GetIconList(PanelType.Panel_ItemSelect);
            foreach (DictionaryEntry info in iconList)
            {
                sdSlotIcon icon = info.Value as sdSlotIcon;
                icon.SetSelect(false);
            }
            selectList.Clear();
        }
        else if (selectType == SelectType.ItemSell)
        {
            isOver = false;
        }
        else if (selectType == SelectType.EquipSelect)
        {
            if (selectNum >= 1)
            {
                return(false);
            }
        }

        if (selectList.ContainsKey(id))
        {
            selectList[id]++;
        }
        else
        {
            selectList.Add(id, 1);
        }
        ++selectNum;

        if (isOver)
        {
            gameObject.SetActive(false);
            if (btn_OK.onClick.Count > 0)
            {
                EventDelegate.Execute(btn_OK.onClick);
                btn_OK.onClick.Clear();
            }
        }

        return(true);
    }
Пример #11
0
    public void Run()
    {
        //sdUICharacter.Instance.HideMask();
        needShowPoint = false;
        sdUICharacter.Instance.MsgClickCancel();
        int num = 0;

        string[] param = opParam.ToString().Split(';');
        if ((opType & (int)GuideOperationType.None) > 0)
        {
        }

        if ((opType & (int)GuideOperationType.ShowArrow) > 0)
        {
            if (param.Length > num)
            {
                string     objName = param[num];
                GameObject obj     = GameObject.Find(objName);

                sdUICharacter.Instance.ShowArrow(obj);
                ++num;
            }
        }

        if ((opType & (int)GuideOperationType.ShowPoint) > 0)
        {
            if (param.Length > num)
            {
                ShowPoint(param[num]);
                ++num;
            }
        }

        if ((opType & (int)GuideOperationType.ShowWord) > 0)
        {
            if (param.Length > num)
            {
                string word = param[num];
                if (sdGameLevel.instance == null)
                {
                    return;
                }
                sdMovieDialogue dlg = sdGameLevel.instance.gameObject.GetComponent <sdMovieDialogue>();
                if (dlg == null)
                {
                    dlg = sdGameLevel.instance.gameObject.AddComponent <sdMovieDialogue>();
                }
                if (dlg != null)
                {
                    dlg.SetMovieInfo(int.Parse(word), true, true, Vector3.one, Vector3.zero);
                    sdGameLevel.instance.guideDialogueEnd += OnFinish;
                    ++num;
                }
            }
        }

        if ((opType & (int)GuideOperationType.ShowEffect) > 0)
        {
            if (param.Length > num)
            {
                string        word     = param[num];
                string[]      wordlist = word.Split('|');
                GameObject    item     = GameObject.Find(wordlist[0]);
                ResLoadParams p        = new ResLoadParams();
                p.info      = "effect";
                p.userdata0 = item;
                sdResourceMgr.Instance.LoadResource(wordlist[1], LoadEffect, p);
                ++num;
            }
        }

        if ((opType & (int)GuideOperationType.HideObj) > 0)
        {
            if (param.Length > num)
            {
                string     objName = param[num];
                GameObject obj     = GameObject.Find(objName);
                if (obj != null)
                {
                    obj.SetActive(false);
                    if (!sdGuideMgr.Instance.hideList.Contains(objName))
                    {
                        sdGuideMgr.Instance.hideList.Add(objName, obj);
                    }
                    else
                    {
                        sdGuideMgr.Instance.hideList[objName] = obj;
                    }
                }

                ++num;
            }
        }

        if ((opType & (int)GuideOperationType.ShowObj) > 0)
        {
            if (param.Length > num)
            {
                string objName = param[num];
                if (sdGuideMgr.Instance.hideList[objName] != null)
                {
                    GameObject obj = sdGuideMgr.Instance.hideList[objName] as GameObject;
                    obj.SetActive(true);
                }
                ++num;
            }
        }

        if ((opType & (int)GuideOperationType.PointEquip) > 0)
        {
            if (param.Length > num)
            {
                sdUICharacter.Instance.tipCanEquip = true;
                if (sdGameLevel.instance == null || sdGameLevel.instance.mainChar == null)
                {
                    return;
                }
                string   tid      = "";
                string[] wordlist = param[num].Split('|');
                if (wordlist.Length == 1)
                {
                    Hashtable needEquip = new Hashtable();
                    Hashtable itemTable = sdGameItemMgr.Instance.GetAllItem((int)PanelType.Panel_Bag, -1);
                    foreach (DictionaryEntry itemInfo in itemTable)
                    {
                        sdGameItem item = itemInfo.Value as sdGameItem;
                        if (item.equipPos < 0)
                        {
                            continue;
                        }
                        if (!item.CanEquip(sdGameLevel.instance.mainChar))
                        {
                            continue;
                        }
                        if (needEquip.ContainsKey(item.equipPos))
                        {
                            sdGameItem maxItem  = needEquip[item.equipPos] as sdGameItem;
                            int        maxScore = sdConfDataMgr.Instance().GetItemScore(maxItem.instanceID);
                            int        curScore = sdConfDataMgr.Instance().GetItemScore(item.instanceID);
                            if (curScore > maxScore)
                            {
                                needEquip[item.equipPos] = item;
                            }
                        }
                        else
                        {
                            needEquip.Add(item.equipPos, item);
                        }
                    }

                    foreach (DictionaryEntry itemInfo in needEquip)
                    {
                        sdGameItem item        = itemInfo.Value as sdGameItem;
                        sdGameItem compareItem = sdGameItemMgr.Instance.getEquipItemByPos(item.equipPos);
                        if (compareItem == null)
                        {
                            tid = item.templateID.ToString();
                            break;
                        }
                        int score        = sdConfDataMgr.Instance().GetItemScore(item.instanceID);
                        int compareScore = sdConfDataMgr.Instance().GetItemScore(compareItem.instanceID);
                        if (score > compareScore)
                        {
                            tid = item.templateID.ToString();
                            break;
                        }
                    }
                }
                else
                {
                    int job = int.Parse(sdGameLevel.instance.mainChar.GetProperty()["Job"].ToString());
                    if (job == (int)HeaderProto.ERoleJob.ROLE_JOB_Warrior)
                    {
                        tid = wordlist[0];
                    }
                    else if (job == (int)HeaderProto.ERoleJob.ROLE_JOB_Magic)
                    {
                        tid = wordlist[1];
                    }
                    else if (job == (int)HeaderProto.ERoleJob.ROLE_JOB_Rogue)
                    {
                        tid = wordlist[2];
                    }
                    else if (job == (int)HeaderProto.ERoleJob.ROLE_JOB_Minister)
                    {
                        tid = wordlist[3];
                    }
                }

                Hashtable info = sdConfDataMgr.Instance().GetItemById(tid);
                sdSlotMgr.Instance.GotoEquip(int.Parse(info["Character"].ToString()));
                Hashtable table = sdSlotMgr.Instance.GetIconList(PanelType.Panel_Bag);
                foreach (DictionaryEntry item in table)
                {
                    sdSlotIcon icon = item.Value as sdSlotIcon;
                    if (icon.tempId == tid)
                    {
                        icon.gameObject.name = "guide_item";
                        ShowPoint(icon.gameObject.name + "|1");
                    }
                }

                ++num;
            }
        }

        if ((opType & (int)GuideOperationType.JumpMap) > 0)
        {
            Debug.Log(string.Format("guide:{0}", id));
            sdUICharacter.JumpToWorldMap();
        }

        if ((opType & (int)GuideOperationType.SmallWord) > 0)
        {
            if (param.Length > num)
            {
                string word = param[num];
                if (sdGameLevel.instance == null)
                {
                    return;
                }
                sdGuideDialogue dlg = sdGameLevel.instance.gameObject.GetComponent <sdGuideDialogue>();
                if (dlg == null)
                {
                    dlg = sdGameLevel.instance.gameObject.AddComponent <sdGuideDialogue>();
                }
                if (dlg != null)
                {
                    string[] wordlist = word.Split('|');
                    Vector3  pos      = Vector3.zero;
                    if (wordlist.Length >= 3)
                    {
                        string   posStr  = wordlist[2];
                        string[] posList = posStr.Split('@');
                        pos.y = int.Parse(posList[1]);
                        pos.x = int.Parse(posList[0]);
                    }

                    dlg.SetMovieInfo(int.Parse(wordlist[1]), new Vector3(1f, 1f, 1f), pos);
                    //sdGameLevel.instance.mainCamera.GetComponent<sdGameCamera>().zoomEnd += OnFinish;
                    ++num;
                }
            }
        }

        if ((opType & (int)GuideOperationType.Spec) > 0)
        {
            if (param.Length > num)
            {
                string tid = param[num];
                if (tid == "2")
                {
                    EventDelegate finish = new EventDelegate(OnFinish);
                    sdUICharacter.Instance.ShowGuideRoll(finish);
                }
                else if (tid == "3")
                {
                    if (sdGameLevel.instance != null)
                    {
                        sdGameLevel.instance.AutoMode     = true;
                        sdGameLevel.instance.FullAutoMode = false;
                    }
                }
                else if (tid == "4")
                {
                    sdUICharacter.Instance.tipCanEquip = false;
                }
                ++num;
            }
        }

        if ((opType & (int)GuideOperationType.OpenFrame) > 0)
        {
            GameObject panel = GameObject.Find("Sys1");
            if (panel != null)
            {
                GameObject btn = GameObject.Find("Btn_Push");
                UISprite   sp  = btn.transform.FindChild("Background").GetComponent <UISprite>();
                sdRoleWndButton.sysPanelPos   = panel.transform.localPosition.x;
                panel.transform.localPosition = new Vector3(640.0f - 120.0f * panel.transform.localScale.x, panel.transform.localPosition.y, panel.transform.localPosition.z);
                sp.spriteName = "btn_c";
            }
        }

        if ((opType & (int)GuideOperationType.PointItemUp) > 0)
        {
            if (param.Length > num)
            {
                if (sdGameLevel.instance == null || sdGameLevel.instance.mainChar == null)
                {
                    return;
                }
                sdUICharacter.Instance.tipCanEquip = true;

                string   tid      = "";
                string[] wordlist = param[num].Split('|');
                int      job      = int.Parse(sdGameLevel.instance.mainChar.GetProperty()["Job"].ToString());
                if (job == (int)HeaderProto.ERoleJob.ROLE_JOB_Warrior)
                {
                    tid = wordlist[0];
                }
                else if (job == (int)HeaderProto.ERoleJob.ROLE_JOB_Magic)
                {
                    tid = wordlist[1];
                }
                else if (job == (int)HeaderProto.ERoleJob.ROLE_JOB_Rogue)
                {
                    tid = wordlist[2];
                }
                else if (job == (int)HeaderProto.ERoleJob.ROLE_JOB_Minister)
                {
                    tid = wordlist[3];
                }

                Hashtable iconList = sdSlotMgr.Instance.GetIconList(PanelType.Panel_ItemSelect);
                foreach (DictionaryEntry item in iconList)
                {
                    sdSlotIcon icon = item.Value as sdSlotIcon;
                    if (icon.tempId == tid)
                    {
                        UIDraggablePanel panel = icon.GetComponentInParent <UIDraggablePanel>();
                        Vector3          pos   = Vector3.zero;
                        pos.y = -icon.transform.localPosition.y;
                        panel.MoveRelative(pos);
                        panel.UpdateScrollbars(true);
                        icon.gameObject.name = "guide_item";
                        ShowPoint(icon.gameObject.name + "|1");
                        break;
                    }
                }

                ++num;
            }
        }

        if ((opType & (int)GuideOperationType.LockTown) > 0)
        {
            sdUICharacter.Instance.bLockTown = true;
        }


        WaitForEvetnt();
    }
Пример #12
0
    void Update()
    {
        if (tempItem != null && targetBtn != null)
        {
            //copyItem.transform.position = tempItem.transform.position;
            sdSlotIcon icon = tempItem.GetComponent <sdSlotIcon>();
            if (icon != null && icon.panel == PanelType.Panel_Bag)
            {
                Transform pic = tempItem.transform.FindChild("icon");
                if (pic != null)
                {
                    targetBtn.transform.position = pic.position;
                }
            }
            else
            {
                targetBtn.transform.position = tempItem.transform.position;
            }
        }

        if (arrow == null)
        {
            return;
        }

        time += 0.02f;
        if (time > 0.1)
        {
            time = 0;
            Vector3 scale = round.transform.localScale;
            Vector3 pos   = arrow.transform.localPosition;
            if (isAddRound)
            {
                scale.x += 0.033f;
                scale.y += 0.033f;
                if (scale.x >= 0.7)
                {
                    scale.x    = 0.7f;
                    scale.y    = 0.7f;
                    isAddRound = false;
                }
            }
            else
            {
                scale.x -= 0.033f;
                scale.y -= 0.033f;
                if (scale.x <= 0.6)
                {
                    scale.x    = 0.6f;
                    scale.y    = 0.6f;
                    isAddRound = true;
                }
            }

            if (isAddArrow)
            {
                pos.y += 4f;
                pos.x -= 3f;
                if (pos.y >= -25f)
                {
                    pos.y      = -25f;
                    isAddArrow = false;
                }
            }
            else
            {
                pos.y -= 4f;
                pos.x += 3f;
                if (pos.y <= -40f)
                {
                    pos.y      = -40f;
                    isAddArrow = true;
                }
            }

            arrow.transform.localPosition = pos;
            round.transform.localScale    = scale;
        }
    }
Пример #13
0
    public void Update()
    {
        if (sdUICharacter.Instance.IsTipShow() || lvupPanel.active || sdUIPetControl.Instance.IsPetTipActive())
        {
            if (scorePanel.active)
            {
                scorePanel.SetActive(false);
            }
        }
        else
        {
            if (!scorePanel.active)
            {
                scorePanel.SetActive(true);
            }
        }

        if (!isMoveStop)
        {
//          if (timeEffect != null && !isTimeEffectStop)
//          {
//              if (!timeEffect.GetComponentInChildren<Animation>().isPlaying)
//              {
//                  isTimeEffectStop = true;
//              }
//          }

            if (isTimeEffectStop && !isTimeStop)
            {
                ShowTime();
            }

//          if (isTimeStop && !isMoneyEffectStop)
//          {
//              getEffect.SetActive(true);
//              if (!getEffect.GetComponentInChildren<Animation>().isPlaying)
//              {
//                  isMoneyEffectStop = true;
//              }
//          }

            if (isTimeStop && moneyObj != null && !moneyStop)
            {
                moneyPanel.SetActive(true);
                int nowMoney = int.Parse(moneyObj.GetComponent <UILabel>().text.ToString());
                int addMoney = (money / 40);
                if (addMoney <= 0)
                {
                    addMoney = 1;
                }
                nowMoney += addMoney;
                if (nowMoney >= money)
                {
                    nowMoney  = money;
                    moneyStop = true;
                }

                moneyObj.GetComponent <UILabel>().text = nowMoney.ToString();
            }

            if (moneyStop)
            {
                expPanel.SetActive(true);

                if (lvMax)
                {
                    //expObj.GetComponent<UILabel>().text = "0";
                    expStop = true;
                }
                else
                {
                    int addExp = (exp / 40);
                    if (addExp <= 0)
                    {
                        addExp = 1;
                    }
                    nowexp += addExp;
                    if (nowexp >= exp)
                    {
                        nowexp  = exp;
                        expStop = true;
                    }
                    expValue.text = "+" + nowexp.ToString();
                    if (lvPic != null && !expStop)
                    {
                        curExp += (exp / 40);
                        int maxExp = sdConfDataMgr.Instance().GetLevelExp(m_job.ToString(), m_level.ToString());
                        if (maxExp == 0)
                        {
                            lvMax = true;
                            lvPic.GetComponent <UISprite>().fillAmount = 0;
                        }
                        else
                        {
                            if (curExp >= maxExp)
                            {
                                //levelupEffect.SetActive(true);
                                bLvup = true;
                                ++m_level;
                                curExp -= maxExp;
                                maxExp  = sdConfDataMgr.Instance().GetLevelExp(m_job.ToString(), m_level.ToString());
                                if (curLevel != null)
                                {
                                    curLevel.GetComponent <UILabel>().text = string.Format("Lv.{0}", m_level.ToString());
                                }

                                if (nextLevel != null)
                                {
                                    nextLevel.GetComponent <UILabel>().text = string.Format("Lv.{0}", (m_level + 1).ToString());
                                }

//                              if (lvUp != null)
//                              {
//                                  lvUp.SetActive(true);
//                              }
                            }
                            lvPic.GetComponent <UISprite>().fillAmount = (float)curExp / (float)maxExp;
                        }
                    }
                }
            }

            itemShowTime += Time.deltaTime;
            //if (expStop && bLvup)
            //{
            //Animator ani = levelupEffect.GetComponentInChildren<Animator>();
            //if (ani != null)
            //{
            //	itemShowTime = 0;
            //}
            //LevelUp();
            //}

            if (expStop && !itemStop && itemShowTime >= 0.1)
            {
                Hashtable table = sdSlotMgr.Instance.GetIconList(PanelType.Panel_Jiesuan);
                if (table.ContainsKey(curIndex) && table[curIndex] != null)
                {
                    sdSlotIcon icon = table[curIndex] as sdSlotIcon;
                    if (icon.itemid != "0" && icon.itemid != "")
                    {
                        icon.gameObject.SetActive(true);
                        icon.enable = true;
                    }

                    ++curIndex;
                }
                else
                {
                    itemStop = true;
                }
                itemShowTime = 0;
                Vector3 pos = itemPanel.transform.localPosition;

                if (itemCount == 3)
                {
                    pos.x = -115;
                }
                else if (itemCount == 2)
                {
                    pos.x = -60;
                }
                else
                {
                    pos.x = 0;
                }
                itemPanel.transform.localPosition = pos;
                itemPanel.SetActive(true);
            }

            if (bLvup)
            {
                LevelUp();
                bLvup  = false;
                showLv = true;
            }

            if (!showLv && bStep1 && itemStop && !isMoveStop)
            {
                firstPanel.GetComponent <TweenPosition>().enabled = true;
                secPanel.SetActive(true);
                isMoveStop = true;
            }
        }
    }
Пример #14
0
    public void SetInfo(CliProto.SC_TREASURE_CHEST_NTF msg)
    {
        LoadScoreEffect(sdUICharacter.Instance.fightScore);
        if (sdUICharacter.Instance.GetBattleType() != (byte)HeaderProto.LEVEL_BATTLE_TYPE.LEVEL_BATTLE_TYPE_ABYSS)
        {
            sdUICharacter.Instance.fightScore = 1;
        }

        if (sdFriendMgr.Instance.fightFriend != null)
        {
            sdFriend fri = sdFriendMgr.Instance.fightFriend;
            friName.GetComponent <UILabel>().text         = fri.name;
            petName.GetComponent <UILabel>().text         = fri.petInfo.m_strName;
            petFrame.GetComponent <UISprite>().spriteName = sdConfDataMgr.Instance().GetPetQuilityBorder(fri.petInfo.m_iAbility);
            UIAtlas atlas = null;
            string  headName;
            //sdConfDataMgr.Instance().SetHeadAtlas += new sdConfDataMgr.HeadAtlas(SetAtlas);
            sdConfDataMgr.Instance().SetHeadPic(fri.gender, fri.hairStyle, fri.color, friIcon.GetComponent <UISprite>());
            //friIcon.GetComponent<UISprite>().atlas = atlas;
            //friIcon.GetComponent<UISprite>().spriteName = headName;

            petIcon.GetComponent <UISprite>().atlas      = sdConfDataMgr.Instance().PetAtlas;
            petIcon.GetComponent <UISprite>().spriteName = fri.petInfo.m_strIcon;
            friLevel.GetComponent <UILabel>().text       = "Lv." + fri.level;
            petLevel.GetComponent <UILabel>().text       = "Lv." + fri.petInfo.m_iLevel.ToString();
        }

        float     expRate            = 1;
        float     moneyRate          = 1;
        Hashtable militarylevelTable = sdConfDataMgr.Instance().GetTable("militarylevel");

        if (militarylevelTable.ContainsKey(sdPVPManager.Instance.nMilitaryLevel.ToString()))
        {
            Hashtable military = militarylevelTable[(sdPVPManager.Instance.nMilitaryLevel).ToString()] as Hashtable;
            expRate   = float.Parse(military["experience"].ToString()) / 100 + 1;
            moneyRate = float.Parse(military["money"].ToString()) / 100 + 1;
        }

        exp   = (int)(((float)msg.m_Experience) * expRate);
        money = (int)(((float)msg.m_Money) * moneyRate);
        Hashtable            table       = sdSlotMgr.Instance.GetIconList(PanelType.Panel_Jiesuan);
        int                  slotNum     = 0;
        int                  num         = (int)msg.m_Items.m_ItemCount;
        List <sdGameItem>    itemList    = new List <sdGameItem>();
        List <sdGamePetItem> petItemList = new List <sdGamePetItem>();
        List <sdGameItem>    petCardList = new List <sdGameItem>();

        for (int i = 0; i < num; ++i)
        {
            sdGameItem item = sdGameItemMgr.Instance.getItem(msg.m_Items.m_Items[i].m_UID);
            if (item == null)
            {
                sdGamePetItem petItem = sdNewPetMgr.Instance.getPetItem(msg.m_Items.m_Items[i].m_UID);
                if (petItem == null)
                {
                    sdGameItem temp = new sdGameItem();
                    temp.templateID = msg.m_Items.m_Items[i].m_TID;
                    Hashtable tempInfo = sdConfDataMgr.Instance().GetItemById(msg.m_Items.m_Items[i].m_TID.ToString());
                    if (tempInfo == null)
                    {
                        continue;
                    }
                    if (int.Parse(tempInfo["Class"].ToString()) == (int)HeaderProto.EItemClass.ItemClass_Pet_Item)
                    {
                        petCardList.Add(temp);
                    }
                    else
                    {
                        itemList.Add(temp);
                    }

                    continue;
                }
                petItemList.Add(petItem);
                continue;
            }
            item.isNew = true;
            itemList.Add(item);
        }

        itemCount = num + msg.m_PetAboutCount;
        num       = msg.m_PetAboutCount;
        for (int i = 0; i < num; ++i)
        {
            if (table.ContainsKey(slotNum) && table[slotNum] != null)
            {
                sdSlotIcon icon = table[slotNum] as sdSlotIcon;
                if (icon != null)
                {
                    Hashtable pet = sdConfDataMgr.Instance().GetItemById(msg.m_PetAbout[i].ToString());
                    if (pet == null)
                    {
                        continue;
                    }
                    if (int.Parse(pet["Class"].ToString()) == (int)HeaderProto.EItemClass.ItemClass_Pet_Equip)
                    {
                        icon.jiesuanType = JiesuanSlotType.PetItem;
                        icon.SetInfo(msg.m_PetAbout[i].ToString(), pet);
                        icon.gameObject.SetActive(false);
                        icon.GetComponent <BoxCollider>().enabled = true;
                    }
                    else if (int.Parse(pet["Class"].ToString()) == (int)HeaderProto.EItemClass.ItemClass_Pet_Item)
                    {
                        icon.jiesuanType = JiesuanSlotType.Pet;
                        icon.SetInfo(msg.m_PetAbout[i].ToString(), pet);
                        icon.gameObject.SetActive(false);
                        icon.GetComponent <BoxCollider>().enabled = true;
                    }
                }
            }
            ++slotNum;
        }

        foreach (sdGameItem item in petCardList)
        {
            if (table.ContainsKey(slotNum) && table[slotNum] != null)
            {
                sdSlotIcon icon = table[slotNum] as sdSlotIcon;
                if (icon != null)
                {
                    if (item != null)
                    {
                        Hashtable info = sdConfDataMgr.Instance().GetItemById(item.templateID.ToString());
                        icon.panel       = PanelType.Panel_Jiesuan;
                        icon.jiesuanType = JiesuanSlotType.Pet;
                        icon.SetInfo(item.instanceID.ToString(), info);
                        icon.gameObject.SetActive(false);
                    }
                    icon.enable = false;
                    icon.GetComponent <BoxCollider>().enabled = true;
                }
            }
            ++slotNum;
        }

        foreach (sdGamePetItem item in petItemList)
        {
            if (table.ContainsKey(slotNum) && table[slotNum] != null)
            {
                sdSlotIcon icon = table[slotNum] as sdSlotIcon;
                if (icon != null)
                {
                    if (item != null)
                    {
                        Hashtable info = sdConfDataMgr.Instance().GetItemById(item.templateID.ToString());
                        icon.panel       = PanelType.Panel_Jiesuan;
                        icon.jiesuanType = JiesuanSlotType.PetItem;
                        icon.SetInfo(item.instanceID.ToString(), info);
                        icon.gameObject.SetActive(false);
                    }
                    icon.enable = false;
                    icon.GetComponent <BoxCollider>().enabled = true;
                }
            }
            ++slotNum;
        }

        itemList.Sort(CompareItem);

        foreach (sdGameItem item in itemList)
        {
            if (table.ContainsKey(slotNum) && table[slotNum] != null)
            {
                sdSlotIcon icon = table[slotNum] as sdSlotIcon;
                if (icon != null)
                {
                    if (item != null)
                    {
                        Hashtable info = sdConfDataMgr.Instance().GetItemById(item.templateID.ToString());
                        icon.panel = PanelType.Panel_Jiesuan;
                        icon.SetInfo(item.instanceID.ToString(), info);
                        icon.gameObject.SetActive(false);
                    }
                    icon.enable = false;
                    icon.GetComponent <BoxCollider>().enabled = true;
                }
            }
            ++slotNum;
        }

        while (table.ContainsKey(slotNum) && table[slotNum] != null)
        {
            sdSlotIcon icon = table[slotNum] as sdSlotIcon;
            if (icon != null)
            {
                icon.SetInfo("0", null);
                icon.enable = false;
                icon.GetComponent <BoxCollider>().enabled = false;
            }
            ++slotNum;
        }

        int treasureNum = msg.m_GetCount;

        for (int i = 0; i < treasureNum; ++i)
        {
            TreasureInfo info = new TreasureInfo();
            info.index  = msg.m_CardInfos[i].m_IndexID;
            info.id     = (int)msg.m_CardInfos[i].m_ItemID;
            info.count  = (int)msg.m_CardInfos[i].m_Count;
            info.isTemp = false;
            realList.Add(info);
        }

        treasureNum = msg.m_TempCount;
        List <int> ranlist = new List <int>();

        for (int i = 0; i < treasureNum; ++i)
        {
            ranlist.Add(i);
        }

        System.Random ran = new System.Random();
        while (ranlist.Count > 0)
        {
            int          index    = ran.Next(ranlist.Count);
            int          indexNum = ranlist[index];
            TreasureInfo info     = new TreasureInfo();
            info.index  = msg.m_TempCardInfos[indexNum].m_IndexID;
            info.id     = (int)msg.m_TempCardInfos[indexNum].m_ItemID;
            info.count  = (int)msg.m_TempCardInfos[indexNum].m_Count;
            info.isTemp = true;

            tempList.Add(info);

            ranlist.RemoveAt(index);
        }

        if (sdGameLevel.instance != null && sdGameLevel.instance.mainChar != null)
        {
            if (sdGameLevel.instance.mainChar.Property != null)
            {
                curExp  = sdUICharacter.Instance.oldExp;
                m_level = sdUICharacter.Instance.oldLevel;
                m_job   = int.Parse(sdGameLevel.instance.mainChar.Property["Job"].ToString());
                int maxExp = sdConfDataMgr.Instance().GetLevelExp(m_job.ToString(), m_level.ToString());
                if (maxExp == 0)
                {
                    lvMax = true;
                }
                else
                {
                    lvMax = false;
                }

                if (curLevel != null)
                {
                    if (maxExp == 0)
                    {
                        curLevel.GetComponent <UILabel>().text = string.Format("Max");
                    }
                    else
                    {
                        curLevel.GetComponent <UILabel>().text = string.Format("Lv.{0}", m_level.ToString());
                    }
                }

                if (nextLevel != null)
                {
                    if (maxExp == 0)
                    {
                        nextLevel.GetComponent <UILabel>().text = string.Format("");
                    }
                    else
                    {
                        nextLevel.GetComponent <UILabel>().text = string.Format("Lv.{0}", (m_level + 1).ToString());
                    }
                }

                if (lvPic != null)
                {
                    if (maxExp == 0)
                    {
                        lvPic.GetComponent <UISprite>().fillAmount = 0;
                    }
                    else
                    {
                        lvPic.GetComponent <UISprite>().fillAmount = (float)((float)curExp / (float)maxExp);
                    }
                }
            }
        }
    }
Пример #15
0
    public void Refresh()
    {
        if (pvpRewardsItem == null)
        {
            return;
        }
        pvpRewardsItem.SetActive(false);
        List <Hashtable> rewardsTable = sdConfDataMgr.Instance().GetList("pvprewards");

        for (int index = 0; index < rewardsTable.Count; ++index)
        {
            GameObject uiItem = null;
            uiItem = GameObject.Instantiate(pvpRewardsItem) as GameObject;
            uiItem.transform.parent        = pvpRewards.transform;
            uiItem.transform.localPosition = new Vector3(0, 0 - 140 * index, 0);
            uiItem.transform.localScale    = Vector3.one;
            uiItem.transform.localRotation = Quaternion.identity;
            uiItem.SetActive(true);
            Hashtable table = rewardsTable[index];
            if (index <= 2)
            {
                uiItem.transform.FindChild("Sprite_rank").gameObject.SetActive(true);
                UISprite sprite_rank = uiItem.transform.FindChild("Sprite_rank").GetComponent <UISprite>();
                sprite_rank.spriteName = "if-n" + (index + 1).ToString();
                uiItem.transform.FindChild("Label_reward1").gameObject.SetActive(false);
            }
            else
            {
                uiItem.transform.FindChild("Label_reward1").gameObject.SetActive(true);
                UISprite sprite_rank = uiItem.transform.FindChild("Sprite_rank").GetComponent <UISprite>();
                sprite_rank.spriteName = "if-n5";
                string key = table["key"] as string;
                uiItem.transform.FindChild("Label_reward1").GetComponent <UILabel>().text = key;
            }

            string   value = table["value"] as string;
            string[] items = value.Split(new char[] { ';' });
            int      j     = 1;
            for (j = 1; j <= items.Length; ++j)
            {
                sdSlotIcon sloticon = uiItem.transform.FindChild("Sprite_rewardicon1_" + j).GetComponent <sdSlotIcon>();
                sloticon.panel = PanelType.Panel_PVPRankReward;
                string[] item = items[j - 1].Split(new char[] { '-' });
                if (item.Length == 2)
                {
                    int       templateID = int.Parse(item[0]);
                    Hashtable iteminfo   = sdConfDataMgr.Instance().GetItemById(templateID.ToString());
                    if (iteminfo == null)
                    {
                        break;
                    }
                    UISprite sprite_item = uiItem.transform.FindChild("Sprite_rewardicon1_" + j).GetComponent <UISprite>();
                    sprite_item.atlas      = sdConfDataMgr.Instance().commonAtlas;
                    sprite_item.spriteName = "IconFrame0";
                    sloticon.SetInfo(templateID.ToString(), iteminfo);
                    //if (iteminfo.ContainsKey("Class") && int.Parse(iteminfo["Class"].ToString()) == (int)HeaderProto.EItemClass.ItemClass_Pet_Item &&
                    //    iteminfo.ContainsKey("SubClass") && int.Parse(iteminfo["SubClass"].ToString()) == 2)
                    //    uiItem.transform.FindChild("Sprite_rewardicon1_" + j).GetComponent<UISprite>().spriteName = "IconFrame0-cp";
                    //else
                    //    uiItem.transform.FindChild("Sprite_rewardicon1_"+j).GetComponent<UISprite>().spriteName = sdConfDataMgr.Instance().GetItemQuilityBorder( int.Parse(iteminfo["Quility"].ToString()) );
                    UILabel label_num = uiItem.transform.FindChild("Sprite_rewardicon1_" + j).FindChild("Label_num").GetComponent <UILabel>();
                    int     nCount    = int.Parse(item[1]);
                    if (nCount > 1)
                    {
                        label_num.text = nCount.ToString();
                    }

                    UISprite sprite_quality = uiItem.transform.FindChild("Sprite_rewardicon1_" + j).FindChild("Sprite").GetComponent <UISprite>();
                    sprite_quality.atlas      = sdConfDataMgr.Instance().commonAtlas;
                    sprite_quality.spriteName = sdConfDataMgr.Instance().GetItemQuilityBorder(int.Parse(iteminfo["Quility"].ToString()));
                }
            }
            for (; j <= 2; j++)
            {
                uiItem.transform.FindChild("Sprite_rewardicon1_" + j).gameObject.SetActive(false);
            }
        }
    }
Пример #16
0
    public void ShowSkillInfo(string id)
    {
        Hashtable skillinfo = sdConfDataMgr.Instance().GetSkill(id);

        if (skillinfo != null)
        {
            GameObject name = GameObject.Find("label_skillname");
            if (name != null)
            {
                name.GetComponent <UILabel>().text = skillinfo["strName"].ToString();
            }

            GameObject des = GameObject.Find("label_des");
            if (des != null)
            {
                des.GetComponent <UILabel>().text = skillinfo["Description"].ToString();
            }
        }

        Hashtable table = sdConfDataMgr.Instance().GetPassiveSkill(id);

        if (table != null)
        {
            //GameObject passivePanel = GameObject.Find("passivepanel");
            if (passivePanel == null)
            {
                return;
            }
            foreach (DictionaryEntry temp in table)
            {
                Hashtable item  = temp.Value as Hashtable;
                int       index = int.Parse(item["Index"].ToString());
                string    name  = "passive" + (index + 1).ToString();
                Transform icon  = passivePanel.transform.FindChild(name);
                if (icon != null)
                {
                    sdSlotIcon slot = icon.GetComponent <sdSlotIcon>();

                    icon.FindChild("passivename").GetComponent <UILabel>().text = item["strName"].ToString();

                    sdGameSkill skill = sdGameSkillMgr.Instance.GetSkillByClassId(item["dwClassID"].ToString());
                    string      level = sdConfDataMgr.Instance().GetShowStr("NoLearn");
                    if (skill != null)
                    {
                        level = string.Format("Lv.{0}", skill.level.ToString());
                        Hashtable cur = sdConfDataMgr.Instance().GetSkill(skill.templateID.ToString());
                        slot.SetInfo(skill.templateID.ToString(), cur);
                    }
                    else
                    {
                        slot.SetInfo(item["uid"].ToString(), item);
                    }

                    slot.HideLock();
                    slot.SetMax(false);
                    if (skill != null && sdGameSkillMgr.Instance.GetSkill(int.Parse(id)) != null)
                    {
                        slot.SetHighLight(true);
                        Hashtable cur = sdConfDataMgr.Instance().GetSkill(skill.templateID.ToString());
                        if (cur != null)
                        {
                            if (cur["NextLevel"].ToString() == "0")
                            {
                                level = "Lv.Max";
                            }
                            else
                            {
                            }
                        }
                    }
                    else
                    {
                        int        compareLevel = 1;
                        sdMainChar mainChar     = GameObject.Find("@GameLevel").GetComponent <sdGameLevel>().mainChar;
                        if (mainChar != null)
                        {
                            compareLevel = (int)mainChar["Level"];
                        }
                        int  needLevel    = int.Parse(item["nLearnLevel"].ToString());
                        int  needPoint    = int.Parse(item["dwTotalSkillTreePoint"].ToString());
                        int  requestPoint = int.Parse(item["dwCostSkillPoint"].ToString());
                        bool hasNeedSkill = false;
                        if (item.ContainsKey("NeedSkill"))
                        {
                            int       needSkill = int.Parse(item["NeedSkill"].ToString());
                            Hashtable needInfo  = sdConfDataMgr.Instance().GetSkill(needSkill.ToString());
                            if (needInfo != null)
                            {
                                if (int.Parse(needInfo["byIsPassive"].ToString()) == 0)
                                {
                                    hasNeedSkill = true;
                                }
                                else
                                {
                                    sdGameSkill skillneed = sdGameSkillMgr.Instance.GetSkillByClassId(needInfo["dwClassID"].ToString());
                                    if (skillneed != null && skillneed.level >= int.Parse(needInfo["byLevel"].ToString()))
                                    {
                                        hasNeedSkill = true;
                                    }
                                }
                            }
                            else
                            {
                                hasNeedSkill = true;
                            }
                        }

                        if (compareLevel < needLevel ||
                            sdGameSkillMgr.Instance.GetSkill(int.Parse(id)) == null || !hasNeedSkill)
                        {
                            slot.SetHighLight(false);
                            slot.ShowLock();
                        }
                        else
                        {
//                          if (sdGameSkillMgr.Instance.GetSkillPoint() < requestPoint)
//                          {
//                              slot.SetHighLight(false);
//                              //slot.ShowLock();
//                          }
//                          else
//                          {
                            slot.SetHighLight(true);
                            //}
                        }
                    }
                    icon.FindChild("passivelv").GetComponent <UILabel>().text = level;
                }
            }
        }
    }
Пример #17
0
    void RefreshAward()
    {
        if (awardRight == null)
        {
            return;
        }
        UILabel todayreputation = awardRight.transform.FindChild("Label_todayreputation").GetComponent <UILabel>();

        todayreputation.text = sdPVPManager.Instance.nDayReputation.ToString();

        List <Hashtable> Rewards = sdConfDataMgr.Instance().GetList("reputationRewards");

        for (int index = 0; index < Rewards.Count; ++index)
        {
            Hashtable  table     = Rewards[index];
            Transform  transItem = pk_rewardsPanel.transform.FindChild("rewards" + index.ToString());
            GameObject uiItem    = null;
            if (transItem == null)
            {
                uiItem                         = GameObject.Instantiate(pk_rewards) as GameObject;
                uiItem.name                    = "rewards" + index.ToString();
                uiItem.transform.parent        = pk_rewardsPanel.transform;
                uiItem.transform.localPosition = new Vector3(pk_rewards.transform.localPosition.x, pk_rewards.transform.localPosition.y - 145.0f * index, 0);
                uiItem.transform.localScale    = Vector3.one;
                uiItem.transform.localRotation = Quaternion.identity;
            }
            else
            {
                uiItem = transItem.gameObject;
            }
            uiItem.SetActive(true);
            UILabel label_rewards = uiItem.transform.FindChild("Label_rewards20").GetComponent <UILabel>();
            label_rewards.text = "今日获得" + table["reputation"] + "点声望";

            string   value = table["rewards"] as string;
            string[] items = value.Split(new char[] { ';' });
            int      j     = 1;
            for (j = 1; j <= items.Length; ++j)
            {
                sdSlotIcon slotion = uiItem.transform.FindChild("Sprite_rewards20_" + j).GetComponent <sdSlotIcon>();
                slotion.panel = PanelType.Panel_PvpReward;
                string[] item = items[j - 1].Split(new char[] { '-' });
                if (item.Length == 2)
                {
                    int  templateID = int.Parse(item[0]);
                    bool bSound     = true;
                    if (templateID == 100 || templateID == 101 || templateID == 200)
                    {
                        bSound = false;
                    }
                    UIPlaySound sound = slotion.gameObject.GetComponent <UIPlaySound>();
                    if (sound)
                    {
                        sound.enabled = bSound;
                    }
                    Hashtable iteminfo = sdConfDataMgr.Instance().GetItemById(templateID.ToString());
                    slotion.SetInfo(templateID.ToString(), iteminfo);

                    uiItem.transform.FindChild("Sprite_rewards20_" + j).FindChild("sp_iconframe").GetComponent <UISprite>().spriteName = sdConfDataMgr.Instance().GetItemQuilityBorder(int.Parse(iteminfo["Quility"].ToString()));

                    UILabel label_num = uiItem.transform.FindChild("Sprite_rewards20_" + j).FindChild("Label_num").GetComponent <UILabel>();
                    int     nCount    = int.Parse(item[1]);
                    if (nCount > 1)
                    {
                        label_num.text = nCount.ToString();
                    }
                }
            }
            for (; j <= 1; j++)
            {
                uiItem.transform.FindChild("Sprite_rewards20_" + j).gameObject.SetActive(false);
            }

            int reputationValue = int.Parse((string)table["reputation"]);
            if (reputationValue <= sdPVPManager.Instance.nDayReputation)
            {
                uint rewardFlag = sdPVPManager.Instance.mRewardFlag;
                if ((rewardFlag & (1 << index)) != 0)
                {
                    GameObject btn = uiItem.transform.FindChild("Button_rewards20").gameObject;
                    btn.SetActive(false);
                    GameObject getReward = uiItem.transform.FindChild("Sprite_getrewards").gameObject;
                    getReward.SetActive(true);
                }
                else
                {
                    GameObject getReward = uiItem.transform.FindChild("Sprite_getrewards").gameObject;
                    getReward.SetActive(false);
                    GameObject btn = uiItem.transform.FindChild("Button_rewards20").gameObject;
                    btn.SetActive(true);
                }
            }
            else
            {
                GameObject getReward = uiItem.transform.FindChild("Sprite_getrewards").gameObject;
                getReward.SetActive(false);
                GameObject btn = uiItem.transform.FindChild("Button_rewards20").gameObject;
                btn.SetActive(true);
                uiItem.transform.FindChild("Button_rewards20").FindChild("Background").GetComponent <UISprite>().spriteName = "btn_2dis";
            }
        }
    }
Пример #18
0
    public void Refresh()
    {
        if (this == null)
        {
            return;
        }
        if (sdMysteryShopMgr.Instance.m_freeRefreshTime > 0)
        {
            refresh_type.SetActive(false);
            label_freefreshtime.text = "免费刷新次数:" + sdMysteryShopMgr.Instance.m_freeRefreshTime.ToString() + "次";
        }
        else if (sdGameItemMgr.Instance.GetItemCount(103) > 0)
        {
            refresh_type.SetActive(true);
            Vector3 pos = refresh_type.transform.localPosition;
            refresh_type.transform.localPosition = new Vector3(525, pos.y, pos.z);

            label_freefreshtime.text = "刷新消耗:1/" + sdGameItemMgr.Instance.GetItemCount(103).ToString();
            UISprite sprite = refresh_type.GetComponent <UISprite>();
            sdUICharacter.Instance.LoadAtlas("UI/$rankList/ranklistAtlas.prefab", sprite, "sxlp");
        }
        else
        {
            refresh_type.SetActive(true);
            label_freefreshtime.text = "刷新消耗:" + m_HZRefresh.ToString();
            Vector3 pos = refresh_type.transform.localPosition;
            refresh_type.transform.localPosition = new Vector3(520, pos.y, pos.z);
            UISprite sprite = refresh_type.GetComponent <UISprite>();
            sprite.atlas      = sdConfDataMgr.Instance().commonAtlas;
            sprite.spriteName = "icon_xz";
        }
        label_crystal.text = sdGameItemMgr.Instance.GetItemCount(102).ToString();
        Hashtable shopTable = sdConfDataMgr.Instance().GetTable("dmdsshopconfig.shop_secrets");

        for (int index = 0; index < sdMysteryShopMgr.Instance.m_lstItem.Count; ++index)
        {
            CliProto.SSecretItemInfo item = sdMysteryShopMgr.Instance.m_lstItem[index];

            GameObject uiItem     = null;
            Transform  trans_item = panel.FindChild("item" + index.ToString());
            if (trans_item == null)
            {
                uiItem = GameObject.Instantiate(template_item) as GameObject;
            }
            else
            {
                uiItem = trans_item.gameObject;
            }
            uiItem.SetActive(true);
            uiItem.name                    = "item" + index.ToString();
            uiItem.transform.parent        = panel;
            uiItem.transform.localPosition = new Vector3(template_item.transform.localPosition.x, template_item.transform.localPosition.y - 130.0f * index, 0);
            uiItem.transform.localScale    = Vector3.one;
            uiItem.transform.localRotation = Quaternion.identity;

            bool bCanBuy = false;
            if (shopTable.ContainsKey(item.m_UID.ToString()))
            {
                Hashtable  subTable    = shopTable[item.m_UID.ToString()] as Hashtable;
                sdSlotIcon sloticon    = uiItem.transform.FindChild("Sprite_item").GetComponent <sdSlotIcon>();
                UISprite   sprite_item = uiItem.transform.FindChild("Sprite_item").GetComponent <UISprite>();
                sprite_item.atlas      = sdConfDataMgr.Instance().commonAtlas;
                sprite_item.spriteName = "IconFrame0";
                Hashtable itemInfo = null;
                itemInfo = sdConfDataMgr.Instance().GetItemById(subTable["ItemId"] as string);
                sloticon.SetInfo(subTable["ItemId"] as string, itemInfo);
                int     nCount = int.Parse(subTable["ItemNum"] as string);
                UILabel lb_num = uiItem.transform.FindChild("Sprite_item").FindChild("Label_num").GetComponent <UILabel>();
                lb_num.text = nCount.ToString();

                UILabel lb_money = uiItem.transform.FindChild("Label_money").GetComponent <UILabel>();
                int     costNum  = int.Parse(subTable["CostNum"].ToString());
                lb_money.text = costNum.ToString();

                UISprite sprite_moneytype = uiItem.transform.FindChild("Sprite_monetytype").GetComponent <UISprite>();
                int      moneyType        = int.Parse(subTable["CostType"].ToString());

                if (moneyType == 3)//水晶aaaa
                {
                    sprite_moneytype.width  = 40;
                    sprite_moneytype.height = 48;
                    sdUICharacter.Instance.LoadAtlas("UI/$common2/common2.prefab", sprite_moneytype, "smsj");
                    if (sdGameItemMgr.Instance.GetItemCount(102) >= costNum)
                    {
                        bCanBuy = true;
                    }
                }
                else if (moneyType == 1)//勋章aaa
                {
                    sprite_moneytype.width      = 40;
                    sprite_moneytype.height     = 47;
                    sprite_moneytype.atlas      = sdConfDataMgr.Instance().commonAtlas;
                    sprite_moneytype.spriteName = "icon_xz";
                    int Cash = int.Parse(((Hashtable)sdGlobalDatabase.Instance.globalData["MainCharBaseProp"])["Cash"].ToString());
                    if (Cash >= costNum)
                    {
                        bCanBuy = true;
                    }
                }
                else if (moneyType == 2)//游戏币aa
                {
                    sprite_moneytype.width      = 45;
                    sprite_moneytype.height     = 38;
                    sprite_moneytype.atlas      = sdConfDataMgr.Instance().commonAtlas;
                    sprite_moneytype.spriteName = "icon_jinb";
                    int money = int.Parse(((Hashtable)sdGlobalDatabase.Instance.globalData["MainCharBaseProp"])["NonMoney"].ToString());
                    if (money >= costNum)
                    {
                        bCanBuy = true;
                    }
                }
                UIPlaySound sound = sloticon.gameObject.GetComponent <UIPlaySound>();
                if (sound)
                {
                    int id = int.Parse(subTable["ItemId"] as string);
                    sound.enabled = (id != 100 && id != 101 && id != 200);
                }
                lb_money.color = bCanBuy ? Color.white : Color.red;
                UILabel   lb_itemName = uiItem.transform.FindChild("Label_name").GetComponent <UILabel>();
                Hashtable itemTable   = sdConfDataMgr.Instance().GetItemById(subTable["ItemId"] as string);
                lb_itemName.text  = itemTable["ShowName"].ToString();
                lb_itemName.color = sdConfDataMgr.Instance().GetItemQuilityColor(int.Parse(itemInfo["Quility"].ToString()));
                UISprite sprite_quality = uiItem.transform.FindChild("Sprite_item").FindChild("Sprite").GetComponent <UISprite>();
                sprite_quality.spriteName = sdConfDataMgr.Instance().GetItemQuilityBorder(int.Parse(itemInfo["Quility"].ToString()));
            }
            uiItem.transform.FindChild("Button_buy").gameObject.SetActive(item.m_Bought == 0);
            uiItem.transform.FindChild("Sprite_ydh").gameObject.SetActive(item.m_Bought != 0);
        }
    }
Пример #19
0
    public void Notify(int panelType)
    {
        if (armorBtn == null)
        {
            armorBtn = GameObject.Find("tab_armor");
        }

        if (weaponBtn == null)
        {
            weaponBtn = GameObject.Find("tab_weapon");
        }

        if (shipinBtn == null)
        {
            shipinBtn = GameObject.Find("tab_shipin");
        }


        if ((panelType & (int)PanelType.Panel_Bag) > 0)
        {
            if (copyItem != null && Instance.m_PanelList.Count != 0 && Instance.m_PanelList.ContainsKey(PanelType.Panel_Bag))
            {
                float bagScrollValue = 0f;

                UIDraggablePanel panel = copyItem.transform.parent.GetComponent <UIDraggablePanel>();
                if (panel != null)
                {
                    if (isFirst)
                    {
                        bagScrollValue = 0;
                        isFirst        = false;
                    }
                    else
                    {
                        bagScrollValue = panel.verticalScrollBar.value;
                    }

                    panel.ResetPosition();
                }

                Hashtable itemTable = sdGameItemMgr.Instance.GetAllItem(1, itemFilter);
                Hashtable list      = Instance.m_PanelList[PanelType.Panel_Bag];
                if (itemTable.Count > list.Count)
                {
                    if (copyItem == null)
                    {
                        Debug.LogWarning("NoCopyItem");
                    }
                    copyItem.SetActive(true);
                    for (int i = list.Count; i < itemTable.Count; ++i)
                    {
                        GameObject tempItem = GameObject.Instantiate(copyItem) as GameObject;
                        tempItem.transform.parent = copyItem.transform.parent;
                        Vector3 pos = copyItem.transform.localPosition;
                        pos.y -= i * 100;
                        tempItem.transform.localPosition = pos;
                        tempItem.transform.localScale    = copyItem.transform.localScale;
                        sdSlotIcon icon = tempItem.GetComponent <sdSlotIcon>();
                        if (icon != null)
                        {
                            icon.index = i;
                            RegisterSlot(icon);
                        }
                    }
                }
                else if (itemTable.Count < list.Count)
                {
                    foreach (DictionaryEntry item in list)
                    {
                        sdSlotIcon icon = item.Value as sdSlotIcon;

                        if (icon != null && icon.index >= itemTable.Count)
                        {
                            if (icon.index == 0)
                            {
                                copyItem.SetActive(false);
                            }
                            else
                            {
                                icon.gameObject.SetActive(false);
                            }
                        }
                    }
                }
                else
                {
                    copyItem.SetActive(true);
                }
                if (panel != null)
                {
                    panel.ResetPosition();
                }
                IDictionaryEnumerator iter = list.GetEnumerator();

                ArrayList itemList = new ArrayList(itemTable.Values);
                if (itemList != null)
                {
                    itemList.Sort();
                    bool needRepos = false;
                    if (itemLocation != HeaderProto.ERoleItemEquipSlot.RoleItemEquipSlot_Equip_Max)
                    {
                        needRepos = true;
                    }

                    foreach (sdGameItem info in itemList)
                    {
                        iter.MoveNext();
                        if (iter == null)
                        {
                            break;
                        }
                        //sdGameItem info = (sdGameItem)item.Value;
                        if (info.bagIndex != (int)PanelType.Panel_Bag)
                        {
                            continue;
                        }
                        //if (info.slotIndex != num) continue;
                        Hashtable  table = new Hashtable();
                        sdSlotIcon icon  = (sdSlotIcon)iter.Value;
                        table.Add("uuid", info.instanceID);
                        table.Add("ID", info.templateID);
                        table.Add("count", info.count);
                        icon.SetInfo(info.instanceID.ToString(), table);
                        icon.gameObject.SetActive(true);
                        if (needRepos && sdConfDataMgr.Instance().IsItemRightType(itemLocation, info.equipPos))
                        {
                            UIDraggablePanel drag = icon.transform.parent.GetComponent <UIDraggablePanel>();
                            if (drag != null)
                            {
                                //drag.disableDragIfFits = false;
                                drag.MoveRelative(-icon.transform.localPosition);
                                drag.UpdateScrollbars(true);
                                bagScrollValue = drag.verticalScrollBar.value;
                                needRepos      = false;
                                itemLocation   = HeaderProto.ERoleItemEquipSlot.RoleItemEquipSlot_Equip_Max;
                                //drag.disableDragIfFits = true;

                                sdRadioButton btn = null;
                                if (itemFilter == (int)ItemFilter.Weapon)
                                {
                                    btn = weaponBtn.GetComponent <sdRadioButton>();
                                }
                                else if (itemFilter == (int)ItemFilter.Armor)
                                {
                                    btn = armorBtn.GetComponent <sdRadioButton>();
                                }
                                else if (itemFilter == (int)ItemFilter.Shipin)
                                {
                                    btn = shipinBtn.GetComponent <sdRadioButton>();
                                }
                                if (btn != null)
                                {
                                    sdUICharacter.Instance.ActiceRadioBtn(btn);
                                    btn.Active(true);
                                }
                            }
                        }
                        else
                        {
                            if (itemFilter == lastFilter)
                            {
                                if (panel != null)
                                {
                                    panel.verticalScrollBar.value = bagScrollValue;
                                }
                            }
                        }
                    }
                }
                lastFilter = itemFilter;
            }
        }

        if ((panelType & (int)PanelType.Panel_Equip) > 0)
        {
            if (Instance.m_PanelList.Count > 0 && Instance.m_PanelList.ContainsKey(PanelType.Panel_Equip))
            {
                Hashtable             list      = Instance.m_PanelList[PanelType.Panel_Equip];
                IDictionaryEnumerator iter      = list.GetEnumerator();
                Hashtable             itemTable = sdGameItemMgr.Instance.GetAllItem(2, -1);
                if (itemTable != null)
                {
                    while (iter.MoveNext())
                    {
                        sdSlotIcon icon = (sdSlotIcon)iter.Value;
                        if (icon == null)
                        {
                            continue;
                        }
                        bool findFlag = false;
                        foreach (DictionaryEntry item in itemTable)
                        {
                            sdGameItem info = (sdGameItem)item.Value;
                            if (info.bagIndex != (int)PanelType.Panel_Equip)
                            {
                                continue;
                            }
                            Hashtable tempItem = sdConfDataMgr.Instance().GetItemById(info.templateID.ToString());
                            if (tempItem != null)
                            {
                                int itemPos = int.Parse(tempItem["Character"].ToString());
                                if (itemPos == icon.index)
                                {
                                    findFlag = true;
                                }
                            }

                            if (findFlag)
                            {
                                Hashtable table = new Hashtable();
                                table.Add("uuid", info.instanceID);
                                table.Add("ID", info.templateID);
                                table.Add("count", info.count);
                                icon.SetInfo(info.instanceID.ToString(), table);
                                break;
                            }
                        }

                        if (!findFlag)
                        {
                            icon.SetInfo("", null);
                        }
                    }
                }
            }
        }
    }