예제 #1
0
    public void SortBasedOnScrollMovement()
    {
        if (!CacheScrollView())
        {
            return;
        }

        // Cache all children and place them in order
        mChildren.Clear();
        for (int i = 0; i < mTrans.childCount; ++i)
        {
            mChildren.Add(mTrans.GetChild(i));
        }

        // Sort the list of children so that they are in order
        if (mHorizontal)
        {
            mChildren.Sort(UIGrid.SortHorizontal);
        }
        else
        {
            mChildren.Sort(UIGrid.SortVertical);
        }
        ResetChildPositions();
    }
예제 #2
0
    public virtual void Reposition()
    {
        if (Application.isPlaying && !this.mInitDone && NGUITools.GetActive(this))
        {
            this.mReposition = true;
            return;
        }
        if (this.sorted)
        {
            this.sorted = false;
            if (this.sorting == UIGrid.Sorting.None)
            {
                this.sorting = UIGrid.Sorting.Alphabetic;
            }
            NGUITools.SetDirty(this);
        }
        if (!this.mInitDone)
        {
            this.Init();
        }
        BetterList <Transform> childList = this.GetChildList();

        if (this.sorting != UIGrid.Sorting.None)
        {
            if (this.sorting == UIGrid.Sorting.Alphabetic)
            {
                childList.Sort(new BetterList <Transform> .CompareFunc(UIGrid.SortByName));
            }
            else if (this.sorting == UIGrid.Sorting.Horizontal)
            {
                childList.Sort(new BetterList <Transform> .CompareFunc(UIGrid.SortHorizontal));
            }
            else if (this.sorting == UIGrid.Sorting.Vertical)
            {
                childList.Sort(new BetterList <Transform> .CompareFunc(UIGrid.SortVertical));
            }
            else if (this.onCustomSort != null)
            {
                childList.Sort(this.onCustomSort);
            }
            else
            {
                this.Sort(childList);
            }
        }
        this.ResetPosition(childList);
        if (this.keepWithinPanel)
        {
            this.ConstrainWithinPanel();
        }
        if (this.onReposition != null)
        {
            this.onReposition();
        }
    }
예제 #3
0
    public void CloseList()
    {
        BetterList <Transform> childList = this.GetChildList();

        if (this.sorting != UIGrid.Sorting.None)
        {
            if (this.sorting == UIGrid.Sorting.Alphabetic)
            {
                childList.Sort(new BetterList <Transform> .CompareFunc(UIGrid.SortByName));
            }
            else if (this.sorting == UIGrid.Sorting.Horizontal)
            {
                childList.Sort(new BetterList <Transform> .CompareFunc(UIGrid.SortHorizontal));
            }
            else if (this.sorting == UIGrid.Sorting.Vertical)
            {
                childList.Sort(new BetterList <Transform> .CompareFunc(UIGrid.SortVertical));
            }
            else if (this.onCustomSort != null)
            {
                childList.Sort(this.onCustomSort);
            }
            else
            {
                this.Sort(childList);
            }
        }
        int i    = 0;
        int size = childList.size;

        while (i < size)
        {
            childList[i].parent = null;
            i++;
        }
        Transform transform = base.transform;
        int       j         = 0;
        int       size2     = childList.size;

        while (j < size2)
        {
            Transform transform2 = childList[j];
            transform2.parent = transform;
            float          z              = transform2.localPosition.z;
            int            num            = (!this.reverse) ? 1 : -1;
            Vector3        pos            = (this.arrangement != UIGrid.Arrangement.Horizontal) ? new Vector3(0f, this.cellHeight * -1f, z) : new Vector3(this.cellWidth * -1f * (float)num, 0f, z);
            SpringPosition springPosition = SpringPosition.Begin(transform2.gameObject, pos, 30f);
            springPosition.updateScrollView = true;
            springPosition.onFinished       = new SpringPosition.OnFinished(this.OnCloseFinish);
            j++;
        }
    }
