Event() private method

private Event ( string category, string action, string label, int value ) : void
category string
action string
label string
value int
return void
コード例 #1
0
 private void DoBake()
 {
     Analytics.Track("/LightMapper/Start");
     Analytics.Event("LightMapper", "Mode", LightmapSettings.lightmapsMode.ToString(), 1);
     Analytics.Event("LightMapper", "Button", "BakeScene", 1);
     Lightmapping.BakeAsync();
 }
コード例 #2
0
 public static GameObject DropFramesToSceneToCreateGO(Sprite[] frames, Vector3 position)
 {
     if (frames.Length > 0)
     {
         Sprite sprite = frames[0];
         string name   = (!string.IsNullOrEmpty(sprite.name)) ? sprite.name : "Sprite";
         name = GameObjectUtility.GetUniqueNameForSibling(null, name);
         GameObject     gameObject     = new GameObject(name);
         SpriteRenderer spriteRenderer = gameObject.AddComponent <SpriteRenderer>();
         spriteRenderer.sprite         = sprite;
         gameObject.transform.position = position;
         Selection.activeObject        = gameObject;
         if (frames.Length > 1)
         {
             Analytics.Event("Sprite Drag and Drop", "Drop multiple sprites to scene", "null", 1);
             if (!SpriteUtility.CreateAnimation(gameObject, frames))
             {
                 UnityEngine.Object.DestroyImmediate(gameObject);
                 return(null);
             }
         }
         else
         {
             Analytics.Event("Sprite Drag and Drop", "Drop single sprite to scene", "null", 1);
         }
         return(gameObject);
     }
     return(null);
 }
コード例 #3
0
        public static bool HandleSingleSpriteDragIntoHierarchy(IHierarchyProperty property, Sprite sprite, bool perform)
        {
            GameObject gameObject = null;

            if (property != null && property.pptrValue != null)
            {
                UnityEngine.Object pptrValue = property.pptrValue;
                gameObject = (pptrValue as GameObject);
            }
            if (perform)
            {
                Vector3    defaultInstantiatePosition = SpriteUtility.GetDefaultInstantiatePosition();
                GameObject gameObject2 = SpriteUtility.DropSpriteToSceneToCreateGO(sprite, defaultInstantiatePosition);
                if (gameObject != null)
                {
                    Analytics.Event("Sprite Drag and Drop", "Drop single sprite to existing gameobject", "null", 1);
                    gameObject2.transform.parent        = gameObject.transform;
                    gameObject2.transform.localPosition = Vector3.zero;
                }
                else
                {
                    Analytics.Event("Sprite Drag and Drop", "Drop single sprite to empty hierarchy", "null", 1);
                }
                Selection.activeGameObject = gameObject2;
            }
            return(true);
        }
コード例 #4
0
 public static void AddAnimationToGO(GameObject go, Sprite[] frames)
 {
     if ((frames != null) && (frames.Length > 0))
     {
         SpriteRenderer component = go.GetComponent <SpriteRenderer>();
         if (component == null)
         {
             Debug.LogWarning("There should be a SpriteRenderer in dragged object");
             component = go.AddComponent <SpriteRenderer>();
         }
         component.sprite = frames[0];
         if (frames.Length > 1)
         {
             Analytics.Event("Sprite Drag and Drop", "Drop multiple sprites to scene", "null", 1);
             if (!CreateAnimation(go, frames))
             {
                 Debug.LogError("Failed to create animation for dragged object");
             }
         }
         else
         {
             Analytics.Event("Sprite Drag and Drop", "Drop single sprite to scene", "null", 1);
         }
     }
 }
コード例 #5
0
        public static void AddAnimationToGO(GameObject go, Sprite[] frames)
        {
            if (frames == null || frames.Length <= 0)
            {
                return;
            }
            SpriteRenderer spriteRenderer = go.GetComponent <SpriteRenderer>();

            if ((UnityEngine.Object)spriteRenderer == (UnityEngine.Object)null)
            {
                Debug.LogWarning((object)"There should be a SpriteRenderer in dragged object");
                spriteRenderer = go.AddComponent <SpriteRenderer>();
            }
            spriteRenderer.sprite = frames[0];
            if (frames.Length > 1)
            {
                Analytics.Event("Sprite Drag and Drop", "Drop multiple sprites to scene", "null", 1);
                if (SpriteUtility.CreateAnimation(go, (UnityEngine.Object[])frames))
                {
                    return;
                }
                Debug.LogError((object)"Failed to create animation for dragged object");
            }
            else
            {
                Analytics.Event("Sprite Drag and Drop", "Drop single sprite to scene", "null", 1);
            }
        }
コード例 #6
0
        public static bool HandleMultipleSpritesDragIntoHierarchy(IHierarchyProperty property, Sprite[] sprites, bool perform)
        {
            GameObject gameObject = null;

            if (property == null || property.pptrValue == null)
            {
                if (perform)
                {
                    Analytics.Event("Sprite Drag and Drop", "Drop multiple sprites to empty hierarchy", "null", 1);
                    gameObject      = new GameObject();
                    gameObject.name = ((!string.IsNullOrEmpty(sprites[0].name)) ? sprites[0].name : "Sprite");
                    gameObject.transform.position = SpriteUtility.GetDefaultInstantiatePosition();
                }
            }
            else
            {
                UnityEngine.Object pptrValue = property.pptrValue;
                gameObject = (pptrValue as GameObject);
                if (perform)
                {
                    Analytics.Event("Sprite Drag and Drop", "Drop multiple sprites to gameobject", "null", 1);
                }
            }
            if (perform)
            {
                SpriteRenderer spriteRenderer = gameObject.GetComponent <SpriteRenderer>();
                if (spriteRenderer == null)
                {
                    spriteRenderer = gameObject.AddComponent <SpriteRenderer>();
                }
                if (spriteRenderer == null)
                {
                    return(true);
                }
                if (spriteRenderer.sprite == null)
                {
                    spriteRenderer.sprite = sprites[0];
                }
                SpriteUtility.CreateAnimation(gameObject, sprites);
                Selection.activeGameObject = gameObject;
            }
            return(true);
        }