コード例 #1
0
    public static bool AddEntry(string key, GameObject prefab, int prepopulate, int maxCount)
    {
        if (pools.ContainsKey(key))
            return false;

        PoolData data = new PoolData();
        data.prefab = prefab;
        data.maxCount = maxCount;
        data.pool = new Queue<Poolable>(prepopulate);
        pools.Add(key, data);

        for (int i = 0; i < prepopulate; ++i)
            Enqueue( CreateInstance(key, prefab) );

        return true;
    }
コード例 #2
0
        /// <summary>
        /// Crea un nuevo pool.
        /// </summary>
        /// <param name="poolName">Nombre para el pool.</param>
        /// <param name="amount">Cantidad de elementos.</param>
        /// <param name="factoryMethod">Método de creación del objeto.</param>
        /// <param name="disposeMethod">Método de dispose del objeto.</param>
        /// <param name="isDinamyc">Determina si el pool es dinámico o no.</param>
        public void CreatePool(string poolName, int amount, Func <GameObject> factoryMethod, Action <int> disposeMethod, bool isDinamyc = false)
        {
            if (_pools == null)
            {
                _pools = new Dictionary <string, PoolData>();
            }

            PoolData data = new PoolData {
                Pool = new List <GameObject>(), OnFactory = factoryMethod, OnDispose = disposeMethod, IsDinamyc = isDinamyc
            };

            for (int i = 0; i < amount; i++)
            {
                GameObject temp = factoryMethod();
                temp.SetActive(false);

                data.Pool.Add(temp);
            }

            _pools.Add(poolName, data);
        }
コード例 #3
0
    public static bool AddEntry(string key, GameObject prefab, int prepopulateAmount, int maxCount)
    {
        if (_pools.ContainsKey(key))
        {
            return(false);
        }
        var data = new PoolData
        {
            Prefab   = prefab,
            MaxCount = maxCount,
            Pool     = new Queue <Poolable>(prepopulateAmount)
        };

        _pools.Add(key, data);

        for (var i = 0; i < prepopulateAmount; ++i)
        {
            Enqueue(CreateInstance(key, prefab));
        }
        return(true);
    }
コード例 #4
0
        public void Despawn(GameObject gameObject)
        {
            PoolObject poolObject = gameObject.GetComponent <PoolObject>();

            if (poolObject != null)
            {
                if (m_PoolTable.ContainsKey(poolObject.PoolName))
                {
                    PoolData poolData = m_PoolTable[poolObject.PoolName];
                    poolData.Push(poolObject);
                }
                else
                {
                    Debug.LogWarning("[GameObjectPool] Invalid pool name '" + poolObject.PoolName + "'.");
                }
            }
            else
            {
                Debug.LogWarning("[GameObjectPool] GameObject is not a pooled component: " + gameObject.name);
            }
        }
コード例 #5
0
    void MovedTeamBetweenPools(TeamDataDisplay InTeam, int NewPoolIndex)
    {
        for (int PoolIndex = 0; PoolIndex < AllPools.Count; ++PoolIndex)
        {
            PoolData PData = AllPools[PoolIndex].Data;
            for (int TeamIndex = 0; TeamIndex < PData.Teams.Count; ++TeamIndex)
            {
                TeamDataDisplay TData = PData.Teams[TeamIndex];
                if (TData == InTeam)
                {
                    PData.Teams.Remove(TData);
                    PoolIndex = AllPools.Count;
                    break;
                }
            }
        }

        AllPools[NewPoolIndex].Data.Teams.Add(InTeam);

        AllPools[NewPoolIndex].Data.Teams.Sort(TeamSorter);
    }
コード例 #6
0
    private void Start()
    {
        string    name = typeof(DamageText).ToString();
        Transform current_transform = transform;

        GameObject usepool_parent    = new GameObject(name + "UsePool");
        Transform  usepool_transform = usepool_parent.transform;

        use_pool = new PoolData(usepool_parent, usepool_transform);
        use_pool.obj_transform.SetParent(current_transform);
        use_pool.obj_parent.isStatic = true;

        GameObject waitpool_parent    = new GameObject(name + "WaitPool");
        Transform  waitpool_transform = waitpool_parent.transform;

        wait_pool = new PoolData(waitpool_parent, waitpool_transform);
        wait_pool.obj_transform.SetParent(current_transform);
        wait_pool.obj_parent.isStatic = true;

        Allocate();
    }
コード例 #7
0
        /// <summary>
        /// <para>Agrega una entrada nueva.</para>
        /// </summary>
        /// <param name="key"></param>
        /// <param name="prefab"></param>
        /// <param name="puntuacion"></param>
        /// <param name="maxCount"></param>
        /// <returns></returns>
        public static bool AddEntrada(string key, GameObject prefab, int puntuacion, int maxCount)        // Agrega una entrada nueva
        {
            if (pools.ContainsKey(key))
            {
                return(false);
            }

            PoolData data = new PoolData();

            data.prefab   = prefab;
            data.maxCount = maxCount;
            data.pool     = new Queue <Poolable>(puntuacion);
            pools.Add(key, data);

            for (int n = 0; n < puntuacion; n++)
            {
                EnCola(CrearInstanciaPoolable(key, prefab));
            }

            return(true);
        }
コード例 #8
0
    public static bool AddEntry(string key, GameObject prefab, int prepopulate, int maxCount)
    {
        if (pools.ContainsKey(key))
        {
            return(false);
        }

        PoolData data = new PoolData();

        data.prefab   = prefab;
        data.maxCount = maxCount;
        data.pool     = new Queue <Poolable>(prepopulate);
        pools.Add(key, data);

        for (int i = 0; i < prepopulate; ++i)
        {
            Enqueue(CreateInstance(key, prefab));
        }

        return(true);
    }
コード例 #9
0
        public void PoolObject(PoolableObject theObject)
        {
            PoolData thePool = GetPoolByID(theObject.theID);

            //	Remove from Unpooled list

            /*if (thePool.unpooledObjects.Contains (theObject))
             *      thePool.unpooledObjects.Remove (theObject);*/
            for (int i = 0; i < thePool.unpooledObjects.Count; i++)
            {
                if (thePool.unpooledObjects[i].GOInstanceID == theObject.GOInstanceID)
                {
                    thePool.unpooledObjects.RemoveAt(i);
                    break;
                }
            }

            //	Pool is already at max size, destroy the object
            //	TODO: Maybe check if pool is getting too large during update and destroy several at once
            if (thePool.pooledObjects.Count >= thePool.maxSize)
            {
                GameObject.Destroy(theObject.gameObject);
                return;
            }

            //	Set the parent to be the pool container
            Transform objectParent = transform;

            if (thePool.poolContainer != null)
            {
                objectParent = thePool.poolContainer;
            }
            theObject.transform.parent = objectParent;

            //	Add to Pooled list
            thePool.pooledObjects.Add(theObject);
            //	Call the object's specific Pooling functionality
            theObject.Pool();
        }