예제 #4
0
    public static BetterList <UIWidget> Raycast(GameObject root, Vector2 mousePos)
    {
        var list   = new BetterList <UIWidget>();
        var camera = UICamera.FindCameraForLayer(root.layer);

        if (camera != null)
        {
            var cachedCamera = camera.cachedCamera;
            foreach (var widget in root.GetComponentsInChildren <UIWidget>())
            {
                if (NGUIMath.DistanceToRectangle(NGUIMath.CalculateWidgetCorners(widget), mousePos, cachedCamera) == 0f)
                {
                    list.Add(widget);
                }
            }

            if (f__amcache14 == null)
            {
                f__amcache14 = (w1, w2) => w2.mDepth.CompareTo(w1.mDepth);
            }

            list.Sort(f__amcache14);
        }

        return(list);
    }
예제 #5
0
    public void Init(int size, int index)
    {
        if (elements.size == size)
        {
            return;
        }

        foreach (Transform ie in elements)
        {
            GameObject.Destroy(ie.gameObject);
        }
        elements.Clear();

        for (int i = 0; i < size; ++i)
        {
            GameObject obj = GameObject.Instantiate(clone) as GameObject;
            obj.SetActive(true);
            Transform t = obj.transform;
            t.parent = transform;
            elements.Add(t);
        }
        if (sorted)
        {
            elements.Sort(SortByName);
        }

        curIndex  = index;
        lastAngle = -360f / (float)elements.size * (float)curIndex;
    }
예제 #6
0
	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);
		}
	}
예제 #7
0
	/// <summary>
	/// Mark all widgets as having been changed so the draw calls get re-created.
	/// </summary>

	protected override void OnInit ()
	{
		base.OnInit();

		// Apparently having a rigidbody helps
		if (GetComponent<Rigidbody>() == null)
		{
			UICamera uic = (mCam != null) ? mCam.GetComponent<UICamera>() : null;

			if (uic != null)
			{
				if (uic.eventType == UICamera.EventType.UI_3D || uic.eventType == UICamera.EventType.World_3D)
				{
					Rigidbody rb = gameObject.AddComponent<Rigidbody>();
					rb.isKinematic = true;
					rb.useGravity = false;
				}
				// It's unclear if this helps 2D physics or not, so leaving it disabled for now.
				// Note that when enabling this, the 'if (rigidbody == null)' statement above should be adjusted as well.
				//else
				//{
				//    Rigidbody2D rb = gameObject.AddComponent<Rigidbody2D>();
				//    rb.isKinematic = true;
				//}
			}
		}

		FindParent();
		mRebuild = true;
		mAlphaFrameID = -1;
		mMatrixFrame = -1;

		list.Add(this);
		list.Sort(CompareFunc);
	}
예제 #8
0
    public bool PackSprites(BetterList <DynamicSpriteData> sprites)
    {
        sprites.Sort(CompareDynamicSprite);

        int  count    = sprites.size;
        bool can_pack = true;

        for (int i = 0; i < count; i++)
        {
            Texture2D tex = sprites[i].TextureReference;
            if (tex == null)
            {
                continue;
            }

            Rect rect = Insert(tex.width + 2 * DynamicAtlas.DA_PADDING, tex.height + 2 * DynamicAtlas.DA_PADDING, DynamicSpritePacker.FreeRectChoiceHeuristic.RectBestAreaFit);

            if (rect.width != 0 && rect.height != 0)
            {
                sprites[i].x      = Mathf.CeilToInt(rect.x + DynamicAtlas.DA_PADDING);
                sprites[i].y      = Mathf.CeilToInt(rect.y + DynamicAtlas.DA_PADDING);
                sprites[i].width  = tex.width;
                sprites[i].height = tex.height;
            }
            else
            {
                //Debug.LogWarningFormat("PackSprites: Can't pack {0}, x = {1}, y = {2}, width = {3}, height = {4}", tex.name, sprites[i].x, sprites[i].y, tex.width, tex.height);
                can_pack = false;
            }
        }

        Reset();

        return(can_pack);
    }
예제 #9
0
    /// <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();
        }
    }
예제 #10
0
    /// <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);
        }
    }
예제 #11
0
    /// <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 = w.worldCorners;
                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);
    }
