示例#1
0
    public void Init()
    {
        if (m_tab2_all == null)
        {
            GameObject obj;
            obj = GameObject.Find("tab2_all");
            if (obj)
            {
                m_tab2_all = obj.GetComponent <sdRadioButton>();
            }

            obj = GameObject.Find("tab2_armor");
            if (obj)
            {
                m_tab2_armor = obj.GetComponent <sdRadioButton>();
            }

            obj = GameObject.Find("tab2_shipin");
            if (obj)
            {
                m_tab2_shipin = obj.GetComponent <sdRadioButton>();
            }

            obj = GameObject.Find("tab2_weapon");
            if (obj)
            {
                m_tab2_weapon = obj.GetComponent <sdRadioButton>();
            }
        }
    }
示例#2
0
 public void ShowWnd(SelectType type, int SortType)
 {
     btn_OK.onClick.Add(new EventDelegate(OnOK));
     selectNum = 0;
     selectList.Clear();
     if (type == SelectType.ItemSell)
     {
         sellType |= (1 << 1);
         sellPanel.SetActive(true);
         sellPanel.transform.FindChild("btn_sellWhite").FindChild("Background").GetComponent <UISprite>().spriteName = "btn_2dis";
         sellPanel.transform.FindChild("btn_sellWhite").FindChild("effected").GetComponent <UISprite>().spriteName   = "g2";
         sellPanel.transform.FindChild("btn_sellGreen").FindChild("Background").GetComponent <UISprite>().spriteName = "btn_2";
         sellPanel.transform.FindChild("btn_sellGreen").FindChild("effected").GetComponent <UISprite>().spriteName   = "";
         sellPanel.transform.FindChild("btn_sellBlue").FindChild("Background").GetComponent <UISprite>().spriteName  = "btn_2";
         sellPanel.transform.FindChild("btn_sellBlue").FindChild("effected").GetComponent <UISprite>().spriteName    = "";
         sortPanel.SetActive(false);
         moneyPanel.SetActive(true);
     }
     else
     {
         sellPanel.SetActive(false);
         sortPanel.SetActive(true);
         moneyPanel.SetActive(false);
         sdRadioButton btn = sortPanel.transform.FindChild("btn_sortLv").GetComponent <sdRadioButton>();
         btn.Active(true);
         sdUICharacter.Instance.ActiceRadioBtn(btn);
     }
     RefreshItem(type, SortType);
 }
示例#3
0
    public void OnActivePnlSetRadioButton()
    {
        sdRadioButton rb0 = null;
        sdRadioButton rb1 = null;
        sdRadioButton rb2 = null;

        if (rbsel_one)
        {
            rb0 = rbsel_one.GetComponent <sdRadioButton>();
        }
        if (rbsel_two)
        {
            rb1 = rbsel_two.GetComponent <sdRadioButton>();
        }
        if (rbsel_three)
        {
            rb2 = rbsel_three.GetComponent <sdRadioButton>();
        }
        if (mCurTeamIndex == 0)
        {
            rb0.Active(true);
            sdUICharacter.Instance.ActiceRadioBtn(rb0);
        }
        else if (mCurTeamIndex == 1)
        {
            rb1.Active(true);
            sdUICharacter.Instance.ActiceRadioBtn(rb1);
        }
        else if (mCurTeamIndex == 2)
        {
            rb2.Active(true);
            sdUICharacter.Instance.ActiceRadioBtn(rb2);
        }
    }
示例#4
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);
                        }
                    }
                }
            }
        }
    }