コード例 #10
0
    void CutPools()
    {
        foreach (PoolDataDisplay pdd in AllPools)
        {
            if (pdd.Data.Teams.Count > PoolCut)
            {
                pdd.Data.Teams.RemoveRange(PoolCut, pdd.Data.Teams.Count - PoolCut);
            }
        }

        InputTeamsText = "";
        for (int PoolIndex = 0; PoolIndex < AllPools.Count; ++PoolIndex)
        {
            PoolData Pool = AllPools[PoolIndex].Data;
            for (int TeamIndex = 0; TeamIndex < Pool.Teams.Count; ++TeamIndex)
            {
                InputTeamsText += Pool.Teams[TeamIndex].Data.PlayerNames + "\n";
            }
        }

        InputTeamsTextChanged = false;
    }
コード例 #11
0
ファイル: Creator.cs プロジェクト: shstyle/object-pool
    /// <summary>
    /// 새로운 풀을 만듭니다.
    /// </summary>
    /// <param name="Prefab"></param>
    /// <param name="Size"></param>
    public void AddPool(GameObject Prefab, int Size = 0)
    {
        if (Prefab == null)
        {
            return;
        }

        for (int i = 0; i < PooledList.Count; i++)
        {
            if (PooledList[i].Prefab == Prefab)
            {
                Debug.LogError("Warning! this prefab already added list.");
                return;
            }
        }

        PoolData poolData = new PoolData();

        poolData.Prefab = Prefab;
        poolData.Size   = Size;
        PooledList.Add(poolData);
    }
コード例 #12
0
        /// <summary>
        /// 获取对象池中的真正对象
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        private object GetObject(Type type)
        {
            lock (_pool)
            {
                if (_pool.Count > 0)
                {
                    if (_pool[0].Obj.GetType() != type)
                    {
                        throw new Exception(string.Format("the Pool Factory only for Type :{0}", _pool[0].Obj.GetType().Name));
                    }
                }

                for (var i = 0; i < _pool.Count; i++)
                {
                    var p = _pool[i];
                    if (!p.InUse)
                    {
                        p.InUse = true;
                        return(p.Obj);
                    }
                }


                if (_pool.Count >= _max && _limit)
                {
                    throw new Exception("max limit is arrived.");
                }

                object obj = Activator.CreateInstance(type, false);
                var    p1  = new PoolData
                {
                    InUse = true,
                    Obj   = obj
                };
                _pool.Add(p1);
                return(obj);
            }
        }
コード例 #13
0
    /// <summary>
    /// Retrieve an instance that it is not being used from an specific pool
    /// </summary>
    /// <returns>The pool instance.</returns>
    /// <param name="poolId">Pool id.</param>
    public PoolInstance retrievePoolInstance(PoolIds poolId)
    {
        PoolData poolData = poolList[poolId];

        //Start from the last instance index and iterate through all the instances
        for (int i = poolData.instanceIndex; i < poolData.instanceIndex + poolData.numInstances; i++)
        {
            int index = (i < poolData.numInstances) ? i : i % poolData.numInstances;
            if (!poolData.instanceList[index].isAlive)
            {
                //Revive the instance and store the index as the last instance used
                poolData.instanceList[index].revive();
                poolData.instanceIndex = index;

                return(poolData.instanceList[index]);
            }
        }

        //If there are no more instances available, resize the pool and log a warning (so we know we need to make the pool bigger)
        resizePoolInstanceList(poolId);
        Debug.LogWarning("There are no instances availables in " + poolId + " (Resizing pool)");

        return(retrievePoolInstance(poolId));
    }
コード例 #14
0
 //TODO: fix summary.
 /// <summary>
 ///
 /// Pool can also be added this way: `new ObjectPool.Pool(poolData: new ObjectPool.PoolData(...))`.
 /// </summary>
 /// <param name="poolData"></param>
 public void AddPool(PoolData poolData) => new Pool(poolData: poolData);
コード例 #15
0
 public PoolDataDisplay()
 {
     Data = new PoolData();
 }
コード例 #16
0
ファイル: ObjectPool.cs プロジェクト: BenjiBoy926/Solymnus
 public ObjectPool(PoolData data, string parentName = "Object Pool")
 {
     InitializeData(data.prefab, parentName);
     InitializePool(data);
 }
コード例 #17
0
 public PoolDataDisplay(PoolData InData)
 {
     Data = new PoolData(InData);
 }
コード例 #18
0
 public Pool(PoolData poolData, Queue <GameObject> objectPoolQueue, Transform poolParent)
 {
     PoolData        = poolData != null ? poolData : throw new ArgumentNullException(nameof(poolData));
     ObjectPoolQueue = objectPoolQueue ?? throw new ArgumentNullException(nameof(objectPoolQueue));
     PoolParent      = poolParent != null ? poolParent : throw new ArgumentNullException(nameof(poolParent));
 }
コード例 #19
0
ファイル: ObjectPool.cs プロジェクト: BenjiBoy926/Solymnus
 // Constructors start the pool off with the number of copies specified by the pool data
 // Focused on statically sized pools that decrease overhead at runtime
 public ObjectPool(PoolData data, Transform parent)
 {
     InitializeData(data.prefab, parent);
     InitializePool(data);
 }
コード例 #20
0
 public PoolData(PoolData InData)
 {
     PoolName = InData.PoolName;
     Teams    = InData.Teams;
 }
コード例 #21
0
 public PooledObject[] GetAllObjects(PoolData data)
 {
     return(GetPool(data).GetAll());
 }