예제 #12
0
    private void LateUpdate()
    {
        mUpdateTime = Time.realtimeSinceStartup;
        UpdateTransformMatrix();
        if (mLayer != cachedGameObject.layer)
        {
            mLayer = mGo.layer;
            var camera = UICamera.FindCameraForLayer(mLayer);
            mCam = camera == null?NGUITools.FindCameraForLayer(mLayer) : camera.cachedCamera;

            SetChildLayer(cachedTransform, mLayer);
            var num  = 0;
            var num2 = drawCalls.size;
            while (num < num2)
            {
                mDrawCalls.buffer[num].gameObject.layer = mLayer;
                num++;
            }
        }

        var forceVisible = !cullWhileDragging ? clipping == UIDrawCall.Clipping.None || mCullTime > mUpdateTime : false;
        var num3         = 0;
        var size         = mWidgets.size;

        while (num3 < size)
        {
            var widget = mWidgets[num3];
            if (widget.UpdateGeometry(this, forceVisible) && !mChanged.Contains(widget.material))
            {
                mChanged.Add(widget.material);
            }

            num3++;
        }

        if (mChanged.size != 0)
        {
            onChange?.Invoke();
        }

        if (mDepthChanged)
        {
            mDepthChanged = false;
            mWidgets.Sort(UIWidget.CompareFunc);
        }

        var index = 0;
        var num6  = mChanged.size;

        while (index < num6)
        {
            Fill(mChanged.buffer[index]);
            index++;
        }

        UpdateDrawcalls();
        mChanged.Clear();
    }
예제 #13
0
 public void SortBasedOnScrollMovement()
 {
     if (CacheScrollView())
     {
         mChildren.Clear();
         for (int i = 0; i < mTrans.childCount; i++)
         {
             mChildren.Add(mTrans.GetChild(i));
         }
         if (mHorizontal)
         {
             mChildren.Sort(UIGrid.SortHorizontal);
         }
         else
         {
             mChildren.Sort(UIGrid.SortVertical);
         }
         ResetChildPositions();
     }
 }
예제 #14
0
파일: UIAtlas.cs 프로젝트: icywind/DiceGame
    /// <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);
    }
예제 #15
0
    /// <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);
    }
예제 #16
0
    public BetterList <Transform> GetChildList()
    {
        Transform transform = base.transform;
        BetterList <Transform> betterList = new BetterList <Transform>();

        for (int i = 0; i < transform.childCount; i++)
        {
            Transform child = transform.GetChild(i);
            if (!hideInactive || ((bool)child && NGUITools.GetActive(child.gameObject)))
            {
                betterList.Add(child);
            }
        }
        if (sorting != 0)
        {
            if (sorting == Sorting.Alphabetic)
            {
                betterList.Sort(SortByName);
            }
            else if (sorting == Sorting.Horizontal)
            {
                betterList.Sort(SortHorizontal);
            }
            else if (sorting == Sorting.Vertical)
            {
                betterList.Sort(SortVertical);
            }
            else if (onCustomSort != null)
            {
                betterList.Sort(onCustomSort);
            }
            else
            {
                Sort(betterList);
            }
        }
        return(betterList);
    }
예제 #17
0
    void LateUpdate()
    {
        // add by thomasmeng start --- 2014.08.13
        if (Time.realtimeSinceStartup - mUpdateTime < mUpdateInterval)
        {
            return;
        }
        mUpdateTime = Time.realtimeSinceStartup;

        UpdateTransformMatrix();
        UpdateTransforms();

        // Always move widgets to the panel's layer
        if (mLayer != gameObject.layer)
        {
            mLayer = gameObject.layer;
            UICamera uic = UICamera.FindCameraForLayer(mLayer);
            mCam = (uic != null) ? uic.cachedCamera : NGUITools.FindCameraForLayer(mLayer);
            SetChildLayer(cachedTransform, mLayer);
            for (int i = 0, imax = drawCalls.size; i < imax; ++i)
            {
                mDrawCalls.buffer[i].gameObject.layer = mLayer;
            }
        }

        UpdateWidgets();

        // If the depth has changed, we need to re-sort the widgets
        if (mDepthChanged)
        {
            mDepthChanged = false;
            mWidgets.Sort(UIWidget.CompareFunc);
        }

        // Fill the draw calls for all of the changed materials
        for (int i = 0, imax = mChanged.size; i < imax; ++i)
        {
            Fill(mChanged.buffer[i]);
        }

        // Update the clipping rects
        UpdateDrawcalls();
        mChanged.Clear();
        mRebuildAll = false;

#if UNITY_EDITOR
        mScreenSize = new Vector2(Screen.width, Screen.height);
#endif
    }
