예제 #1
0
    void SetFilterBtnStates(MapScrollItemType activeBtnType)
    {
        UIToggle  toggle   = null;
        Transform togglets = null;
        bool      visible  = (activeBtnType == MapScrollItemType.NPC);

        if (null != m_btn_npcitem)
        {
            togglets = m_btn_npcitem.transform.Find("Toggle");
            if (null != togglets)
            {
                toggle = togglets.GetComponent <UIToggle>();
                if (null != toggle && (toggle.value != visible))
                {
                    toggle.Set(visible);
                }
            }
        }

        visible = (activeBtnType == MapScrollItemType.Monster);
        if (null != m_btn_monster)
        {
            togglets = m_btn_monster.transform.Find("Toggle");
            if (null != togglets)
            {
                toggle = togglets.GetComponent <UIToggle>();
                if (null != toggle && (toggle.value != visible))
                {
                    toggle.Set(visible);
                }
            }
        }

        visible = (activeBtnType == MapScrollItemType.Transmit);
        if (null != m_btn_transmit)
        {
            togglets = m_btn_transmit.transform.Find("Toggle");
            if (null != togglets)
            {
                toggle = togglets.GetComponent <UIToggle>();
                if (null != toggle && (toggle.value != visible))
                {
                    toggle.Set(visible);
                }
            }
        }
    }
예제 #2
0
    void FilterList(MapScrollItemType type)
    {
        SetFilterBtnStates(type);
        showNpcList.Clear();
        MapDataManager dm = DataManager.Manager <MapDataManager>();

        bShowSmallItem = showDic[type];
        if (type == MapScrollItemType.NPC)
        {
            showNpcList.AddRange(dm.GetNpcList());
        }
        else if (type == MapScrollItemType.Monster)
        {
            showNpcList.AddRange(dm.GetMonsterList());
        }
        else if (type == MapScrollItemType.Transmit)
        {
            showNpcList.AddRange(dm.GetTransmitList());
        }
        foreach (var dic in btnDic)
        {
            Transform btnTrans = dic.Value;
            if (dic.Key == type)
            {
                if (btnTrans != null)
                {
                    btnTrans.gameObject.SetActive(true);
                }
            }
            else
            {
                if (btnTrans != null)
                {
                    btnTrans.gameObject.SetActive(false);
                }
            }
        }
    }
예제 #3
0
    void OnScrollItemClick(GameObject go)
    {
        MapNpcScrollItem item = go.GetComponent <MapNpcScrollItem>();

        if (item != null)
        {
            NPCInfo npcInfo = item.Info;
            if (npcInfo != null)
            {
                MapScrollItemType t = (MapScrollItemType)npcInfo.type;
                if (showDic.ContainsKey(t))
                {
                    bool bShow = showDic[t];
                    showDic[t] = !bShow;
                    MapScrollItemType bigType = MapScrollItemType.NPC | MapScrollItemType.Monster | MapScrollItemType.Transmit;
                    if ((t & bigType) != 0)
                    {
                        FilterList(t);
                    }
                }
                else
                {
                    ClearIcon();
                    Vector3 npcPos = new Vector3(npcInfo.pos.x, 0, -npcInfo.pos.y);
                    AutoFindPath(npcPos, (uint)npcInfo.npcID, true);
                }
            }
            else
            {
                Log.Error("npcinfo is null");
            }
        }
        else
        {
            Log.Error("item is null");
        }
    }
예제 #4
0
    public void InitInfo(Client.NPCInfo info)
    {
        if (null == m_spMaskIcon)
        {
            m_spMaskIcon = transform.Find("MaskIcon").GetComponent <UISprite>();
        }
        m_type  = (MapScrollItemType)info.type;
        npcInfo = info;
        if (info != null)
        {
            Transform labelTrans = transform.Find("Label");
            bool      visible    = RoleStateBarManager.IsEntityHaveHeadIconMask((uint)info.npcID);
            if (null != m_spMaskIcon)
            {
                if (m_spMaskIcon.gameObject.activeSelf != visible)
                {
                    m_spMaskIcon.gameObject.SetActive(visible);
                }

                if (visible)
                {
                    table.NpcHeadMaskDataBase maskDb = RoleStateBarManager.GetNPCHeadMaskDB((uint)info.npcID);
                    if (null != maskDb)
                    {
                        UIManager.GetAtlasAsyn(maskDb.miniMapMaskIcon, ref m_curIconAsynSeed, () =>
                        {
                            if (null != m_spMaskIcon)
                            {
                                m_spMaskIcon.atlas = null;
                            }
                        }, m_spMaskIcon, false);
                    }
                }
            }
            if (labelTrans != null)
            {
                UILabel label = labelTrans.GetComponent <UILabel>();
                if (label != null)
                {
                    string showText = npcInfo.name;
                    if (npcInfo.pos.x != 0 || npcInfo.pos.y != 0)
                    {
                        string levelStr = string.Empty;

                        table.NpcDataBase ndb = GameTableManager.Instance.GetTableItem <table.NpcDataBase>((uint)npcInfo.npcID);
                        if (ndb != null)
                        {
                            if (ndb.dwType == (int)GameCmd.enumNpcType.NPC_TYPE_NONE)
                            {
                                if (ndb.dwMonsterType != 0)
                                {
                                    levelStr = ndb.dwLevel + "级 ";
                                }
                            }
                        }

                        showText = levelStr + npcInfo.name + "(" + npcInfo.pos.x.ToString() + "," + npcInfo.pos.y.ToString() + ")";
                    }
                    label.text = showText;
                }
            }
        }
    }