コード例 #22
0
    // Update is called once per frame
    void Update()
    {
        if (bGetRankings)
        {
            RankingsRequest     = new WWW(RankingURL);
            bWaitingForRankings = true;
            bGetRankings        = false;
            FetchStatus         = "Querying Shrednow.com";
        }
        else if (bWaitingForRankings && RankingsRequest.isDone)
        {
            if (RankingsRequest.error != null)
            {
                FetchStatus = RankingsText = RankingsRequest.error;
            }
            else
            {
                RankingsText = Encoding.UTF7.GetString(RankingsRequest.bytes, 0, RankingsRequest.bytes.Length);

                //int RankStartIndex = "<td align=\"center\">".Length;
                string       line    = null;
                StringReader AllText = new StringReader(RankingsText);
                AllPlayers.Clear();
                while ((line = AllText.ReadLine()) != null)
                {
                    // Old Arthur parsing
                    //if (line.StartsWith("<td align=\"center\">"))
                    //{
                    //    PlayerData NewData = new PlayerData();
                    //    int.TryParse(line.Substring(RankStartIndex, line.IndexOf('<', RankStartIndex) - RankStartIndex), out NewData.Rank);
                    //    int StartNameIndex = line.IndexOf("</td><td>") + "</td><td>".Length;
                    //    string LastName = line.Substring(StartNameIndex, line.IndexOf(',', StartNameIndex) - StartNameIndex);
                    //    string FirstName = line.Substring(line.IndexOf(',', StartNameIndex) + 2, line.IndexOf('<', StartNameIndex) - line.IndexOf(',', StartNameIndex) - 2);
                    //    int StartPointsIndex = line.IndexOf("</td><td align=\"center\">", StartNameIndex + FirstName.Length + LastName.Length + 10) +
                    //        "</td><td align=\"center\">".Length;
                    //    float.TryParse(line.Substring(StartPointsIndex, line.IndexOf('<', StartPointsIndex) - StartPointsIndex), out NewData.RankingPoints);

                    //    NameData NewName = NameDatabase.TryAddNewName(FirstName, LastName);
                    //    NewData.NameId = NewName.Id;

                    //    AllPlayers.Add(NewData);
                    //}

                    line = line.Trim();

                    string RankTd = "<td height=19 class=xl6322297 style='height:14.5pt'>";

                    string NameClass   = "xl1522297";
                    string PointsClass = "xl6322297";

                    // New Kolja parsing
                    if (line.StartsWith(RankTd))
                    {
                        PlayerData NewData = new PlayerData();
                        string     rankStr = line.Trim().Replace(RankTd, "");
                        rankStr = rankStr.Replace("</td>", "");
                        int.TryParse(rankStr, out NewData.Rank);
                        AllText.ReadLine();

                        string NameLine           = AllText.ReadLine().Trim().Replace("<td class=" + NameClass + ">", "");
                        int    NameLineCommaIndex = NameLine.IndexOf(',');
                        if (NameLineCommaIndex == -1)
                        {
                            continue;
                        }
                        string   LastName  = NameLine.Substring(0, NameLineCommaIndex);
                        string   FirstName = NameLine.Substring(NameLineCommaIndex + 2, NameLine.Length - LastName.Length - 7);
                        NameData NewName   = NameDatabase.TryAddNewName(FirstName, LastName);
                        NewData.NameId = NewName.Id;

                        AllText.ReadLine();
                        AllText.ReadLine();
                        string PointsLine = AllText.ReadLine().Trim();
                        PointsLine = PointsLine.Replace("<td class=" + PointsClass + ">", "").Replace("</td>", "").Replace(",", ".");
                        float.TryParse(PointsLine, out NewData.RankingPoints);

                        AllPlayers.Add(NewData);
                    }
                }

                RankingsText = "";
                for (int i = 0; i < AllPlayers.Count; ++i)
                {
                    PlayerData Data = AllPlayers[i];
                    RankingsText += NameDatabase.FindInDatabase(Data.NameId).DisplayName + "   " + Data.Rank + "   " + Data.RankingPoints + "\n";
                }

                FetchStatus = "Got " + AllPlayers.Count + " Players Rankings";

                InputTeamsTextChanged = true;
            }

            bWaitingForRankings = false;
        }

        if (InputTeamsTextChanged)
        {
            InputTeamsTextChanged = false;

            ParseTeamsText = "";
            StringReader TeamText = new StringReader(InputTeamsText);
            string       line     = null;
            AllTeams.Clear();
            ErrorList.Clear();
            while ((line = TeamText.ReadLine()) != null)
            {
                TeamData NewTeam = GetTeamFromString(line);
                if (NewTeam != null)
                {
                    AllTeams.Add(NewTeam);
                }
                else
                {
                    char[] BreakCharArray = new char[10];
                    BreakChars.CopyTo(BreakCharArray, 0);
                    string[]  NameArray = line.Split(BreakCharArray);
                    ErrorLine NewError  = new ErrorLine();
                    NewError.OriginalLine = line;
                    foreach (string s in NameArray)
                    {
                        string            NameStr    = s.Trim();
                        List <PlayerData> OutPlayers = new List <PlayerData>();
                        GetPlayersFromString(NameStr, ref OutPlayers);
                        NewError.ErrorList.Add(new ErrorData(NameStr, OutPlayers.Count == 0));
                    }
                    ErrorList.Add(NewError);
                }
            }

            if (bSortTeams)
            {
                AllTeams.Sort(TeamSorter);
            }

            for (int TeamIndex = 0; TeamIndex < AllTeams.Count; ++TeamIndex)
            {
                ParseTeamsText += (TeamIndex + 1) + ". " + AllTeams[TeamIndex].PlayerNames + " : " + AllTeams[TeamIndex].TotalRankPoints + "\n";
            }

            AllPools.Clear();
            if (PoolCount > 0)
            {
                char PoolName = 'A';
                for (int TeamIndex = 0; TeamIndex < AllTeams.Count; ++TeamIndex)
                {
                    if (bSortTeams)
                    {
                        int PoolIndex = TeamIndex % PoolCount;
                        if (PoolIndex >= AllPools.Count)
                        {
                            AllPools.Add(new PoolDataDisplay((PoolName++).ToString()));
                        }

                        AllPools[PoolIndex].Data.Teams.Add(new TeamDataDisplay(AllTeams[TeamIndex]));
                    }
                    else
                    {
                        int TeamsPerPool = AllTeams.Count / PoolCount;
                        int PoolIndex    = TeamIndex / TeamsPerPool;
                        if (PoolIndex >= AllPools.Count)
                        {
                            AllPools.Add(new PoolDataDisplay((PoolName++).ToString()));
                        }

                        AllPools[PoolIndex].Data.Teams.Add(new TeamDataDisplay(AllTeams[TeamIndex]));
                    }
                }
            }

            InputTeamsTextReduced = false;

            //Debug.Log("Parsing pools. Teams: " + AllTeams.Count + "  Pools: " + AllPools.Count);
        }

        if (Input.GetMouseButton(0))
        {
            if (MovingTeam != null)
            {
            }
        }
        else
        {
            if (MovingTeam != null)
            {
                for (int PoolIndex = 0; PoolIndex < AllPools.Count; ++PoolIndex)
                {
                    Vector3 NewMousePos = new Vector3(Input.mousePosition.x, Screen.height - Input.mousePosition.y + ParsedScrollPos.y, 0);
                    if (AllPools[PoolIndex].DisplayRect.Contains(NewMousePos))
                    {
                        MovedTeamBetweenPools(MovingTeam, PoolIndex);
                        break;
                    }
                }
            }

            for (int PoolIndex = 0; PoolIndex < AllPools.Count; ++PoolIndex)
            {
                PoolData PData = AllPools[PoolIndex].Data;
                for (int TeamIndex = 0; TeamIndex < PData.Teams.Count; ++TeamIndex)
                {
                    PData.Teams[TeamIndex].bClickedOn = false;
                }
            }

            MovingTeam = null;
        }
    }
