// Use this for initialization
 void Start()
 {
     m_Camera = Camera.main;
     m_CameraScript = m_Camera.GetComponent<CameraScript> ();
     m_FogPool = new PoolGameObject (m_BaseFog, 11, this.transform);
     m_FogsInScene = new List<GameObject>();
     m_fTimeLastSpawn = Time.time;
 }
 // Use this for initialization
 void Start()
 {
     m_Camera = Camera.main;
     m_CameraPosition = m_Camera.transform.position;
     m_SpawnOffset =  new Vector3(m_BaseGround.transform.position.x+m_BaseGround.transform.localScale.x,0,0);
     m_GroundPool = new PoolGameObject (m_BaseGround, 3, this.transform);
     m_GroundsInScene = new List<GameObject>();
     PlaceTerrain (m_InitialPosition);
     PlaceTerrain (m_InitialPosition + m_SpawnOffset);
 }
Exemple #3
0
 public override void OnConstruct()
 {
     this.pool = new PoolGameObject <MonoBehaviourView>();
     ME.WeakRef.Reg(this.pool);
 }
Exemple #4
0
 public override void OnDeconstruct()
 {
     this.pool = null;
 }
Exemple #5
0
 public override void OnConstruct()
 {
     this.pool = new PoolGameObject <MonoBehaviourView <TEntity> >();
 }
        private void Init()
        {
            _pool = Core.Instance.get <PoolGameObject>();

            RegisterObjects();
        }
Exemple #7
0
 public void Return(PoolGameObject go)
 {
     internalPool.Return(go);
 }
Exemple #8
0
 public PaintTable(Camera camera)
 {
     m_DrawCamera = camera;
     m_drawerItem = (GameObject)Resources.Load("Prefabs/DrawerPref");
     m_drawerPool = new PoolGameObject(m_drawerItem, 5);
 }
Exemple #9
0
        private void Init()
        {
            _pool = new PoolGameObject(GameObject.Find("Pools").transform);

            RegisterTemplate();
        }