예제 #18
0
    void Awake()
    {
        if (pListPrefab == null)
        {
            return;
        }

        UIAtlas atlas = ((GameObject)pListPrefab).GetComponent <UIAtlas>();

        framSprites = atlas.GetListOfSprites();
        framSprites.Sort(sortFrame);
        frameCount = framSprites.size;
        bStop      = !bStartOnAwake;
        fStartTime = Time.time;
    }
예제 #19
0
    /// <summary>
    /// Mark all widgets as having been changed so the draw calls get re-created.
    /// </summary>

    void OnEnable()
    {
        // Apparently having a rigidbody helps
        if (rigidbody == null)
        {
            Rigidbody rb = gameObject.AddComponent <Rigidbody>();
            rb.isKinematic = true;
            rb.useGravity  = false;
        }

        mFindParent = true;
        mRebuild    = true;
        list.Add(this);
        list.Sort(CompareFunc);
    }
예제 #20
0
	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); });
		}
	}
예제 #21
0
파일: UIPanel.cs 프로젝트: troyanich/Test
    /// <summary>
    /// Mark all widgets as having been changed so the draw calls get re-created.
    /// </summary>

    protected override void OnEnable()
    {
        base.OnEnable();

        // Apparently having a rigidbody helps
        if (GetComponent <Rigidbody>() == null)
        {
            Rigidbody rb = gameObject.AddComponent <Rigidbody>();
            rb.isKinematic = true;
            rb.useGravity  = false;
        }

        mRebuild = true;
        list.Add(this);
        list.Sort(CompareFunc);
    }
예제 #22
0
    private void LateUpdate()
    {
        mUpdateTime = Time.realtimeSinceStartup;
        UpdateTransformMatrix();
        if (mLayer != cachedGameObject.layer)
        {
            mLayer = mGo.layer;
            UICamera uICamera = UICamera.FindCameraForLayer(mLayer);
            mCam = uICamera == null?NGUITools.FindCameraForLayer(mLayer) : uICamera.cachedCamera;

            SetChildLayer(cachedTransform, mLayer);
            int i = 0;
            for (int size = drawCalls.size; i < size; i++)
            {
                mDrawCalls.buffer[i].gameObject.layer = mLayer;
            }
        }
        bool forceVisible = !cullWhileDragging && (clipping == UIDrawCall.Clipping.None || mCullTime > mUpdateTime);
        int  j            = 0;

        for (int size2 = mWidgets.size; j < size2; j++)
        {
            UIWidget uIWidget = mWidgets[j];
            if (uIWidget.UpdateGeometry(this, forceVisible) && !mChanged.Contains(uIWidget.material))
            {
                mChanged.Add(uIWidget.material);
            }
        }
        if (mChanged.size != 0 && onChange != null)
        {
            onChange();
        }
        if (mDepthChanged)
        {
            mDepthChanged = false;
            mWidgets.Sort(UIWidget.CompareFunc);
        }
        int k = 0;

        for (int size3 = mChanged.size; k < size3; k++)
        {
            Fill(mChanged.buffer[k]);
        }
        UpdateDrawcalls();
        mChanged.Clear();
    }
