コード例 #1
0
    private bool isClickPushBuilding()
    {
        Dictionary <int, Building> holdBuildingList = GameStatusManager.Instance.MPortStatus.GetHoldBuildingList();

        if (holdBuildingList == null)
        {
            return(false);
        }
        int    buildID          = Globals.Instance.MGameDataManager.MActorData.BuildID;
        int    nnnbuildID       = Globals.Instance.MNpcManager.getCurrentInteractBuildingLogicID();
        string currentBuildName = "";

        PushDataConfig pushConfig = Globals.Instance.MDataTableManager.GetConfig <PushDataConfig>();

        PushDataConfig.PushElement pushElement = new PushDataConfig.PushElement();

        foreach (int key in holdBuildingList.Keys)
        {
            if (key == buildID)
            {
                currentBuildName = holdBuildingList[key].U3DGameObject.name;
                break;
            }
        }

        if (currentBuildName == "")
        {
            return(false);
        }

        foreach (List <PushData> pushDataList in mItemDataListArray.Values)
        {
            foreach (PushData pushData in pushDataList)
            {
                pushConfig.GetItemElement(pushData.pushConfigID, out pushElement);
                if (null != pushElement)
                {
                    for (int i = 0; i < pushElement.PushUIInfoList.Count; i++)
                    {
                        PushDataConfig.PushUIInfo pushUIInfo = pushElement.PushUIInfoList[i];

                        if (pushUIInfo.targetUIName.Contains(currentBuildName))
                        {
                            return(true);
                        }
                    }
                }
            }
        }

        return(false);
    }
コード例 #2
0
    public void RemovePushUI(PushData pushData)
    {
        PushDataConfig pushConfig = Globals.Instance.MDataTableManager.GetConfig <PushDataConfig>();

        PushDataConfig.PushElement pushElement = new PushDataConfig.PushElement();
        Transform targetTran = null;


        pushConfig.GetItemElement(pushData.pushConfigID, out pushElement);
        for (int i = 0; i < pushElement.PushUIInfoList.Count; i++)
        {
            PushDataConfig.PushUIInfo pushUIInfo = pushElement.PushUIInfoList[i];

            if (pushUIInfo.targetUIName.StartsWith(CTbuildingTag))
            {
                string[] keyValues = pushUIInfo.targetUIName.Split(CSpliteTag.ToCharArray());
                targetTran = getBuildingTransform(keyValues[1]);
            }
            else
            {
                targetTran = mRootTran.Find(pushUIInfo.targetUIName);
            }


            string pushStr = pushData.pushConfigID + "PushDataUISprite";
            if (null != targetTran)
            {
                Transform pushObjTransform = targetTran.Find(pushStr);
                if (targetTran != null && pushObjTransform != null)
                {
                    GameObject.DestroyObject(pushObjTransform.gameObject);
                }
            }
        }

        if (mCurrentReadPushTransform != null)
        {
            GameObject.DestroyObject(mCurrentReadPushTransform.gameObject);
            mCurrentReadPushTransform = null;
        }
    }
コード例 #3
0
    public void RefreshPushUI(string uiName = "")
    {
        if (!mTriggerUIList.Contains(uiName))
        {
            return;
        }
        PushDataConfig pushConfig = Globals.Instance.MDataTableManager.GetConfig <PushDataConfig>();

        PushDataConfig.PushElement pushElement = new PushDataConfig.PushElement();
        Transform targetTran = null;

        ///当点击的不是需要推送的建筑的时候,建筑探索功能界面不需要加通知图标 直接返回

        foreach (List <PushData> pushDataList in mItemDataListArray.Values)
        {
            foreach (PushData pushData in pushDataList)
            {
                pushConfig.GetItemElement(pushData.pushConfigID, out pushElement);
                if (null != pushElement)
                {
                    for (int i = 0; i < pushElement.PushUIInfoList.Count; i++)
                    {
                        PushDataConfig.PushUIInfo pushUIInfo = pushElement.PushUIInfoList[i];

                        if (pushUIInfo.targetUIName.StartsWith(CTbuildingTag))
                        {
                            string[] keyValues = pushUIInfo.targetUIName.Split(CSpliteTag.ToCharArray());
                            targetTran = getBuildingTransform(keyValues[1]);
                            string pushStr = pushData.pushConfigID.ToString() + "PushDataUISprite";
                            if (targetTran != null && targetTran.Find(pushStr) == null)
                            {
                                UISprite jianTou = GameObject.Instantiate(PushTipsOverLayers) as UISprite;
                                jianTou.name                       = pushStr;
                                jianTou.transform.parent           = targetTran;
                                jianTou.transform.localPosition    = pushUIInfo.targetUIPosition;
                                jianTou.transform.localEulerAngles = new Vector3(0, 180, 0);
                                jianTou.transform.localScale       = 0.4f * Vector3.one;
                            }
                        }
                        else
                        {
                            if (pushUIInfo.targetUIName.Contains("GUIBuildExplore"))
                            {
                                if (!isClickPushBuilding())
                                {
                                    break;
                                }
                            }
                            if (pushData.pushTime > 0 && Mathf.CeilToInt(Time.time) - pushData.pushTime < 0)
                            {
                                break;
                            }
                            targetTran = mRootTran.Find(pushUIInfo.targetUIName);
                            string pushStr = pushData.pushConfigID.ToString() + "PushDataUISprite";
                            if (targetTran != null && targetTran.Find(pushStr) == null)
                            {
                                UISprite jianTou = GameObject.Instantiate(pushTips) as UISprite;
                                jianTou.name                    = pushStr;
                                jianTou.transform.parent        = targetTran;
                                jianTou.transform.localPosition = pushUIInfo.targetUIPosition;
                                if (pushUIInfo.targetUIName.Contains("GUIMain"))
                                {
                                    jianTou.transform.localScale = new Vector3(1, 1, 1);
                                }
                                else
                                {
                                    jianTou.transform.localScale = new Vector3(1, 1, 1);
                                }
                                //	jianTou.MakePixelPerfect();
                            }
                        }
                    }
                }
            }
        }
    }