当前位置: 首页>>代码示例>>C#>>正文


C# BetterList.Sort方法代码示例

本文整理汇总了C#中BetterList.Sort方法的典型用法代码示例。如果您正苦于以下问题:C# BetterList.Sort方法的具体用法?C# BetterList.Sort怎么用?C# BetterList.Sort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BetterList的用法示例。


在下文中一共展示了BetterList.Sort方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: activate

	public void activate(BetterList<RacingAI> aFinishers) {


		this.gameObject.SetActive(true);
		aFinishers.Sort(finishPositionSort);
		int i = 0;
		for(i = 0;i<aFinishers.size;i++) {
			completeMembers[i].init(aFinishers[i],i);
			
			completeMembers[i].gameObject.SetActive(true);
		}
		if(ChampionshipSeason.ACTIVE_SEASON.getTeamFromDriver(completeMembers[0].driver.driverRecord)==ChampionshipSeason.ACTIVE_SEASON.getUsersTeam()) {
			MobileNativeRateUs ratePopUp =  new MobileNativeRateUs("Enjoying Racing Manager?", "Rate us 5 Stars to help with future updates!","5 Stars","Not Right Now","Never!");
			#if UNITY_IOS
				ratePopUp.SetAppleId("975017895");
			#endif
			#if UNITY_ANDROID
				ratePopUp.SetAndroidAppUrl("market://details?id=com.blueomega.gpmanager");
			#endif
			ratePopUp.addEventListener(BaseEvent.COMPLETE,OnRatePopUpClose);
			ratePopUp.Start();
		} 
		for(int c = i;c<completeMembers.Count;c++) {
			completeMembers[i].gameObject.SetActive(false);
		}
	}
开发者ID:cupsster,项目名称:gtmanager,代码行数:26,代码来源:RaceFinisherTable.cs

示例2: OnEnable

	void OnEnable ()
	{
		Dictionary<string, string[]> dict = Localization.dictionary;

		if (dict.Count > 0)
		{
			mKeys = new BetterList<string>();

			foreach (KeyValuePair<string, string[]> pair in dict)
			{
				if (pair.Key == "KEY") continue;
				mKeys.Add(pair.Key);
			}
			mKeys.Sort(delegate (string left, string right) { return left.CompareTo(right); });
		}
	}
开发者ID:jixiang111,项目名称:TTUI-Framework,代码行数:16,代码来源:UILocalizeEditor.cs

示例3: OnDisable

	/// <summary>
	/// It's often useful to be able to tell which keys are used in localization, and which are not.
	/// For this to work properly it's advised to play through the entire game and view all localized content before hitting the Stop button.
	/// </summary>

	void OnDisable ()
	{
		string final = "";
		BetterList<string> full = new BetterList<string>();

		// Create a list of all the known keys
		foreach (KeyValuePair<string, string> pair in mDictionary) full.Add(pair.Key);

		// Sort the full list
		full.Sort(delegate(string s1, string s2) { return s1.CompareTo(s2); });

		// Create the final string with the localization keys
		for (int i = 0; i < full.size; ++i)
		{
			string key = full[i];
			string val = mDictionary[key].Replace("\n", "\\n");
			if (mUsed.Contains(key)) final += key + " = " + val + "\n";
			else final += "//" + key + " = " + val + "\n";
		}
		
		// Show the final report in a format that makes it easy to copy/paste into the original localization file
		if (!string.IsNullOrEmpty(final))
			Debug.Log("// Localization Report\n\n" + final);

		mLocalizationLoaded = false;
		mLanguageIndex = -1;
		mLocalization.Clear();
		mDictionary.Clear();
	}
开发者ID:Jefferson-Henrique,项目名称:fuzzy-char-creation,代码行数:34,代码来源:Localization.cs

示例4: SceneViewRaycast

	/// <summary>
	/// Raycast into the specified panel, returning a list of widgets.
	/// Just like NGUIMath.Raycast, but doesn't rely on having a camera.
	/// </summary>

	static public BetterList<UIWidget> SceneViewRaycast (UIPanel panel, Vector2 mousePos)
	{
		BetterList<UIWidget> list = new BetterList<UIWidget>();

		for (int i = 0; i < UIWidget.list.size; ++i)
		{
			UIWidget w = UIWidget.list[i];
			Vector3[] corners = NGUIMath.CalculateWidgetCorners(w);
			if (SceneViewDistanceToRectangle(corners, mousePos) == 0f)
				list.Add(w);
		}

		list.Sort(delegate(UIWidget w1, UIWidget w2) { return w2.depth.CompareTo(w1.depth); });
		return list;
	}