예제 #23
0
    void UpdateMainCompressTextureList()
    {
        NGUISettings.mainCompressTextureList.textureList.Clear();

        System.Type         listType = typeof(UICompressTextureList);
        string[]            paths    = AssetDatabase.FindAssets("t:Prefab");
        BetterList <Object> list     = new BetterList <Object>();

        for (int i = 0; i < paths.Length; ++i)
        {
            string path       = paths[i];
            string prefabName = AssetDatabase.GUIDToAssetPath(path);
            Object obj        = AssetDatabase.LoadMainAssetAtPath(prefabName);

            if (obj == null || list.Contains(obj))
            {
                continue;
            }
            if (obj.name == "CompressTextureList")
            {
                continue;
            }

            Object t = (obj as GameObject).GetComponent(listType);
            if (t != null && !list.Contains(t))
            {
                list.Add(t);
            }
        }
        list.Sort(delegate(Object a, Object b) { return(a.name.CompareTo(b.name)); });

        foreach (UICompressTextureList textureList in list)
        {
            foreach (TextureData data in textureList.textureList)
            {
                TextureData d = new TextureData();
                d.Name      = data.Name;
                d.bAlpha    = data.bAlpha;
                d.AlphaName = data.AlphaName;
                NGUISettings.mainCompressTextureList.textureList.Add(d);
            }
        }

        NGUITools.SetDirty(NGUISettings.mainCompressTextureList.gameObject);
        AssetDatabase.SaveAssets();
    }
    /// <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(Vector2 mousePos)
    {
        BetterList <UIWidget> list = new BetterList <UIWidget>();

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

        list.Sort(UIWidget.CompareFunc);
        return(list);
    }
예제 #25
0
    /// <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);
    }
예제 #26
0
파일: UIAtlas.cs 프로젝트: icywind/DiceGame
    /// <summary>
    /// Convenience function that retrieves a list of all sprite names.
    /// </summary>

    public BetterList <string> GetListOfSprites()
    {
        if (mReplacement != null)
        {
            return(mReplacement.GetListOfSprites());
        }
        BetterList <string> list = new BetterList <string>();

        for (int i = 0, imax = sprites.Count; i < imax; ++i)
        {
            Sprite s = sprites[i];
            if (s != null && !string.IsNullOrEmpty(s.name))
            {
                list.Add(s.name);
            }
        }
        list.Sort(CompareString);
        return(list);
    }
예제 #27
0
    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)); });
        }
    }
예제 #28
0
    /// <summary>
    /// Search the entire project for required assets.
    /// </summary>

    void Search()
    {
        mSearched = true;
        string[]            paths       = AssetDatabase.GetAllAssetPaths();
        bool                isComponent = mType.IsSubclassOf(typeof(Component));
        BetterList <Object> list        = new BetterList <Object>();

        for (int i = 0; i < paths.Length; ++i)
        {
            string path = paths[i];

            if (path.EndsWith(".prefab", System.StringComparison.OrdinalIgnoreCase))
            {
                EditorUtility.DisplayProgressBar("Loading", "Searching assets, please wait...", (float)i / paths.Length);
                Object obj = AssetDatabase.LoadMainAssetAtPath(path);
                if (obj == null)
                {
                    continue;
                }

                if (!isComponent)
                {
                    System.Type t = obj.GetType();
                    if (t == mType || t.IsSubclassOf(mType))
                    {
                        list.Add(obj);
                    }
                }
                else if (PrefabUtility.GetPrefabType(obj) == PrefabType.Prefab)
                {
                    Object t = (obj as GameObject).GetComponent(mType);
                    if (t != null)
                    {
                        list.Add(t);
                    }
                }
            }
        }
        list.Sort(delegate(Object a, Object b) { return(a.name.CompareTo(b.name)); });
        mObjects = list.ToArray();
        EditorUtility.ClearProgressBar();
    }
예제 #29
0
    // Token: 0x06000257 RID: 599 RVA: 0x00020794 File Offset: 0x0001E994
    public static BetterList <UIWidget> Raycast(GameObject root, Vector2 mousePos)
    {
        BetterList <UIWidget> betterList = new BetterList <UIWidget>();
        UICamera uicamera = UICamera.FindCameraForLayer(root.layer);

        if (uicamera != null)
        {
            Camera cachedCamera = uicamera.cachedCamera;
            foreach (UIWidget uiwidget in root.GetComponentsInChildren <UIWidget>())
            {
                Vector3[] worldPoints = NGUIMath.CalculateWidgetCorners(uiwidget);
                if (NGUIMath.DistanceToRectangle(worldPoints, mousePos, cachedCamera) == 0f)
                {
                    betterList.Add(uiwidget);
                }
            }
            betterList.Sort((UIWidget w1, UIWidget w2) => w2.depth.CompareTo(w1.depth));
        }
        return(betterList);
    }