コード例 #23
0
    void OnGUI()
    {
        float SelectButWidth  = Screen.width * .25f;
        float SelectButHeight = Screen.height * .08f;
        float SelectY         = Screen.height * .04f;

        DivisionCombo.Draw(new Rect(20, SelectY, SelectButWidth, SelectButHeight));
        RoundCombo.Draw(new Rect(20 + SelectButWidth + Screen.width * .02f, SelectY, SelectButWidth, SelectButHeight));

        ResultsData RData = TournamentData.FindResultsData(CurDivision, CurRound, CurPool);

        float    InfoY     = Screen.height * .02f + SelectY + SelectButHeight;
        GUIStyle InfoStyle = new GUIStyle("label");

        InfoStyle.fontSize = 30;
        GUIContent TimeDate     = new GUIContent(DateTime.Now.ToString());
        Vector2    TimeDateSize = InfoStyle.CalcSize(TimeDate);

        GUI.Label(new Rect(20, InfoY, TimeDateSize.x, TimeDateSize.y), TimeDate, InfoStyle);

        bool bValidDivisionRoundSettings = Global.AllData.AllDivisions.Length > (int)CurDivision &&
                                           Global.AllData.AllDivisions[(int)CurDivision].Rounds.Length > (int)CurRound;

        if (bValidDivisionRoundSettings)
        {
            RoundData  Round        = Global.AllData.AllDivisions[(int)CurDivision].Rounds[(int)CurRound];
            int        TotalSeconds = bJudging ? (int)(DateTime.Now - RoutineStartTime).TotalSeconds : 0;
            int        Minutes      = Mathf.FloorToInt(TotalSeconds / 60f);
            int        Seconds      = Mathf.FloorToInt(TotalSeconds) % 60;
            int        RoundMinutes = Mathf.FloorToInt(Round.RoutineLengthMinutes);
            int        RoundSeconds = Mathf.FloorToInt(Round.RoutineLengthMinutes * 60) % 60;
            GUIContent RoutineTime  = new GUIContent(String.Format("{0}:{1:00} / {2}:{3:00}", Minutes, Seconds, RoundMinutes, RoundSeconds));
            Vector2    TimeSize     = InfoStyle.CalcSize(RoutineTime);
            GUI.Label(new Rect(Screen.width - 20 - TimeSize.x, InfoY, TimeSize.x, TimeSize.y), RoutineTime, InfoStyle);

            if (TotalSeconds > Round.RoutineLengthMinutes * 60 && !bRoutineTimeElapsed)
            {
                bRoutineTimeElapsed = true;

                // Send ready to livestream
                TeamData finishedTeam = Global.GetTeamData(CurDivision, CurRound, CurPool, CurTeam);
                SendRestMessageAsync(finishedTeam, LiveStream.TeamStates.Finished);
            }
        }

        if (bFestivalJudging)
        {
            float     PoolButWidth  = Screen.width * .09f;
            RoundData Round         = Global.AllData.AllDivisions[(int)CurDivision].Rounds[(int)CurRound];
            GUIStyle  SelectedStyle = new GUIStyle("button");
            SelectedStyle.normal.textColor = Color.green;
            SelectedStyle.hover.textColor  = Color.green;
            SelectedStyle.fontStyle        = FontStyle.Bold;
            GUIStyle ButtonStyle = new GUIStyle("button");
            if (GUI.Button(new Rect(20 + 2f * SelectButWidth + Screen.width * .1f, SelectY, PoolButWidth, SelectButHeight),
                           "Pool: " + Round.Pools[(int)CurFestivalPool].PoolName, CurPool == CurFestivalPool ? SelectedStyle : ButtonStyle))
            {
                SetCurrentPool(CurFestivalPool);
                InitJudgersNameIds();
                ++Global.CurDataState;
            }

            if (GUI.Button(new Rect(20 + 2f * SelectButWidth + Screen.width * .12f + PoolButWidth, SelectY, PoolButWidth, SelectButHeight),
                           "Pool: " + Round.Pools[(int)CurFestivalPool + 2].PoolName, CurPool == CurFestivalPool + 2 ? SelectedStyle : ButtonStyle))
            {
                SetCurrentPool(CurFestivalPool + 2);
                InitJudgersNameIds();
                ++Global.CurDataState;
            }

            if (GUI.Button(new Rect(20 + 2f * SelectButWidth + Screen.width * .14f + 2f * PoolButWidth, SelectY, PoolButWidth, SelectButHeight),
                           "AI Scores", (CurPool > EPool.Max) ? SelectedStyle : ButtonStyle))
            {
                EPool newPool = EPool.None;
                if (CurPool == EPool.A || CurPool == EPool.C)
                {
                    newPool = EPool.PostScoresAC;
                }
                else if (CurPool == EPool.B || CurPool == EPool.D)
                {
                    newPool = EPool.PostScoresBD;
                }
                else
                {
                    switch (CurPool)
                    {
                    case EPool.PostScoresAC:
                        newPool = EPool.PostScoresCA;
                        break;

                    case EPool.PostScoresCA:
                        newPool = EPool.PostScoresAC;
                        break;

                    case EPool.PostScoresBD:
                        newPool = EPool.PostScoresDB;
                        break;

                    case EPool.PostScoresDB:
                        newPool = EPool.PostScoresBD;
                        break;
                    }
                }

                SetCurrentPool(newPool);
                InitJudgersNameIds();
                ++Global.CurDataState;
            }
        }

        #region Teams
        if (!DivisionCombo.IsPicking && !RoundCombo.IsPicking && bValidDivisionRoundSettings)
        {
            Rect LeftRect = new Rect(20, Screen.height * .22f, Screen.width / 2 - 40, Screen.height * .5f);
            if (CurPool == EPool.None && !bFestivalJudging)
            {
                GUILayout.BeginArea(LeftRect);
                PoolsScrollPos = GUILayout.BeginScrollView(PoolsScrollPos);
                GUILayout.BeginVertical();

                RoundData Round = Global.AllData.AllDivisions[(int)CurDivision].Rounds[(int)CurRound];
                if (Round.Pools.Count <= 2)
                {
                    for (int PoolIndex = 0; PoolIndex < Round.Pools.Count; ++PoolIndex)
                    {
                        PoolData Pool     = Round.Pools[PoolIndex];
                        string   PoolText = "";
                        PoolText += Pool.PoolName + "\n";
                        for (int TeamIndex = 0; TeamIndex < Pool.Teams.Count; ++TeamIndex)
                        {
                            TeamData Team = Pool.Teams[TeamIndex].Data;
                            PoolText += (TeamIndex + 1) + ". " + Team.PlayerNames + "\n";
                        }

                        GUIStyle ButtonStyle = new GUIStyle("button");
                        GUIStyle PoolStyle   = new GUIStyle("button");
                        PoolStyle.alignment        = TextAnchor.UpperLeft;
                        PoolStyle.normal.textColor = (EPool)PoolIndex == CurPool ? Color.green : ButtonStyle.normal.textColor;
                        PoolStyle.hover.textColor  = (EPool)PoolIndex == CurPool ? Color.green : ButtonStyle.hover.textColor;
                        PoolStyle.fontStyle        = (EPool)PoolIndex == CurPool ? FontStyle.Bold : ButtonStyle.fontStyle;
                        Vector2 PoolTextSize = PoolStyle.CalcSize(new GUIContent(PoolText));
                        if (GUILayout.Button(PoolText, PoolStyle, GUILayout.Width(LeftRect.width * .9f), GUILayout.Height(PoolTextSize.y)))
                        {
                            SetCurrentPool((EPool)PoolIndex);
                            InitJudgersNameIds();
                            ++Global.CurDataState;
                            bFestivalJudging = false;
                        }
                    }
                }
                else if (Round.Pools.Count == 4)
                {
                    for (int ButIndex = 0; ButIndex < 2; ++ButIndex)
                    {
                        string PoolText = "";

                        for (int PoolIndex = 0; PoolIndex < 2; ++PoolIndex)
                        {
                            PoolData Pool = Round.Pools[2 * PoolIndex + ButIndex];
                            PoolText += Pool.PoolName + "\n";
                            for (int TeamIndex = 0; TeamIndex < Pool.Teams.Count; ++TeamIndex)
                            {
                                TeamData Team = Pool.Teams[TeamIndex].Data;
                                PoolText += (TeamIndex + 1) + ". " + Team.PlayerNames + "\n";
                            }

                            PoolText += "\n";
                        }

                        GUIStyle ButtonStyle = new GUIStyle("button");
                        GUIStyle PoolStyle   = new GUIStyle("button");
                        PoolStyle.alignment        = TextAnchor.UpperLeft;
                        PoolStyle.normal.textColor = ButIndex == (int)CurPool ? Color.green : ButtonStyle.normal.textColor;
                        PoolStyle.hover.textColor  = ButIndex == (int)CurPool ? Color.green : ButtonStyle.hover.textColor;
                        PoolStyle.fontStyle        = ButIndex == (int)CurPool ? FontStyle.Bold : ButtonStyle.fontStyle;
                        Vector2 PoolTextSize = PoolStyle.CalcSize(new GUIContent(PoolText));
                        if (GUILayout.Button(PoolText, PoolStyle, GUILayout.Width(LeftRect.width * .9f), GUILayout.Height(PoolTextSize.y)))
                        {
                            CurFestivalPool  = (EPool)ButIndex;
                            bFestivalJudging = true;
                        }
                    }
                }

                GUILayout.EndVertical();
                GUILayout.EndScrollView();
                GUILayout.EndArea();
            }
            else if (!bFestivalJudging || CurPool != EPool.None)
            {
                float LeftRectWidth = Screen.width * .45f;
                //new Rect(Screen.width - RightRectWidth - 20, AreaRect.y, RightRectWidth, Screen.height - AreaRect.y - 20);
                GUILayout.BeginArea(LeftRect);
                GUILayout.BeginVertical();

                GUIStyle TeamStyle = new GUIStyle("button");
                TeamStyle.fontSize  = 17;
                TeamStyle.alignment = TextAnchor.MiddleLeft;
                GUIStyle        BackStyle = new GUIStyle(TeamStyle);
                List <PoolData> Pools     = Global.AllData.AllDivisions[(int)CurDivision].Rounds[(int)CurRound].Pools;
                if (CurPool >= 0 && (int)CurPool < Pools.Count)
                {
                    for (int TeamIndex = 0; TeamIndex < Pools[(int)CurPool].Teams.Count; ++TeamIndex)
                    {
                        TeamData Data = Pools[(int)CurPool].Teams[TeamIndex].Data;
                        if (Data != null)
                        {
                            GUIContent TeamContent = new GUIContent((TeamIndex + 1) + ". " + Data.PlayerNames);
                            Vector2    TeamSize    = TeamStyle.CalcSize(TeamContent);
                            TeamStyle.fontStyle = TeamIndex == CurTeam ? FontStyle.Bold : FontStyle.Normal;

                            if (!bLockedForJudging)
                            {
                                TeamStyle.normal.textColor = TeamIndex == CurTeam ? Color.green : new GUIStyle("button").normal.textColor;
                                TeamStyle.hover.textColor  = TeamIndex == CurTeam ? Color.green : new GUIStyle("button").hover.textColor;
                            }
                            else
                            {
                                TeamStyle.normal.textColor = TeamIndex == CurTeam ? Color.green : Color.gray;
                                TeamStyle.hover.textColor  = TeamIndex == CurTeam ? Color.green : Color.gray;
                                TeamStyle.active.textColor = TeamIndex == CurTeam ? Color.green : Color.gray;
                            }

                            if (GUILayout.Button(TeamContent, TeamStyle, GUILayout.Width(LeftRectWidth), GUILayout.Height(TeamSize.y)))
                            {
                                if (!bLockedForJudging)
                                {
                                    CurTeam = TeamIndex;
                                    ++Global.CurDataState;
                                }
                            }
                        }
                    }
                }

                GUILayout.Space(Screen.height * .03f);

                GUIContent BackContent = new GUIContent("<- Back To Pool Selection");
                Vector2    BackSize    = BackStyle.CalcSize(BackContent);
                if (GUILayout.Button(BackContent, BackStyle, GUILayout.Width(LeftRectWidth), GUILayout.Height(BackSize.y)))
                {
                    SetCurrentPool(EPool.None);
                    CurTeam          = -1;
                    bFestivalJudging = false;
                }

                GUILayout.EndVertical();
                GUILayout.EndArea();

                // Ready Buttons
                if (CurTeam >= 0)
                {
                    DrawControlButtons();
                }
            }
        }
        else
        {
            SetCurrentPool(EPool.None);
            bFestivalJudging = false;
        }
        #endregion

        #region Judges
        if (CurPool != EPool.None && RData != null)
        {
            Rect RightRect = new Rect(Screen.width * .5f + 20, Screen.height * .22f, Screen.width / 2 - 40, Screen.height * .88f - 20);
            GUILayout.BeginArea(RightRect);
            GUILayout.BeginVertical();

            GUIStyle CatHeaderStyle = new GUIStyle("label");
            CatHeaderStyle.fontSize  = 17;
            CatHeaderStyle.fontStyle = FontStyle.Bold;


            GUILayout.Label("AI Judges:", CatHeaderStyle);
            foreach (int id in RData.AIJudgeIds)
            {
                DrawJudgeLabel(RData, id);
            }
            GUILayout.Label("Ex Judges:", CatHeaderStyle);
            foreach (int id in RData.ExJudgeIds)
            {
                DrawJudgeLabel(RData, id);
            }
            GUILayout.Label("Diff Judges:", CatHeaderStyle);
            foreach (int id in RData.DiffJudgeIds)
            {
                DrawJudgeLabel(RData, id);
            }

            GUILayout.EndVertical();
            GUILayout.EndArea();
        }
        #endregion
    }
