Esempio n. 1
0
        public void SetData(UListComponentItemDataPopup newData)
        {
            this.ItemTypeName.text = newData.ItemTypeName;


            if (newData.ItemChildItems == null || newData.ItemChildItems.Count <= 0)
            {
                this.onClick.AddListener(newData.ClearPopupMenuAction);
                this.onClick.AddListener(newData.ItemSelectedAction);
                if (this.ItemSubMenuImage != null)
                {
                    this.ItemSubMenuImage.gameObject.SetActive(false);
                }
            }
            else
            {
                if (this.ItemSubMenuImage != null)
                {
                    this.ItemSubMenuImage.gameObject.SetActive(true);
                }
            }

            if (this.ItemTypeImage != null)
            {
                this.ItemTypeImage.sprite = newData.ItemPopupSprite;
                this.ItemTypeImage.gameObject.SetActive(newData.ItemPopupSprite == null ? false : true);
            }


            if (newData.ItemInteractable)
            {
                this.targetGraphic = ItemBG;
            }
            else
            {
                this.targetGraphic = ItemTypeName;
            }
            //DoStateTransition(this.currentSelectionState, true);

            this.interactable = newData.ItemInteractable;

            this.ItemData = newData;
        }
            public virtual void addPopupMenu()
            {
                UPopupAction popupAction = new UPopupAction();

                DataCenter.SNSDataManager.BuddyInfo buddy = LogicDataCenter.snsDataManager.getBuddyInfoByUserID(m_Component.Item.nUserID);
                bool isSameWorld = LogicDataCenter.snsDataManager.isSameGameWorld(buddy.Info.nUserID);

                popupAction.Add(UPopupItemDataBuddyChat.GetDescString(), new UPopupItemDataBuddyChat(buddy.Info.nUserID));
                if (isSameWorld)
                {
                    if (buddy.Info.nStatus != (int)ACTOR_GAME_STATE.GAME_STATE_OFFLINE)
                    {
                        popupAction.Add(UPopupItemDataTeamRequest.GetDescString(), new UPopupItemDataTeamRequest((int)buddy.Info.dwPdbID));
                        popupAction.Add(UPopupItemDataTeamInvite.GetDescString(), new UPopupItemDataTeamInvite((int)buddy.Info.dwPdbID));
                    }
                    popupAction.Add(UPopupItemDataGetPlayerDetail.GetDescString(), new UPopupItemDataGetPlayerDetail((int)buddy.Info.dwPdbID));
                    //popupAction.Add(UPopupItemDataRequestJoinBuddyKin.GetDescString(), new UPopupItemDataRequestJoinBuddyKin((int)buddy.Info.dwPdbID));
                    popupAction.Add(UPopupItemDataKinInvite.GetDescString(), new UPopupItemDataKinInvite((int)buddy.Info.dwPdbID));
                }
                if (buddy.Info.nStatus != (int)ACTOR_GAME_STATE.GAME_STATE_OFFLINE)
                {
                    popupAction.Add(UPopupItemDataPrivateChat.GetDescString(), new UPopupItemDataPrivateChat(buddy.Info.szName));
                    if (GameLogicAPI.isMainMap((int)buddy.Info.dwSceneID))
                    {
                        popupAction.Add(UPopupItemDataTransmitTo.GetDescString(), new UPopupItemDataTransmitTo(buddy.Info.dwWorldID, buddy.Info.dwServerID, buddy.Info.dwSceneID));
                    }
                }
                popupAction.Add(UPopupItemDataDelBuddy.GetDescString(), new UPopupItemDataDelBuddy(buddy.Info.nUserID, buddy.Info.szName));
                popupAction.Add(UPopupItemDataUpdateRemark.GetDescString(), new UPopupItemDataUpdateRemark(buddy.Info.nUserID, buddy.Info.szName));

                // 移动好友到分组
                UListComponentItemDataPopup popupItem      = new UListComponentItemDataPopup(_actionSelected: null, _listChildItems: new List <UListComponentItemDataPopupBase>());
                Dictionary <int, string>    buddyGroupList = new Dictionary <int, string>();
                int nValidBuddyGroupCount = 0;

                foreach (var item in LogicDataCenter.snsDataManager.getBuddyGroupList())
                {
                    if (item.Info.nBuddyGroupID == (int)EMSNS_BUDDYGROUP_ID.EMSNS_BUDDYGROUP_ID_BLACKLIST ||
                        item.Info.nBuddyGroupID == (int)EMSNS_BUDDYGROUP_ID.EMSNS_BUDDYGROUP_ID_LastPlaying ||
                        item.Info.nBuddyGroupID == (int)EMSNS_BUDDYGROUP_ID.EMSNS_BUDDYGROUP_ID_NEARBY)
                    {
                        continue;
                    }
                    if (item.Info.nBuddyGroupID == LogicDataCenter.snsDataManager.getBuddyGroupID(buddy.Info.nUserID))
                    {
                        continue;
                    }
                    popupItem.ItemChildItems.Add(new UPopupItemDataChangeBuddyGroup(buddy.Info.nUserID, item.Info.nBuddyGroupID, _strItemTypeName: item.Info.szBuddyGroupName));

                    nValidBuddyGroupCount++;
                }
                if (nValidBuddyGroupCount > 0)
                {
                    popupAction.Add(ULocalizationService.Instance.Get("UIView", "PopupMenu", "ChangeBuddyGroup"), popupItem);
                }

                popupAction.Add(UPopupItemDataAddBlackList.GetDescString(), new UPopupItemDataAddBlackList(buddy.Info.nUserID, buddy.Info.szName));


                m_Component.popupMenuHandle.HandlePopupAction = popupAction;
            }