예제 #1
0
    public void       ReleaseGo(string path, GameObject go, bool retain = true)
    {
        if (string.IsNullOrEmpty(path) || go == null)
        {
            return;
        }

        if (retain == false)
        {
            GameObject.Destroy(go);
            return;
        }

        go.transform.parent = transform;
        CPoolInfo poolInfo = null;

        if (!mPoolDict.TryGetValue(path, out poolInfo))
        {
            poolInfo = new CPoolInfo();
            mPoolDict.Add(path, poolInfo);
        }
        go.SetActive(false);
        go.transform.localPosition = new Vector3(100000, 0, 0);
        poolInfo.quene.Enqueue(go);
    }
예제 #2
0
파일: ConnectFrm.cs 프로젝트: Zantil/Tanji
        private void ModifyAbc(DoABCTag abcTag)
        {
            CPoolInfo constants = abcTag.ABCData.ConstantPool;

            StatusTxt.SetDotAnimation("Squeezing ({0})", abcTag.Name);

            for (int i = 1; i < constants.Strings.Length; i++)
            {
                string constant = constants.Strings[i];
                if (constant.Length > 256 || constant.Length < 2)
                {
                    continue;
                }

                if (constant.Length > 2 && constant.Length < 6)
                {
                    ushort possiblePort = 0;
                    if (ushort.TryParse(constant, out possiblePort))
                    {
                        if (!_possiblePorts.Contains(possiblePort))
                        {
                            _possiblePorts.Add(possiblePort);
                        }

                        if (constant != "10001")
                        {
                            continue;
                        }
                    }
                }

                constants.Strings[i] =
                    ReplaceConstant(constant);
            }
        }
예제 #3
0
    private List <GameObject> mDestroyPoolGameObjects = new List <GameObject>();           //删除队列

    public GameObject GetObject(string path)
    {
        if (string.IsNullOrEmpty(path))
        {
            return(null);
        }
        CPoolInfo  poolInfo = null;
        GameObject obj      = null;

        mPoolDict.TryGetValue(path, out poolInfo);
        if (poolInfo != null)
        {
            if (poolInfo.quene.Count > 0)
            {
                obj = poolInfo.quene.Dequeue();
            }
        }
        if (obj == null)
        {
            obj = GTResourceManager.Instance.Load <GameObject>(path, true);
        }
        if (obj != null)
        {
            obj.transform.parent = null;
            obj.SetActive(true);
        }
        return(obj);
    }