开发者ID:pShusta,项目名称:TheFellnightPrison,代码行数:20,代码来源:UIWidgetInspector.cs

示例5: Reset

	/// <summary>
	/// Reset all loaded prefabs, collecting default controls instead.
	/// </summary>

	public void Reset ()
	{
		foreach (Item item in mItems) DestroyTexture(item);
		mItems.Clear();

		if (mTab == 0)
		{
			BetterList<string> filtered = new BetterList<string>();
			string[] allAssets = AssetDatabase.GetAllAssetPaths();

			foreach (string s in allAssets)
			{
				if (s.EndsWith(".prefab") && s.Contains("Control -"))
					filtered.Add(s);
			}

			filtered.Sort(string.Compare);
			foreach (string s in filtered) AddGUID(AssetDatabase.AssetPathToGUID(s), -1);
			RectivateLights();
		}
	}
开发者ID:CcUseGitHubLearn,项目名称:UIFrameWork,代码行数:25,代码来源:UIPrefabTool.cs

示例6: Raycast

	/// <summary>
	/// Raycast into the screen and return a list of widgets in order from closest to farthest away.
	/// This is a slow operation and will consider ALL widgets underneath the specified game object.
	/// </summary>

	static public BetterList<UIWidget> Raycast (GameObject root, Vector2 mousePos)
	{
		BetterList<UIWidget> list = new BetterList<UIWidget>();
		UICamera uiCam = UICamera.FindCameraForLayer(root.layer);

		if (uiCam != null)
		{
			Camera cam = uiCam.cachedCamera;
			UIWidget[] widgets = root.GetComponentsInChildren<UIWidget>();

			for (int i = 0; i < widgets.Length; ++i)
			{
				UIWidget w = widgets[i];

				Vector3[] corners = NGUIMath.CalculateWidgetCorners(w);
				if (NGUIMath.DistanceToRectangle(corners, mousePos, cam) == 0f)
					list.Add(w);
			}

			list.Sort(delegate(UIWidget w1, UIWidget w2) { return w2.mDepth.CompareTo(w1.mDepth); });
		}
		return list;
	}
开发者ID:Burnknee,项目名称:IpadApp,代码行数:28,代码来源:UIWidget.cs

示例7: Sort

	/// <summary>
	/// Want your own custom sorting logic? Override this function.
	/// </summary>

	protected virtual void Sort (BetterList<Transform> list) { list.Sort(SortByName); }
开发者ID:GabrielFSilva,项目名称:Colorize,代码行数:5,代码来源:UIGrid.cs