Exemple #10
0
    void Init()
    {
        mTextObject = ObjCachePoolMgr.Instance.LoadFromCache(mPoolType, mPoolKey) as GameObject;
        if (mTextObject == null)
        {
            mTextObject = (GameObject)GameObject.Instantiate(mHudActorWin.TextObj);

            PoolGameObject pg = mTextObject.AddComponent <PoolGameObject>();
            pg.poolType = mPoolType;
            pg.key      = mPoolKey;
        }

        Transform textTrans = mTextObject.transform;

        textTrans.SetParent(mHudActorWin.TextRootTrans);
        textTrans.localPosition = Vector3.zero;
        textTrans.localScale    = mScale;

        // 激活VerticalLayoutGroup
        var layout_trans = textTrans.Find("Layout");

        if (layout_trans != null)
        {
            CommonTool.SetActive(layout_trans.gameObject, true);
            var vert_layout = layout_trans.GetComponent <VerticalLayoutGroup>();
            if (vert_layout != null)
            {
                if (!vert_layout.enabled)
                {
                    vert_layout.enabled = true;
                }
            }
        }

        mTextObject.SetActive(true);
        mTextLabel = UIHelper.FindChild(textTrans, "TextLabel").GetComponent <Text>();
        if (mTextLabel != null)
        {
            mDefaultFontSize = mTextLabel.fontSize;                                                      // 保存默认的字体大小
        }
        mGuildNameTextLabel = UIHelper.FindChild(textTrans, "GuildNameTextLabel").GetComponent <Text>(); //帮派名
        mMateNameTextLabel  = UIHelper.FindChild(textTrans, "MateNameTextLabel").GetComponent <Text>();  //帮派名
        mRankTextLabel      = UIHelper.FindChild(textTrans, "RankTextLabel").GetComponent <Text>();      //排名
        mHangUpTextLabel    = UIHelper.FindChild(textTrans, "HangUpTextLabel").GetComponent <Text>();    //挂机中
        mTextLabel.text     = mTextString;
        mGuildNameTextLabel.gameObject.SetActive(false);
        mMateNameTextLabel.gameObject.SetActive(false);
        mRankTextLabel.gameObject.SetActive(false);
        mHangUpTextLabel.gameObject.SetActive(false);
        mBGSprite          = UIHelper.FindChild(textTrans, "BGSprite").GetComponent <Image>();
        mPreBGSprite       = UIHelper.FindChild(textTrans, "PreBGSprite").GetComponent <Image>();
        mPeakTeamIconImage = UIHelper.FindChild(textTrans, "PeakTeamIconImage").GetComponent <Image>();
        mTeamIconImage     = UIHelper.FindChild(textTrans, "TeamIconImage").GetComponent <Image>();
        mAffiliationPanel  = UIHelper.FindChild(textTrans.gameObject, "AffiliationPanel").transform;
        mHpBar             = UIHelper.FindChild(textTrans.gameObject, "PlayerHpBar").transform;
        mHpBar.gameObject.SetActive(false);
        mHpBarForegroundFillImage = mHpBar.Find("Foreground/Fill Area/Fill").GetComponent <Image>();

        mHonorPanel = UIHelper.FindChild(textTrans, "HonorPanel");
        mHonorPanel.SetActive(false);

        mHonorIcon = UIHelper.FindChild(textTrans, "HonorIcon").GetComponent <Image>();
        mHonorIcon.gameObject.SetActive(true);

        mTitleIcon = UIHelper.FindChild(textTrans, "TitleIcon").GetComponent <Image>();
        mTitleIcon.gameObject.SetActive(false);

        mTitleEffect = mTitleIcon.transform.Find("Effect").GetComponent <RawImage>();
        mTitleEffect.gameObject.SetActive(false);

        m_hpBarScript = mHpBar.gameObject.GetComponent <UIPlayerHpBar>();
        if (m_hpBarScript == null)
        {
            m_hpBarScript = mHpBar.gameObject.AddComponent <UIPlayerHpBar>();
        }

        DialogBubbleParent = UIHelper.FindChild(textTrans.gameObject, "ChatMsgBg").transform;
        DialogBubbleText   = UIHelper.FindChild(textTrans.gameObject, "ChatMsgText").GetComponent <EmojiText>();
        DialogChatMsgArrow = UIHelper.FindChild(textTrans.gameObject, "ChatMsgArrow").transform;
        mButton            = textTrans.Find("Button").GetComponent <Button>();
        mButton.gameObject.SetActive(false);
        mTrans = textTrans;

        mOwnerTrans = transform;

        if (mStyleInfo != null)
        {
            mBGSprite.gameObject.SetActive(mStyleInfo.IsShowBg);
            mPreBGSprite.gameObject.SetActive(mStyleInfo.IsShowBgPreHead);
            mTeamIconImage.gameObject.SetActive(mStyleInfo.IsShowTeamIcon);
            IsShowAffiliationPanel = mStyleInfo.IsShowAffiliationPanel;
        }
        else
        {
            mBGSprite.gameObject.SetActive(false);
            mPreBGSprite.gameObject.SetActive(false);
            IsShowAffiliationPanel = false;
            mTeamIconImage.gameObject.SetActive(false);
        }
        mPeakTeamIconImage.gameObject.SetActive(false);

        mMaxVisibleDistanceSquare = GameConstHelper.GetFloat("GAME_MWAR_ACTOR_HEAD_TEXT_MAX_VISIBLE_DISTANCE_SQUARE");
    }
Exemple #11
0
 public void Return(PoolGameObject go)
 {
     internalPool.Return(go);
 }
Exemple #12
0
 private void Init()
 {
     _pool = Core.Instance.Get <PoolGameObject>();
 }
Exemple #13
0
    //实例化游戏对象
    public static GameObject GetGameObject(string name)
    {
        PoolGameObject poolGameObject = GetPoolGameObject(name);

        return(poolGameObject.GetGameObject(name));
    }