コード例 #24
0
 public PoolDataDisplay(string InName)
 {
     Data = new PoolData(); Data.PoolName = InName;
 }
コード例 #25
0
    private void SpawnPools()
    {
        if (!PhotonNetwork.IsConnected)
        {
            return;
        }

        var watch = System.Diagnostics.Stopwatch.StartNew();

        PoolDictionary = new Dictionary <string, Queue <GameObject> >();
        _parent        = new GameObject("Extra");
        _parent.transform.SetParent(transform);

        foreach (var item in Enum.GetValues(typeof(PhotonPool.PoolType)))
        {
            int num = Convert.ToInt32(item);

            _categoryPoolParent = new GameObject(item + "Pools");
            _categoryPoolParent.transform.SetParent(this.transform);

            foreach (var pool in PhotonPools)
            {
                if (pool.size == 0)
                {
                    Debug.LogWarning("You have");
                    return;
                }

                Queue <GameObject> objectPool = new Queue <GameObject>();

                if (num != (int)pool.poolType)
                {
                    continue;
                }

                _poolParent = new GameObject();
                _poolParent.transform.SetParent(_categoryPoolParent.transform);

                for (int i = 0; i < pool.size; i++)
                {
                    if (i >= 0)
                    {
                        switch (pool.poolType)
                        {
                        case PhotonPool.PoolType.Creep:

                            var creep = Instantiate(ObjectToPool(pool), new Vector3(0, 0, 0), Quaternion.identity);
                            PoolData.SetCreepData(creep, pool, _poolParent, objectPool);
                            SetObjectData(creep, pool);

                            break;

                        case PhotonPool.PoolType.Tower:
                            var tower = Instantiate(ObjectToPool(pool), new Vector3(0, 0, 0), Quaternion.identity);
                            PoolData.SetTowerData(tower, pool, _poolParent, objectPool);

                            break;

                        case PhotonPool.PoolType.Object:
                            var obj = Instantiate(ObjectToPool(pool), new Vector3(0, 0, 0), Quaternion.identity);
                            PoolData.SetObjectData(obj, pool, _poolParent, objectPool);

                            break;

                        default:
                            Debug.Log("Empty");
                            break;
                        }
                    }
                    else if (pool.size == 0)
                    {
                        Debug.LogWarning("Some pool sizes are set to 0!");
                    }
                }

                PoolDictionary.Add(pool.Name, objectPool);
                Debug.Log("SpawningPools");
            }
        }

        watch.Stop();
        var elapsedTime = watch.ElapsedMilliseconds;

        PoolsLoaded = true;
        Debug.Log("Total Time To Spawn Pools = " + elapsedTime + " milliseconds");
    }