示例8: Reposition

	public virtual void Reposition ()
	{
		if (Application.isPlaying && !mInitDone && NGUITools.GetActive(this))
		{
			mReposition = true;
			return;
		}

		if (!mInitDone) Init();

		mReposition = false;
		Transform myTrans = transform;

		int x = 0;
		int y = 0;
		int maxX = 0;
		int maxY = 0;

		if (sorting != Sorting.None || sorted)
		{
			BetterList<Transform> list = new BetterList<Transform>();

			for (int i = 0; i < myTrans.childCount; ++i)
			{
				Transform t = myTrans.GetChild(i);
				if (t && (!hideInactive || NGUITools.GetActive(t.gameObject))) list.Add(t);
			}

			if (sorting == Sorting.Alphabetic) list.Sort(SortByName);
			else if (sorting == Sorting.Horizontal) list.Sort(SortHorizontal);
			else if (sorting == Sorting.Vertical) list.Sort(SortVertical);
			else Sort(list);

			for (int i = 0, imax = list.size; i < imax; ++i)
			{
				Transform t = list[i];

				if (!NGUITools.GetActive(t.gameObject) && hideInactive) continue;

				float depth = t.localPosition.z;
				Vector3 pos = (arrangement == Arrangement.Horizontal) ?
					new Vector3(cellWidth * x, -cellHeight * y, depth) :
					new Vector3(cellWidth * y, -cellHeight * x, depth);

				if (animateSmoothly && Application.isPlaying)
				{
					SpringPosition.Begin(t.gameObject, pos, 15f).updateScrollView = true;
				}
				else t.localPosition = pos;

				maxX = Mathf.Max(maxX, x);
				maxY = Mathf.Max(maxY, y);

				if (++x >= maxPerLine && maxPerLine > 0)
				{
					x = 0;
					++y;
				}
			}
		}
		else
		{
			for (int i = 0; i < myTrans.childCount; ++i)
			{
				Transform t = myTrans.GetChild(i);

				if (!NGUITools.GetActive(t.gameObject) && hideInactive) continue;

				float depth = t.localPosition.z;
				Vector3 pos = (arrangement == Arrangement.Horizontal) ?
					new Vector3(cellWidth * x, -cellHeight * y, depth) :
					new Vector3(cellWidth * y, -cellHeight * x, depth);

				if (animateSmoothly && Application.isPlaying)
				{
					SpringPosition.Begin(t.gameObject, pos, 15f).updateScrollView = true;
				}
				else t.localPosition = pos;

				maxX = Mathf.Max(maxX, x);
				maxY = Mathf.Max(maxY, y);

				if (++x >= maxPerLine && maxPerLine > 0)
				{
					x = 0;
					++y;
				}
			}
		}

		// Apply the origin offset
		if (pivot != UIWidget.Pivot.TopLeft)
		{
			Vector2 po = NGUIMath.GetPivotOffset(pivot);

			float fx, fy;

			if (arrangement == Arrangement.Horizontal)
			{
				fx = Mathf.Lerp(0f, maxX * cellWidth, po.x);
//.........这里部分代码省略.........
开发者ID:GabrielFSilva,项目名称:Colorize,代码行数:101,代码来源:UIGrid.cs

示例9: Reposition

    public override void Reposition()
    {

        if (Application.isPlaying && !mInitDone && NGUITools.GetActive(this))
        {
            mReposition = true;
            return;
        }

        if (!mInitDone) Init();

        mReposition = false;
        Transform myTrans = transform;

        int x = 0;
        int y = 0;
        int maxX = 0;
        int maxY = 0;

        if (sorting != Sorting.None )
        {


            BetterList<Transform> spotsList = new BetterList<Transform>();

            BetterList<Transform> actualItems = new BetterList<Transform>();

            foreach (Transform childTransform in transform)
            {
                if (childTransform.gameObject.name.Contains("Spot"))
                {

                    //spotsList.Insert(int.Parse(childTransform.gameObject.name.Substring(4, 2) ) - 1, childTransform);
                    spotsList.Add(childTransform);
                }
                else
                {
                    if (childTransform && (!hideInactive || NGUITools.GetActive(childTransform.gameObject))) actualItems.Add(childTransform);
                }
            }


            //Debug.Log(spotsList);   

            //for (int i = 0; i < myTrans.childCount; ++i)
            //{
                
            //    Transform t = myTrans.GetChild(i);
               
            //}

          //SortHorizontal (Transform a, Transform b) { return a.localPosition.x.CompareTo(b.localPosition.x); }

            actualItems.Sort(SortVertical);
            spotsList.Sort(SortVertical);

            //actualItems.Sort(SortQueue);
            
            
            
            
            //if (sorting == Sorting.Alphabetic) list.Sort(SortByName);
            //else if (sorting == Sorting.Horizontal) list.Sort(SortHorizontal);
            //else if (sorting == Sorting.Vertical) list.Sort(SortVertical);
            //else Sort(list);

            //list.Sort({ return list. })

            for (int i = 0, imax = actualItems.size; i < imax; ++i)
            {
                //Transform t = actualItems[actualItems.size - 1 - i];

                Transform t = actualItems[ i];

                if (!NGUITools.GetActive(t.gameObject) && hideInactive) continue;

                float depth = t.localPosition.z;
                //Debug.Log("POSITION NOW ");
                //Vector3 pos = t.parent.InverseTransformPoint(list[i].position);
                Vector3 pos = spotsList[i].localPosition;
                //Vector3 pos = (arrangement == Arrangement.Horizontal) ?
                //    new Vector3(cellWidth * x, -cellHeight * y, depth) :
                //    new Vector3(cellWidth * y, -cellHeight * x, depth);

                if (animateSmoothly && Application.isPlaying)
                {
                    SpringPosition.Begin(t.gameObject, pos, 15f).updateScrollView = true;
                }
                else t.localPosition = pos;

                maxX = Mathf.Max(maxX, x);
                maxY = Mathf.Max(maxY, y);

                if (++x >= maxPerLine && maxPerLine > 0)
                {
                    x = 0;
                    ++y;
                }
            }

//.........这里部分代码省略.........
开发者ID:vorrin,项目名称:store-game,代码行数:101,代码来源:ZoneGrid.cs

示例10: SceneViewRaycast

	/// <summary>
	/// Raycast into the specified panel, returning a list of widgets.
	/// Just like NGUIMath.Raycast, but doesn't rely on having a camera.
	/// </summary>

	static public BetterList<UIWidget> SceneViewRaycast (UIPanel panel, Vector2 mousePos)
	{
		BetterList<UIWidget> list = new BetterList<UIWidget>();
		UIWidget[] widgets = panel.gameObject.GetComponentsInChildren<UIWidget>();

		for (int i = 0; i < widgets.Length; ++i)
		{
			UIWidget w = widgets[i];

			if (w.panel == panel)
			{
				Vector3[] corners = NGUIMath.CalculateWidgetCorners(w);
				if (SceneViewDistanceToRectangle(corners, mousePos) == 0f)
					list.Add(w);
			}
		}

		list.Sort(delegate(UIWidget w1, UIWidget w2) { return w2.depth.CompareTo(w1.depth); });
		return list;
	}
开发者ID:elainerezende,项目名称:Hearthstone,代码行数:25,代码来源:UIWidgetInspector.cs

示例11: GetChildList

	/// <summary>
	/// Get the current list of the grid's children.
	/// </summary>

	public BetterList<Transform> GetChildList()
	{
		Transform myTrans = transform;
		BetterList<Transform> list = new BetterList<Transform>();

		for (int i = 0; i < myTrans.childCount; ++i)
		{
			Transform t = myTrans.GetChild(i);
			if (!hideInactive || (t && NGUITools.GetActive(t.gameObject)))
				list.Add(t);
		}

		// Sort the list using the desired sorting logic
		if (sorting != Sorting.None)
		{
			if (sorting == Sorting.Alphabetic) list.Sort(SortByName);
			else if (sorting == Sorting.Horizontal) list.Sort(SortHorizontal);
			else if (sorting == Sorting.Vertical) list.Sort(SortVertical);
			else if (onCustomSort != null) list.Sort(onCustomSort);
			else Sort(list);
		}
		return list;
	}
开发者ID:Girlbrush,项目名称:tictac9000,代码行数:27,代码来源:UIGrid.cs

示例12: GetListOfSprites

    /// <summary>
    /// Convenience function that retrieves a list of all sprite names that contain the specified phrase
    /// </summary>
    public BetterList<string> GetListOfSprites(string match)
    {
        if (mReplacement != null) return mReplacement.GetListOfSprites();
        BetterList<string> list = new BetterList<string>();

        // First try to find an exact match
        for (int i = 0, imax = sprites.Count; i < imax; ++i)
        {
            Sprite s = sprites[i];

            if (s != null && !string.IsNullOrEmpty(s.name) && string.Equals(match, s.name, StringComparison.OrdinalIgnoreCase))
            {
                list.Add(s.name);
                return list;
            }
        }

        // No exact match found? Split up the search into space-separated components.
        string[] keywords = match.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
        for (int i = 0; i < keywords.Length; ++i) keywords[i] = keywords[i].ToLower();

        // Try to find all sprites where all keywords are present
        for (int i = 0, imax = sprites.Count; i < imax; ++i)
        {
            Sprite s = sprites[i];

            if (s != null && !string.IsNullOrEmpty(s.name))
            {
                string tl = s.name.ToLower();
                int matches = 0;

                for (int b = 0; b < keywords.Length; ++b)
                {
                    if (tl.Contains(keywords[b])) ++matches;
                }
                if (matches == keywords.Length) list.Add(s.name);
            }
        }
        list.Sort(CompareString);
        return list;
    }
开发者ID:kishoreven1729,项目名称:DrMuffinGame,代码行数:44,代码来源:UIAtlas.cs


注:本文中的BetterList.Sort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。