Exemple #14
0
    public GameObject GetPoolGameObject(string nameObject, string tagPool, Vector3 pos)
    {
        GameObject findGO = null;

        PoolGameObject findPoolGO      = null;
        int            contUnlockPools = 0;

        if (PoolGamesObjectsStack.ContainsKey(tagPool))
        {
            contUnlockPools = PoolGamesObjectsStack[tagPool].Count;
            if (contUnlockPools > 0)
            {
                //#TEST
                int countInPool = PoolGamesObjectsStack[tagPool].Count;


                if (countInPool == 1)
                {
                    AddPoolNewTypeObject(tagPool, false);
                }

                findPoolGO     = PoolGamesObjectsStack[tagPool].Pop();
                findPoolGO.Tag = tagPool;//$$$$ //#FIX ELKA

                if (findPoolGO == null)
                {
                    Debug.Log("######## findPoolGO==null");
                }
                if (findPoolGO.GameObjectNext == null)
                {
                    Debug.Log("######## findPoolGO.GameObjectNext==null");
                }
            }
        }

        if (findPoolGO == null)
        {
            //---------------------------- TEST UNLOCk
            if (contUnlockPools > limitPoolOnRemoved)
            {
                if (IsTestingDestroy)
                {
                    Debug.Log("?????? NOT POOL ME:" + nameObject);
                }

                #region test pool limit
                //Debug.Log("%%%%%%%%%%%%%% LIMIT " + PoolGamesObjects.Count + " > " + limitPoolOnRemoved + " " + nameObject);

                //if (tag == "PrefabBoss")
                //{
                //-----------------
                //%%% CREANER %%%%

                //if (IsTestingDestroy)
                //{
                //    int countBoss = PoolGamesObjects.Where(p => p.Tag == "PrefabBoss").Count();
                //    Debug.Log("COUNT POOL BOSS: " + countBoss + @" \ " + limitPoolOnRemovedBoss + "     ME:" + nameObject);
                //    if (countBoss > limitPoolOnRemovedBoss)
                //    {
                //        //var destroyedBoss = PoolGamesObjects.Where(p => p.Tag == "PrefabBoss" && p.IsLock && p.GameObjectNext == null).ToList();
                //        //if (destroyedBoss.Count != 0)
                //        //    Debug.Log("COUNT POOL BOSS DESTROYED >>>> : " + destroyedBoss.Count());
                //        var destroyedPrefabs = PoolGamesObjects.Where(p => p.IsLock && p.GameObjectNext == null).ToList();
                //        //if (destroyedPrefabs.Count != 0 && destroyedBoss.Count != destroyedPrefabs.Count)
                //        if (destroyedPrefabs.Count != 0)
                //            Debug.Log("COUNT POOL DESTROYED >>>> : " + destroyedPrefabs.Count());

                //        //foreach (var item in destroyedPrefabs)
                //        for (int ind = 0; ind < destroyedPrefabs.Count; ind++)
                //        {
                //            PoolGamesObjects.RemoveAt(ind);
                //        }
                //    }
                //}
                //-----------------
                //}
                #endregion
            }
            //----------------------------

            findPoolGO = AddPoolNewTypeObject(tagPool);
        }

        //#FIX ELKA
        //findPoolGO.Tag = tagPool;

        findPoolGO.Activate(nameObject, tagPool, pos);
        findGO = findPoolGO.GameObjectNext;

        //---------------
        EventsObject evenObj = findGO.GetComponent <EventsObject>();
        if (evenObj != null)
        {
            if (findPoolGO == null)
            {
                Debug.Log("#######  GetPoolGameObject   findPoolGO is null " + findGO.name);
            }
            evenObj.PoolCase = findPoolGO;
        }
        else
        {
            Debug.Log("#######  GetPoolGameObject   NOT EventsObject " + findGO.name);
        }

        if (IsTestingDestroy)
        {
            if (findGO == null)
            {
                Debug.Log("###########///////////// Pool contrains null object");
            }
        }

        return(findGO);
    }