コード例 #26
0
 private Pool GetPool(PoolData data) => _pools.Find(item => item.Name == data.PoolName);
コード例 #27
0
    private void CreateCharacter(string folderPath, PrefabHolder holder)
    {
        folderPath = "Assets" + folderPath;

        // CLIENT PREFAB

        GameObject clientTemp  = new GameObject();
        GameObject modelClient = CharacterEditorWindow.Instantiate(m_characterModel);

        modelClient.name = m_characterName + " - Idle";
        modelClient.transform.SetParent(clientTemp.transform);
        clientTemp.name  = "Entity_" + m_characterName + "Client";
        clientTemp.layer = LayerMask.NameToLayer("Entity");


        clientTemp.AddComponent <EntityCanvas>();
        clientTemp.AddComponent <EntityBehaviour>();
        NetworkIdentity networkIdentity = clientTemp.GetComponent <NetworkIdentity>();


        BoxCollider boxColliderClient = clientTemp.AddComponent <BoxCollider>();

        boxColliderClient.center    = new Vector3(0, 0.5f, 0);
        boxColliderClient.size      = new Vector3(0.5f, 1, 0.5f);
        boxColliderClient.isTrigger = true;

        var selectedLogicType = m_entityTypesLogics[m_entityLogicChoice];

        System.Type logicType = CharacterEditorWindow.GetType(selectedLogicType);
        Logic       logic     = clientTemp.AddComponent(logicType) as Logic;

        logic.SetMobaEntity(clientTemp);
        networkIdentity.localPlayerAuthority = logic.IsLocalPlayerAuthority();

        EntityTransform modelTransform = modelClient.AddComponent <EntityTransform>();

        modelTransform.EntityTransformType = EEntityTransform.Model;

        GameObject transformLeftHandGOClient = new GameObject();

        transformLeftHandGOClient.name = "Transform_" + EEntityTransform.LeftHand;
        EntityTransform leftHandTransformClient = transformLeftHandGOClient.AddComponent <EntityTransform>();

        leftHandTransformClient.EntityTransformType = EEntityTransform.LeftHand;

        GameObject transformRightHandGOClient = new GameObject();

        transformRightHandGOClient.name = "Transform_" + EEntityTransform.RightHand;
        EntityTransform rightHandTransformClient = transformRightHandGOClient.AddComponent <EntityTransform>();

        rightHandTransformClient.EntityTransformType = EEntityTransform.RightHand;

        GameObject transformCenterGOClient = new GameObject();

        transformCenterGOClient.name = "Transform_" + EEntityTransform.Center;
        EntityTransform centerTransformClient = transformCenterGOClient.AddComponent <EntityTransform>();

        centerTransformClient.EntityTransformType = EEntityTransform.Center;

        GameObject transformCanvasGOClient = new GameObject();

        transformCanvasGOClient.name = "Transform_" + EEntityTransform.Head;
        EntityTransform canvasTransformClient = transformCanvasGOClient.AddComponent <EntityTransform>();

        canvasTransformClient.EntityTransformType = EEntityTransform.Head;

        GameObject transformFloorGOClient = new GameObject();

        transformFloorGOClient.name = "Transform_" + EEntityTransform.Floor;
        EntityTransform floorTransformClient = transformFloorGOClient.AddComponent <EntityTransform>();

        floorTransformClient.EntityTransformType = EEntityTransform.Floor;

        GameObject transformSkyGOClient = new GameObject();

        transformSkyGOClient.name = "Transform_" + EEntityTransform.Sky;
        EntityTransform skyTransformClient = transformSkyGOClient.AddComponent <EntityTransform>();

        skyTransformClient.EntityTransformType = EEntityTransform.Sky;



        transformRightHandGOClient.transform.SetParent(clientTemp.transform);
        transformRightHandGOClient.transform.localPosition = new Vector3(0, 0.5f, 0.25f);
        transformLeftHandGOClient.transform.SetParent(clientTemp.transform);
        transformLeftHandGOClient.transform.localPosition = new Vector3(0, 0.5f, 0.25f);

        transformCenterGOClient.transform.SetParent(clientTemp.transform);
        transformCenterGOClient.transform.localPosition = new Vector3(0, 0.5f, 0);

        transformCanvasGOClient.transform.SetParent(clientTemp.transform);
        transformCanvasGOClient.transform.localPosition = new Vector3(0, 1.3f, 0);

        transformFloorGOClient.transform.SetParent(clientTemp.transform);
        transformSkyGOClient.transform.SetParent(clientTemp.transform);
        transformSkyGOClient.transform.localPosition = new Vector3(0, 5f, 0);


        Debug.Log("Create Client prefab at " + folderPath + "/" + clientTemp.name + ".prefab");
        UnityEngine.Object emptyPrefab  = PrefabUtility.CreateEmptyPrefab(folderPath + "/" + clientTemp.name + ".prefab");
        GameObject         clientPrefab = PrefabUtility.ReplacePrefab(clientTemp, emptyPrefab, ReplacePrefabOptions.ConnectToPrefab);

        CreateCharacterData(clientTemp.GetComponent <Logic>());

        GameObject.DestroyImmediate(GameObject.Find(clientTemp.name));

        // SERVER PREFAB

        GameObject serverTemp  = new GameObject();
        GameObject modelServer = CharacterEditorWindow.Instantiate(m_characterModel);

        modelServer.name = m_characterName + " - Idle";
        modelServer.transform.SetParent(serverTemp.transform);
        serverTemp.name  = "Entity_" + m_characterName;
        serverTemp.layer = LayerMask.NameToLayer("Entity");

        serverTemp.AddComponent <EntityCanvas>();
        serverTemp.AddComponent <EntityBehaviour>();
        NetworkIdentity networkIdentityServer = serverTemp.GetComponent <NetworkIdentity>();

        networkIdentityServer.localPlayerAuthority = true;

        BoxCollider boxColliderServer = serverTemp.AddComponent <BoxCollider>();

        boxColliderServer.center    = new Vector3(0, 0.5f, 0);
        boxColliderServer.size      = new Vector3(0.5f, 1, 0.5f);
        boxColliderServer.isTrigger = true;

        Logic serverLogic = serverTemp.AddComponent(logicType) as Logic;

        serverLogic.SetMobaEntity(serverTemp);
        networkIdentityServer.localPlayerAuthority = serverLogic.IsLocalPlayerAuthority();

        EntityTransform modelServerTransform = modelServer.AddComponent <EntityTransform>();

        modelServerTransform.EntityTransformType = EEntityTransform.Model;

        GameObject transformLeftHandGOServer = new GameObject();

        transformLeftHandGOServer.name = "Transform_" + EEntityTransform.LeftHand;
        EntityTransform leftHandTransformServer = transformLeftHandGOServer.AddComponent <EntityTransform>();

        leftHandTransformServer.EntityTransformType = EEntityTransform.LeftHand;

        GameObject transformRightHandGOServer = new GameObject();

        transformRightHandGOServer.name = "Transform_" + EEntityTransform.RightHand;
        EntityTransform rightHandTransformServer = transformRightHandGOServer.AddComponent <EntityTransform>();

        rightHandTransformServer.EntityTransformType = EEntityTransform.RightHand;

        GameObject transformCenterGOServer = new GameObject();

        transformCenterGOServer.name = "Transform_" + EEntityTransform.Center;
        EntityTransform centerTransformServer = transformCenterGOServer.AddComponent <EntityTransform>();

        centerTransformServer.EntityTransformType = EEntityTransform.Center;

        GameObject transformCanvasGOServer = new GameObject();

        transformCanvasGOServer.name = "Transform_" + EEntityTransform.Head;
        EntityTransform canvasTransformServer = transformCanvasGOServer.AddComponent <EntityTransform>();

        canvasTransformServer.EntityTransformType = EEntityTransform.Head;

        GameObject transformFloorGOServer = new GameObject();

        transformFloorGOServer.name = "Transform_" + EEntityTransform.Floor;
        EntityTransform floorTransformServer = transformFloorGOServer.AddComponent <EntityTransform>();

        floorTransformServer.EntityTransformType = EEntityTransform.Floor;

        GameObject transformSkyGOServer = new GameObject();

        transformSkyGOServer.name = "Transform_" + EEntityTransform.Sky;
        EntityTransform skyTransformServer = transformSkyGOServer.AddComponent <EntityTransform>();

        skyTransformServer.EntityTransformType = EEntityTransform.Sky;

        transformRightHandGOServer.transform.SetParent(serverTemp.transform);
        transformRightHandGOServer.transform.localPosition = new Vector3(0, 0.5f, 0.25f);
        transformLeftHandGOServer.transform.SetParent(serverTemp.transform);
        transformLeftHandGOServer.transform.localPosition = new Vector3(0, 0.5f, 0.25f);

        transformCenterGOServer.transform.SetParent(serverTemp.transform);
        transformCenterGOServer.transform.localPosition = new Vector3(0, 0.5f, 0);

        transformCanvasGOServer.transform.SetParent(serverTemp.transform);
        transformCanvasGOServer.transform.localPosition = new Vector3(0, 1.3f, 0);

        transformFloorGOServer.transform.SetParent(serverTemp.transform);
        transformSkyGOServer.transform.SetParent(serverTemp.transform);
        transformSkyGOServer.transform.localPosition = new Vector3(0, 5f, 0);


        UnityEngine.Object emptyPrefabServer = PrefabUtility.CreateEmptyPrefab(folderPath + "/" + serverTemp.name + ".prefab");
        GameObject         serverPrefab      = PrefabUtility.ReplacePrefab(serverTemp, emptyPrefabServer, ReplacePrefabOptions.ConnectToPrefab);

        GameObject.DestroyImmediate(GameObject.Find(serverTemp.name));

        PoolData clientCharacterPoolData = new PoolData();

        clientCharacterPoolData.m_quantity = 0;
        clientCharacterPoolData.m_register = false;
        clientCharacterPoolData.m_obj      = clientPrefab;

        PoolData serverCharacterPoolData = new PoolData();

        serverCharacterPoolData.m_quantity = 0;
        serverCharacterPoolData.m_register = true;
        serverCharacterPoolData.m_obj      = serverPrefab;

        holder.m_poolDataList.Add(clientCharacterPoolData);
        holder.m_poolDataList.Add(serverCharacterPoolData);

        PrefabUtility.ReplacePrefab(SpawnManager.instance.gameObject, PrefabUtility.GetPrefabParent(SpawnManager.instance), ReplacePrefabOptions.ConnectToPrefab);
    }