예제 #30
0
    /// <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);
    }
예제 #31
0
	/// <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;
	}
예제 #32
0
	/// <summary>
	/// Want your own custom sorting logic? Override this function.
	/// </summary>

	protected virtual void Sort (BetterList<Transform> list) { list.Sort(SortByName); }
예제 #33
0
    /// <summary>
    /// Convenience function that retrieves a list of all sprite names.
    /// </summary>
    public BetterList<string> GetListOfSprites()
    {
        if (mReplacement != null) return mReplacement.GetListOfSprites();
        BetterList<string> list = new BetterList<string>();

        for (int i = 0, imax = sprites.Count; i < imax; ++i)
        {
            Sprite s = sprites[i];
            if (s != null && !string.IsNullOrEmpty(s.name)) list.Add(s.name);
        }
        list.Sort(CompareString);
        return list;
    }
예제 #34
0
    /// <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;
    }
예제 #35
0
		private void generateMoveQueue() {
			BetterList<MoveQueueItem> moveQueue = new BetterList<MoveQueueItem>();
			for(byte i = 0 ; i < this._teams.Length ; i++) {
				BetterList<MoveQueueItem> fmq = _teams[i].futureMoveQueue;
				for(byte c = 0;c<fmq.size;c++) {
					moveQueue.Add(fmq[c]);
				}
			}
			moveQueue.Sort(SortBySpeed);
			Debug.Log("generateMoveQueue()->Move Queue Length is: "+moveQueue.size);
			if(this._moveQueue!=null&&this._moveQueue.size>0) {
				Debug.Log ("I've been told to create a redundant move queue, ignoring");
			} else 
			if(this.onMoveQueueGenerated!=null) {
				this.onMoveQueueGenerated(moveQueue);
			} else {
				Debug.Log ("onMoveQueueGenerated is null!");
			}
		}
예제 #36
0
	/// <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();
		}
	}
	/// <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;
	}
예제 #38
0
    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;
                }
            }

            zonePanelManager.ReorderCustomerList(actualItems);
        }
        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);
                fy = Mathf.Lerp(-maxY * cellHeight, 0f, po.y);
            }
            else
            {
                fx = Mathf.Lerp(0f, maxY * cellWidth, po.x);
                fy = Mathf.Lerp(-maxX * cellHeight, 0f, po.y);
            }

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

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

                SpringPosition sp = t.GetComponent<SpringPosition>();

                if (sp != null)
                {
                    sp.target.x -= fx;
                    sp.target.y -= fy;
                }
                else
                {
                    Vector3 pos = t.localPosition;
                    pos.x -= fx;
                    pos.y -= fy;
                    t.localPosition = pos;
                }
            }
        }

        if (keepWithinPanel && mPanel != null)
            mPanel.ConstrainTargetToBounds(myTrans, true);

        if (onReposition != null)
            onReposition();
    }
예제 #39
0
    /// <summary>
    /// Sort the list when enabled.
    /// </summary>

    void OnEnable()
    {
        list.Add(this); list.Sort(CompareFunc);
    }
	/// <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();
	}
예제 #41
0
	/// <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;
	}
