コード例 #1
0
ファイル: RecycleList!1.cs プロジェクト: Virobeast2/RCLIENT
    public static RecycleList <T> MakeFromValuedEnumerator <TEnumerator>(ref TEnumerator enumerator) where TEnumerator : struct, IEnumerator <T>
    {
        RecycleList <T> list = RecycleList <T> .Make();

        while (enumerator.MoveNext())
        {
            list.Add((T)enumerator.Current);
        }
        enumerator.Dispose();
        return(list);
    }
コード例 #2
0
ファイル: SceneMapLogic.cs プロジェクト: kimch2/PackageClient
    void Start()
    {
        m_curSceneID = GameManager.gameManager.RunningScene;

        //根据加载场景ID获取场景信息
        m_curTabScene = TableManager.GetSceneClassByID(m_curSceneID, 0);
        if (null == m_curTabScene)
        {
            LogModule.ErrorLog("current is not defined in table: " + m_curSceneID.ToString());
            return;
        }
        // 地图名字
        m_SceneName.text = m_curTabScene.Name;
        // 初始化NPC信息
        if (m_curNPCListScene != GameManager.gameManager.RunningScene)
        {
            m_FriendNPCRecycleList.Clear();
            Dictionary <int, List <Tab_SceneNpc> > curTabSceneNPCDic = TableManager.GetSceneNpc();
            foreach (KeyValuePair <int, List <Tab_SceneNpc> > curPair in curTabSceneNPCDic)
            {
                if (curPair.Value[0] != null && curPair.Value[0].SceneID == GameManager.gameManager.RunningScene)
                {
                    Tab_RoleBaseAttr curRoleBase = TableManager.GetRoleBaseAttrByID(curPair.Value[0].DataID, 0);
                    if (curRoleBase != null && curRoleBase.Camp == 1)
                    {
                        Tab_NianShouNpcScence nianshounpcTab = TableManager.GetNianShouNpcScenceByID(GameManager.gameManager.RunningScene, 0);
                        if (nianshounpcTab != null)
                        {
                            if (curPair.Value[0].GroupID == VillainData.NianShouGroupID)
                            {
                                if (false == GlobalData.IsNianShouOpen())
                                {
                                    continue;
                                }
                            }
                        }

                        Tab_VillainScene VillainSceneTab = TableManager.GetVillainSceneByID(GameManager.gameManager.RunningScene, 0);
                        if (VillainSceneTab != null)
                        {
                            if (curPair.Value[0].GroupID == VillainData.NormalNpcGroupID || curPair.Value[0].GroupID == VillainData.SuperNpcGroupID)
                            {
                                //规则来来回回改变已经第四版,希望这是今年最终版了
                                FriendNPCData newVillainData = m_FriendNPCRecycleList.GetNewItem();
                                newVillainData.m_name  = curRoleBase.Name;
                                newVillainData.m_nType = FRIEND_NPC_TYPE.FRIEND_NPC_VILLAIN_GULDE;
                                newVillainData.m_pos   = new Vector3(curPair.Value[0].PosX, 0, curPair.Value[0].PosZ);
                                m_FriendNPCRecycleList.Add(newVillainData);
                                continue;
                            }
                        }
                        FriendNPCData newData = m_FriendNPCRecycleList.GetNewItem();
                        newData.m_name  = curRoleBase.Name;
                        newData.m_nType = FRIEND_NPC_TYPE.FRIEND_NPC_NORMAL;
                        newData.m_pos   = new Vector3(curPair.Value[0].PosX, 0, curPair.Value[0].PosZ);
                        m_FriendNPCRecycleList.Add(newData);
                    }
                }
            }
            m_curNPCListScene = GameManager.gameManager.RunningScene;
        }

        for (int i = 0; i < m_FriendNPCRecycleList.UsingList().Count; i++)
        {
            if (m_FriendNPCRecycleList.UsingList()[i] != null)
            {
                GameObject newNPCDot = null;
                if (m_FriendNPCRecycleList.UsingList()[i].m_nType == FRIEND_NPC_TYPE.FRIEND_NPC_VILLAIN_GULDE)
                {
                    newNPCDot = GameObject.Instantiate(m_ObjMapNpcForVillain) as GameObject;
                }
                else if (m_FriendNPCRecycleList.UsingList()[i].m_nType == FRIEND_NPC_TYPE.FRIEND_NPC_NORMAL)
                {
                    newNPCDot = GameObject.Instantiate(m_ObjMapNpc) as GameObject;
                }
                if (null != newNPCDot)
                {
                    newNPCDot.transform.parent        = m_MapRoot;
                    newNPCDot.transform.localScale    = Vector3.one;
                    newNPCDot.transform.localPosition = ScenePosToMapPos(m_FriendNPCRecycleList.UsingList()[i].m_pos, m_curTabScene);
                    newNPCDot.SetActive(true);
                }
            }
        }

        for (int i = 0; i < GlobeVar.MAX_TEAM_MEMBER; i++)
        {
            GameObject newNPCDot = GameObject.Instantiate(m_ObjMapDot) as GameObject;
            if (null != newNPCDot)
            {
                newNPCDot.transform.parent     = m_MapRoot;
                newNPCDot.transform.localScale = Vector3.one;
//                UITexture npcTexture = newNPCDot.GetComponent<UITexture>();
                m_ObjMapFriendDotList.Add(newNPCDot.transform);
            }
        }

        if (m_curSceneID == GameDefine_Globe.WORLDBOSS_SCENE_ID && WorldMapWindow.WorldBossOpen == 1)
        {
            m_ObjMapBoss.transform.localPosition = ScenePosToMapPos(new Vector3(GameDefine_Globe.WORLDBOSS_X, 0, GameDefine_Globe.WORLDBOSS_Z), m_curTabScene);
            m_ObjMapBoss.SetActive(true);
        }

        ShowSceneInfo(m_curTabScene);

        if (GameManager.gameManager.ActiveScene.IsCopyScene())
        {
            m_BtnChangeChannel.isEnabled = false;
        }
        else
        {
            m_BtnChangeChannel.isEnabled = true;
        }

        StartCoroutine(UpdateTeamPos());
    }