コード例 #28
0
 public GameObject GetObject(PoolData data) => GetPool(data).GetObject().gameObject;
コード例 #29
0
ファイル: Missile.cs プロジェクト: twoKitties/Spaceship
 public Missile(PoolData poolData, Transform shipPosition)
 {
     _requestedPoolData = poolData;
     _shipPosition      = shipPosition;
 }
コード例 #30
0
        public void GetPoolData(string fname)
        {
            /*
             * string FileStr = @"人體試驗(IRB)委員會";
             * string FilePat = System.Environment.CurrentDirectory;
             * string FileName = FilePat + @"\" + FileStr + ".xlsx";
             * if (System.IO.File.Exists(FilePat + @"\" + FileStr + ".xlsx"))
             *  this.LB_1.Content = FileStr;
             * else
             *  return;
             */

            if (!System.IO.File.Exists(fname))
            {
                return;
            }
            SLDocument sl = new SLDocument(fname);

            try
            {
                for (int i = 0; i < 50; i++)
                {
                    if (string.IsNullOrEmpty(sl.GetCellValueAsString(i + 3, 1)))
                    {
                        break;
                    }
                    if (string.IsNullOrEmpty(sl.GetCellValueAsString(i + 3, 2)) ||
                        string.IsNullOrEmpty(sl.GetCellValueAsString(i + 3, 3)) ||
                        !Double.TryParse(sl.GetCellValueAsString(i + 3, 13).Trim(), out double points) ||
                        points == 0)
                    {
                        this.TXTB1.Text += "錯誤: "
                                           + System.IO.Path.GetFileNameWithoutExtension(fname) + sl.GetCellValueAsString(i + 3, 2).Trim()
                                           + Environment.NewLine;
                        continue;
                    }
                    PoolData data = new PoolData();
                    data.Room   = sl.GetCellValueAsString(i + 3, 1).Trim();
                    data.Name   = sl.GetCellValueAsString(i + 3, 2).Trim();
                    data.ID     = sl.GetCellValueAsString(i + 3, 3).Trim();
                    data.Points = points;
                    data.Detail.Add(System.IO.Path.GetFileNameWithoutExtension(fname) + " " + data.Points.ToString());

                    if (PDatas.Count > 0)
                    {
                        bool duplicated = false;
                        foreach (var x in PDatas)
                        {
                            if (x.ID == data.ID && x.Name == data.Name)
                            {
                                x.Points += data.Points;
                                x.Detail.Add(data.Detail.FirstOrDefault());
                                duplicated = true;
                                break;
                            }
                        }
                        if (!duplicated)
                        {
                            PDatas.Add(data);
                        }
                    }
                    else
                    {
                        PDatas.Add(data);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            sl.CloseWithoutSaving();

            /*
             * Excel.Application Excel_APP1 = new Excel.Application();
             * Excel.Workbook Excel_WB1 = Excel_APP1.Workbooks.Open(fname);
             * Excel.Worksheet Excel_WS1 = Excel_WB1.Worksheets[1];
             * try
             * {
             *  for (int i = 0; i < 20; i++)
             *  {
             *      if (string.IsNullOrEmpty(Excel_WS1.Cells[i + 3, 1].Value))
             *          break;
             *      PoolData data = new PoolData();
             *      data.Room = Excel_WS1.Cells[i + 3, 1].Value.ToString().Trim();
             *      data.Name = Excel_WS1.Cells[i + 3, 2].Value.ToString().Trim();
             *      data.ID = Excel_WS1.Cells[i + 3, 3].Value.ToString().Trim();
             *      data.Points = Convert.ToDouble(Excel_WS1.Cells[i + 3, 13].Value.ToString());
             *      data.Detial = System.IO.Path.GetFileNameWithoutExtension(fname) + " " + data.Points.ToString() + ";";
             *
             *      if (PDatas.Count > 0)
             *      {
             *          bool duplicated = false;
             *          foreach (var x in PDatas)
             *          {
             *              if (x.ID == data.ID && x.Name == data.Name)
             *              {
             *                  x.Points += data.Points;
             *                  x.Detial += data.Detial;
             *                  duplicated = true;
             *                  break;
             *              }
             *          }
             *          if (!duplicated)
             *              PDatas.Add(data);
             *      }
             *      else
             *          PDatas.Add(data);
             *  }
             *  /*
             *  foreach (var x in PDatas)
             *  {
             *      this.TXTB1.Text += x.ToString() + Environment.NewLine;
             *  }
             */
            /*
             * }
             * catch (Exception ex)
             * {
             * MessageBox.Show(ex.Message);
             * }
             * Excel_WB1.Close();
             * Excel_APP1.Quit();
             */
        }