예제 #42
0
    /// <summary>
    /// Returns the object under the specified position.
    /// </summary>

    static public bool Raycast(Vector3 inPos, out RaycastHit hit)
    {
        for (int i = 0; i < list.size; ++i)
        {
            UICamera cam = list.buffer[i];

            // Skip inactive scripts
            if (!cam.enabled || !NGUITools.GetActive(cam.gameObject))
            {
                continue;
            }

            // Convert to view space
            currentCamera = cam.cachedCamera;
            Vector3 pos = currentCamera.ScreenToViewportPoint(inPos);
            if (float.IsNaN(pos.x) || float.IsNaN(pos.y))
            {
                continue;
            }

            // If it's outside the camera's viewport, do nothing
            if (pos.x < 0f || pos.x > 1f || pos.y < 0f || pos.y > 1f)
            {
                continue;
            }

            // Cast a ray into the screen
            Ray ray = currentCamera.ScreenPointToRay(inPos);

            // Raycast into the screen
            int   mask = currentCamera.cullingMask & (int)cam.eventReceiverMask;
            float dist = (cam.rangeDistance > 0f) ? cam.rangeDistance : currentCamera.farClipPlane - currentCamera.nearClipPlane;

            if (cam.eventType == EventType.World)
            {
                if (Physics.Raycast(ray, out hit, dist, mask))
                {
                    hoveredObject = hit.collider.gameObject;
                    return(true);
                }
                continue;
            }
            else if (cam.eventType == EventType.UI)
            {
                RaycastHit[] hits = Physics.RaycastAll(ray, dist, mask);

                if (hits.Length > 1)
                {
                    for (int b = 0; b < hits.Length; ++b)
                    {
                        GameObject go = hits[b].collider.gameObject;
                        mHit.depth = NGUITools.CalculateRaycastDepth(go);

                        if (mHit.depth != int.MaxValue)
                        {
                            mHit.hit = hits[b];
                            mHits.Add(mHit);
                        }
                    }

                    mHits.Sort(delegate(DepthEntry r1, DepthEntry r2) { return(r2.depth.CompareTo(r1.depth)); });

                    for (int b = 0; b < mHits.size; ++b)
                    {
#if UNITY_FLASH
                        if (IsVisible(mHits.buffer[b]))
#else
                        if (IsVisible(ref mHits.buffer[b]))
#endif
                        {
                            hit           = mHits[b].hit;
                            hoveredObject = hit.collider.gameObject;
                            mHits.Clear();
                            return(true);
                        }
                    }
                    mHits.Clear();
                }
                else if (hits.Length == 1 && IsVisible(ref hits[0]))
                {
                    hit           = hits[0];
                    hoveredObject = hit.collider.gameObject;
                    return(true);
                }
                continue;
            }
        }
        hit = mEmpty;
        return(false);
    }
예제 #43
0
	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);
				fy = Mathf.Lerp(-maxY * cellHeight, 0f, po.y);
			}
			else
			{
				fx = Mathf.Lerp(0f, maxY * cellWidth, po.x);
				fy = Mathf.Lerp(-maxX * cellHeight, 0f, po.y);
			}

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

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

				SpringPosition sp = t.GetComponent<SpringPosition>();

				if (sp != null)
				{
					sp.target.x -= fx;
					sp.target.y -= fy;
				}
				else
				{
					Vector3 pos = t.localPosition;
					pos.x -= fx;
					pos.y -= fy;
					t.localPosition = pos;
				}
			}
		}

		if (keepWithinPanel && mPanel != null)
			mPanel.ConstrainTargetToBounds(myTrans, true);

		if (onReposition != null)
			onReposition();
	}
예제 #44
0
	/// <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;
	}
예제 #45
0
	public bool assignMoveAtRandom(int aEvolutionLevel,int aLevel,int aMaxEvolution) {
		BetterList<MoveTreeCompletionDataRow> available = new BetterList<MoveTreeCompletionDataRow>();
		for(int i = 0; i< _items.size ; i++) {
			EMoveTreeUnlockFailureReason couldUnlock = _items[i].canUnlock(aEvolutionLevel,aLevel,aMaxEvolution);
			if(couldUnlock==EMoveTreeUnlockFailureReason.Success) {
				available.Add(_items[i]);
			} else {
			}
		}

		if(available.size>0) {
			available.Sort(MoveTreeCompletionData.SortByMovePoints);
			
			if(unlockTreeItem(available[0].itemRef.ID, aEvolutionLevel, aLevel,aMaxEvolution)) {
				
				return true;
			} 
		}
		return false;
	}