Знаете ли вы что...

Знаете ли вы что...

Сообщение DbIMok 08 апр 2010, 12:58

код из "обертки" к движку. цель - чтобы знали что там внутри и модифицировали под свои нужды.
Синтаксис:
Используется csharp
public struct Vector3
{
  public const float kEpsilon = 1E-05f;
  public float x;
  public float y;
  public float z;
  public Vector3(float x, float y, float z)
  {
    this.x = x;
    this.y = y;
    this.z = z;
  }

  public Vector3(float x, float y)
  {
    this.x = x;
    this.y = y;
    this.z = 0f;
  }

  public static Vector3 Lerp(Vector3 from, Vector3 to, float t)
  {
    t = Mathf.Clamp01(t);
    return new Vector3(from.x + ((to.x - from.x) * t), from.y + ((to.y - from.y) * t), from.z + ((to.z - from.z) * t));
  }

  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern Vector3 Slerp(Vector3 from, Vector3 to, float t);
  [MethodImpl(MethodImplOptions.InternalCall)]
  private static extern void Internal_OrthoNormalize2(ref Vector3 a, ref Vector3 b);
  [MethodImpl(MethodImplOptions.InternalCall)]
  private static extern void Internal_OrthoNormalize3(ref Vector3 a, ref Vector3 b, ref Vector3 c);
  public static void OrthoNormalize(ref Vector3 normal, ref Vector3 tangent)
  {
    Internal_OrthoNormalize2(ref normal, ref tangent);
  }

  public static void OrthoNormalize(ref Vector3 normal, ref Vector3 tangent, ref Vector3 binormal)
  {
    Internal_OrthoNormalize3(ref normal, ref tangent, ref binormal);
  }

  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern Vector3 RotateTowards(Vector3 from, Vector3 to, float maxRadiansDelta, float maxMagnitudeDelta);
  public float this[int index]
  {
    get
    {
      switch (index)
      {
        case 0:
          return this.x;

        case 1:
          return this.y;

        case 2:
          return this.z;
      }
      throw new IndexOutOfRangeException("Invalid Vector3 index!");
    }
    set
    {
      switch (index)
      {
        case 0:
          this.x = value;
          break;

        case 1:
          this.y = value;
          break;

        case 2:
          this.z = value;
          break;

        default:
          throw new IndexOutOfRangeException("Invalid Vector3 index!");
      }
    }
  }
  public static Vector3 Scale(Vector3 a, Vector3 b)
  {
    return new Vector3(a.x * b.x, a.y * b.y, a.z * b.z);
  }

  public void Scale(Vector3 scale)
  {
    this.x *= scale.x;
    this.y *= scale.y;
    this.z *= scale.z;
  }

  public static Vector3 Cross(Vector3 lhs, Vector3 rhs)
  {
    return new Vector3((lhs.y * rhs.z) - (lhs.z * rhs.y), (lhs.z * rhs.x) - (lhs.x * rhs.z), (lhs.x * rhs.y) - (lhs.y * rhs.x));
  }

  public override int GetHashCode()
  {
    return ((this.x.GetHashCode() ^ (this.y.GetHashCode() << 2)) ^ (this.z.GetHashCode() >> 2));
  }

  public override bool Equals(object other)
  {
    if (!(other is Vector3))
    {
      return false;
    }
    Vector3 vector = (Vector3) other;
    return ((this.x.Equals(vector.x) && this.y.Equals(vector.y)) && this.z.Equals(vector.z));
  }

  public static Vector3 Reflect(Vector3 inDirection, Vector3 inNormal)
  {
    return (((Vector3) ((-2f * Dot(inNormal, inDirection)) * inNormal)) + inDirection);
  }

  public static Vector3 Normalize(Vector3 value)
  {
    float num = Magnitude(value);
    if (num > 1E-05f)
    {
      return (Vector3) (value / num);
    }
    return zero;
  }

  public void Normalize()
  {
    float num = Magnitude(this);
    if (num > 1E-05f)
    {
      this = (Vector3) (this / num);
    }
    else
    {
      this = zero;
    }
  }

  public Vector3 normalized
  {
    get
    {
      return Normalize(this);
    }
  }
  public override <span class="posthilit">string</span> ToString()
  {
    return <span class="posthilit">string</span>.Format("({0:F1}, {1:F1}, {2:F1})", this.x, this.y, this.z);
  }

  public static float Dot(Vector3 lhs, Vector3 rhs)
  {
    return (((lhs.x * rhs.x) + (lhs.y * rhs.y)) + (lhs.z * rhs.z));
  }

  public static Vector3 Project(Vector3 vector, Vector3 onNormal)
  {
    float num = Dot(onNormal, onNormal);
    if (num < float.Epsilon)
    {
      return zero;
    }
    return (Vector3) ((onNormal * Dot(vector, onNormal)) / num);
  }

  public static Vector3 Exclude(Vector3 excludeThis, Vector3 fromThat)
  {
    return (fromThat - Project(fromThat, excludeThis));
  }

  public static float Angle(Vector3 from, Vector3 to)
  {
    return (Mathf.Acos(Mathf.Clamp(Dot(from.normalized, to.normalized), -1f, 1f)) * 57.29578f);
  }

  public static float Distance(Vector3 a, Vector3 b)
  {
    Vector3 vector = new Vector3(a.x - b.x, a.y - b.y, a.z - b.z);
    return Mathf.Sqrt(((vector.x * vector.x) + (vector.y * vector.y)) + (vector.z * vector.z));
  }

  public static float Magnitude(Vector3 a)
  {
    return Mathf.Sqrt(((a.x * a.x) + (a.y * a.y)) + (a.z * a.z));
  }

  public float magnitude
  {
    get
    {
      return Mathf.Sqrt(((this.x * this.x) + (this.y * this.y)) + (this.z * this.z));
    }
  }
  public static float SqrMagnitude(Vector3 a)
  {
    return (((a.x * a.x) + (a.y * a.y)) + (a.z * a.z));
  }

  public float sqrMagnitude
  {
    get
    {
      return (((this.x * this.x) + (this.y * this.y)) + (this.z * this.z));
    }
  }
  public static Vector3 Min(Vector3 lhs, Vector3 rhs)
  {
    return new Vector3(Mathf.Min(lhs.x, rhs.x), Mathf.Min(lhs.y, rhs.y), Mathf.Min(lhs.z, rhs.z));
  }

  public static Vector3 Max(Vector3 lhs, Vector3 rhs)
  {
    return new Vector3(Mathf.Max(lhs.x, rhs.x), Mathf.Max(lhs.y, rhs.y), Mathf.Max(lhs.z, rhs.z));
  }

  public static Vector3 zero
  {
    get
    {
      return new Vector3(0f, 0f, 0f);
    }
  }
  public static Vector3 one
  {
    get
    {
      return new Vector3(1f, 1f, 1f);
    }
  }
  public static Vector3 forward
  {
    get
    {
      return new Vector3(0f, 0f, 1f);
    }
  }
  public static Vector3 back
  {
    get
    {
      return new Vector3(0f, 0f, -1f);
    }
  }
  public static Vector3 up
  {
    get
    {
      return new Vector3(0f, 1f, 0f);
    }
  }
  public static Vector3 down
  {
    get
    {
      return new Vector3(0f, -1f, 0f);
    }
  }
  public static Vector3 left
  {
    get
    {
      return new Vector3(-1f, 0f, 0f);
    }
  }
  public static Vector3 right
  {
    get
    {
      return new Vector3(1f, 0f, 0f);
    }
  }
  [Obsolete("Use Vector3.forward instead.")]
  public static Vector3 fwd
  {
    get
    {
      return new Vector3(0f, 0f, 1f);
    }
  }
  [Obsolete("Use Vector3.Angle instead. AngleBetween uses radians instead of degrees and was deprecated for this reason")]
  public static float AngleBetween(Vector3 from, Vector3 to)
  {
    return Mathf.Acos(Mathf.Clamp(Dot(from.normalized, to.normalized), -1f, 1f));
  }

  public static Vector3 operator +(Vector3 a, Vector3 b)
  {
    return new Vector3(a.x + b.x, a.y + b.y, a.z + b.z);
  }

  public static Vector3 operator -(Vector3 a, Vector3 b)
  {
    return new Vector3(a.x - b.x, a.y - b.y, a.z - b.z);
  }

  public static Vector3 operator -(Vector3 a)
  {
    return new Vector3(-a.x, -a.y, -a.z);
  }

  public static Vector3 operator *(Vector3 a, float d)
  {
    return new Vector3(a.x * d, a.y * d, a.z * d);
  }

  public static Vector3 operator *(float d, Vector3 a)
  {
    return new Vector3(a.x * d, a.y * d, a.z * d);
  }

  public static Vector3 operator /(Vector3 a, float d)
  {
    return new Vector3(a.x / d, a.y / d, a.z / d);
  }

  public static bool operator ==(Vector3 lhs, Vector3 rhs)
  {
    return (SqrMagnitude(lhs - rhs) < 9.999999E-11f);
  }

  public static bool operator !=(Vector3 lhs, Vector3 rhs)
  {
    return (SqrMagnitude(lhs - rhs) >= 9.999999E-11f);
  }
}
 
Последний раз редактировалось DbIMok 09 апр 2010, 20:28, всего редактировалось 1 раз.
правильный вопрос - половина ответа. учитесь формулировать вопросы понятно.
Новости > _Telegram чат @unity3d_ru (11.6k/4.8k online) > _Telegram канал @unity_news (4.6k подписчиков) > Телеграм тема > "Спасибо"
Аватара пользователя
DbIMok
Адепт
 
Сообщения: 6372
Зарегистрирован: 31 июл 2009, 14:05

Re: Знаете ли вы что...

Сообщение DbIMok 09 апр 2010, 18:25

Синтаксис:
Используется csharp
public struct Mathf
{
  public const float PI = 3.141593f;
  public const float Infinity = float.PositiveInfinity;
  public const float NegativeInfinity = float.NegativeInfinity;
  public const float Deg2Rad = 0.01745329f;
  public const float Rad2Deg = 57.29578f;
  public const float Epsilon = float.Epsilon;
  private byte $PRIVATE$;
  public static float Sin(float f)
  {
    return (float) Math.Sin((double) f);
  }

  public static float Cos(float f)
  {
    return (float) Math.Cos((double) f);
  }

  public static float Tan(float f)
  {
    return (float) Math.Tan((double) f);
  }

  public static float Asin(float f)
  {
    return (float) Math.Asin((double) f);
  }

  public static float Acos(float f)
  {
    return (float) Math.Acos((double) f);
  }

  public static float Atan(float f)
  {
    return (float) Math.Atan((double) f);
  }

  public static float Atan2(float y, float x)
  {
    return (float) Math.Atan2((double) y, (double) x);
  }

  public static float Sqrt(float f)
  {
    return (float) Math.Sqrt((double) f);
  }

  public static float Abs(float f)
  {
    return Math.Abs(f);
  }

  public static int Abs(int value)
  {
    return Math.Abs(value);
  }

  public static float Min(float a, float b)
  {
    return ((a >= b) ? b : a);
  }

  public static int Min(int a, int b)
  {
    return ((a >= b) ? b : a);
  }

  public static float Max(float a, float b)
  {
    return ((a <= b) ? b : a);
  }

  public static int Max(int a, int b)
  {
    return ((a <= b) ? b : a);
  }

  public static float Pow(float f, float p)
  {
    return (float) Math.Pow((double) f, (double) p);
  }

  public static float Exp(float power)
  {
    return (float) Math.Exp((double) power);
  }

  public static float Log(float f, float p)
  {
    return (float) Math.Log((double) f, (double) p);
  }

  public static float Log(float f)
  {
    return (float) Math.Log((double) f);
  }

  public static float Log10(float f)
  {
    return (float) Math.Log10((double) f);
  }

  public static float Ceil(float f)
  {
    return (float) Math.Ceiling((double) f);
  }

  public static float Floor(float f)
  {
    return (float) Math.Floor((double) f);
  }

  public static float Round(float f)
  {
    return (float) Math.Round((double) f);
  }

  public static int CeilToInt(float f)
  {
    return (int) Math.Ceiling((double) f);
  }

  public static int FloorToInt(float f)
  {
    return (int) Math.Floor((double) f);
  }

  public static int RoundToInt(float f)
  {
    return (int) Math.Round((double) f);
  }

  public static float Sign(float f)
  {
    return ((f < 0f) ? -1f : 1f);
  }

  public static float Clamp(float value, float min, float max)
  {
    if (value < min)
    {
      value = min;
      return value;
    }
    if (value > max)
    {
      value = max;
    }
    return value;
  }

  public static int Clamp(int value, int min, int max)
  {
    if (value < min)
    {
      value = min;
      return value;
    }
    if (value > max)
    {
      value = max;
    }
    return value;
  }

  public static float Clamp01(float value)
  {
    if (value < 0f)
    {
      return 0f;
    }
    if (value > 1f)
    {
      return 1f;
    }
    return value;
  }

  public static float Lerp(float a, float b, float t)
  {
    return (a + ((b - a) * Clamp01(t)));
  }

  public static float LerpAngle(float a, float b, float t)
  {
    float num = Repeat(b - a, 360f);
    if (num > 180f)
    {
      num -= 360f;
    }
    return (a + (num * Clamp01(t)));
  }

  public static float SmoothStep(float from, float to, float t)
  {
    t = Clamp01(t);
    t = (((-2f * t) * t) * t) + ((3f * t) * t);
    return ((to * t) + (from * (1f - t)));
  }

  public static float Gamma(float value, float absmax, float gamma)
  {
    bool flag = false;
    if (value < 0f)
    {
      flag = true;
    }
    float num = Abs(value);
    if (num > absmax)
    {
      return (!flag ? num : -num);
    }
    float num2 = Pow(num / absmax, gamma) * absmax;
    return (!flag ? num2 : -num2);
  }

  public static bool Approximately(float a, float b)
  {
    return (Abs((float) (a - b)) < float.Epsilon);
  }

  public static float SmoothDamp(float current, float target, ref float currentVelocity, float smoothTime, float maxSpeed)
  {
    float deltaTime = Time.deltaTime;
    return SmoothDamp(current, target, ref currentVelocity, smoothTime, maxSpeed, deltaTime);
  }

  public static float SmoothDamp(float current, float target, ref float currentVelocity, float smoothTime)
  {
    float deltaTime = Time.deltaTime;
    float positiveInfinity = float.PositiveInfinity;
    return SmoothDamp(current, target, ref currentVelocity, smoothTime, positiveInfinity, deltaTime);
  }

  public static float SmoothDamp(float current, float target, ref float currentVelocity, float smoothTime, float maxSpeed, float deltaTime)
  {
    smoothTime = Max(0.0001f, smoothTime);
    float num = 2f / smoothTime;
    float num2 = num * deltaTime;
    float num3 = 1f / (((1f + num2) + ((0.48f * num2) * num2)) + (((0.235f * num2) * num2) * num2));
    float num4 = current - target;
    float num5 = target;
    float max = maxSpeed * smoothTime;
    num4 = Clamp(num4, -max, max);
    target = current - num4;
    float num7 = (currentVelocity + (num * num4)) * deltaTime;
    currentVelocity = (currentVelocity - (num * num7)) * num3;
    float num8 = target + ((num4 + num7) * num3);
    if (((num5 - current) > 0f) == (num8 > num5))
    {
      num8 = num5;
      currentVelocity = (num8 - num5) / deltaTime;
    }
    return num8;
  }

  public static float SmoothDampAngle(float current, float target, ref float currentVelocity, float smoothTime, float maxSpeed)
  {
    float deltaTime = Time.deltaTime;
    return SmoothDampAngle(current, target, ref currentVelocity, smoothTime, maxSpeed, deltaTime);
  }

  public static float SmoothDampAngle(float current, float target, ref float currentVelocity, float smoothTime)
  {
    float deltaTime = Time.deltaTime;
    float positiveInfinity = float.PositiveInfinity;
    return SmoothDampAngle(current, target, ref currentVelocity, smoothTime, positiveInfinity, deltaTime);
  }

  public static float SmoothDampAngle(float current, float target, ref float currentVelocity, float smoothTime, float maxSpeed, float deltaTime)
  {
    target = current + DeltaAngle(current, target);
    return SmoothDamp(current, target, ref currentVelocity, smoothTime, maxSpeed, deltaTime);
  }

  public static float Repeat(float t, float length)
  {
    return (t - (Floor(t / length) * length));
  }

  public static float PingPong(float t, float length)
  {
    t = Repeat(t, length * 2f);
    return (length - Abs((float) (t - length)));
  }

  public static float InverseLerp(float from, float to, float value)
  {
    if (from < to)
    {
      if (value < from)
      {
        return 0f;
      }
      if (value > to)
      {
        return 1f;
      }
      value -= from;
      value /= to - from;
      return value;
    }
    if (from <= to)
    {
      return 0f;
    }
    if (value < to)
    {
      return 1f;
    }
    if (value > from)
    {
      return 0f;
    }
    return (1f - ((value - to) / (from - to)));
  }

  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern int ClosestPowerOfTwo(int value);
  public static float DeltaAngle(float current, float target)
  {
    float num = Repeat(target - current, 360f);
    if (num > 180f)
    {
      num -= 360f;
    }
    return num;
  }

  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern float PerlinNoise(float x, float y);
}
 
правильный вопрос - половина ответа. учитесь формулировать вопросы понятно.
Новости > _Telegram чат @unity3d_ru (11.6k/4.8k online) > _Telegram канал @unity_news (4.6k подписчиков) > Телеграм тема > "Спасибо"
Аватара пользователя
DbIMok
Адепт
 
Сообщения: 6372
Зарегистрирован: 31 июл 2009, 14:05

Re: Знаете ли вы что...

Сообщение DbIMok 19 апр 2010, 23:34

Синтаксис:
Используется csharp
public class Unsupported
{
  // Methods
  public Unsupported();
  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern void CopyGameObjectsToPasteboard();
  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern void DeleteGameObjectSelection();
  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern void DuplicateGameObjectsUsingPasteboard();
  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern bool IsDeveloperBuild();
  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern void PasteGameObjectsFromPasteboard();
  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern void SceneTrackerFlushDirty();
  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern void SetAllowCursorLock(bool allow);
  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern void SetRenderSettingsUseFogNoDirty(bool fog);
  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern void SmartReset(Object obj);
  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern void StopPlayingImmediately();
  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern bool StripFatMacho(<span class="posthilit">string</span> path, bool generatePPC);
}
 
правильный вопрос - половина ответа. учитесь формулировать вопросы понятно.
Новости > _Telegram чат @unity3d_ru (11.6k/4.8k online) > _Telegram канал @unity_news (4.6k подписчиков) > Телеграм тема > "Спасибо"
Аватара пользователя
DbIMok
Адепт
 
Сообщения: 6372
Зарегистрирован: 31 июл 2009, 14:05

Re: Знаете ли вы что...

Сообщение DbIMok 19 апр 2010, 23:35

Синтаксис:
Используется csharp
[Serializable]
public class ActiveEditorTracker
{
  // Fields
  private MonoReloadableIntPtrClear m_Property;

  // Methods
  [MethodImpl(MethodImplOptions.InternalCall)]
  public extern ActiveEditorTracker();
  [MethodImpl(MethodImplOptions.InternalCall)]
  public extern void ClearDirty();
  [MethodImpl(MethodImplOptions.InternalCall)]
  private extern void Dispose();
  public override bool Equals(object o)
  {
    ActiveEditorTracker tracker = o as ActiveEditorTracker;
    return (this.m_Property.m_IntPtr == tracker.m_Property.m_IntPtr);
  }

  ~ActiveEditorTracker()
  {
    this.Dispose();
  }

  public override int GetHashCode()
  {
    return this.m_Property.m_IntPtr.GetHashCode();
  }

  [MethodImpl(MethodImplOptions.InternalCall)]
  public extern int GetVisible(int index);
  public static bool HasCustomEditor(Object obj)
  {
    return (CustomEditorAttributes.FindCustomEditorType(obj) != null);
  }

  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern Editor MakeCustomEditor(Object obj);
  [MethodImpl(MethodImplOptions.InternalCall)]
  public extern void RebuildIfNecessary();
  [MethodImpl(MethodImplOptions.InternalCall)]
  private static extern void SetupSharedTracker(ActiveEditorTracker sharedTracker);
  [MethodImpl(MethodImplOptions.InternalCall)]
  public extern void SetVisible(int index, int visible);
  [MethodImpl(MethodImplOptions.InternalCall)]
  public extern void VerifyModifiedMonoBehaviours();

  // Properties
  public Editor[] activeEditors { [MethodImpl(MethodImplOptions.InternalCall)] get; }

  public bool debugMode { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

  public bool isDirty { [MethodImpl(MethodImplOptions.InternalCall)] get; }

  public bool isLocked { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

  public static ActiveEditorTracker sharedTracker
  {
    get
    {
      ActiveEditorTracker sharedTracker = new ActiveEditorTracker();
      SetupSharedTracker(sharedTracker);
      return sharedTracker;
    }
  }
}
 
правильный вопрос - половина ответа. учитесь формулировать вопросы понятно.
Новости > _Telegram чат @unity3d_ru (11.6k/4.8k online) > _Telegram канал @unity_news (4.6k подписчиков) > Телеграм тема > "Спасибо"
Аватара пользователя
DbIMok
Адепт
 
Сообщения: 6372
Зарегистрирован: 31 июл 2009, 14:05

Re: Знаете ли вы что...

Сообщение DbIMok 19 апр 2010, 23:38

Синтаксис:
Используется csharp
public class GenericMenu
{
  // Fields
  public ArrayList menuItems = new ArrayList();

  // Methods
  public void AddDisabledItem(GUIContent content)
  {
    this.menuItems.Add(new MenuItem(content, false, null));
  }

  public void AddItem(GUIContent content, bool on, MenuFunction func)
  {
    this.menuItems.Add(new MenuItem(content, on, func));
  }

  public void AddItem(GUIContent content, bool on, MenuFunction2 func, object userData)
  {
    this.menuItems.Add(new MenuItem(content, on, func, userData));
  }

  public void AddSeparator(<span class="posthilit">string</span> path)
  {
    this.menuItems.Add(new MenuItem(new GUIContent(path), false, null));
  }

  private void CatchMenu(object userData, <span class="posthilit">string</span>[] options, int selected)
  {
    MenuItem item = (MenuItem) this.menuItems[selected];
    if (item.func2 != null)
    {
      item.func2(item.userData);
    }
    else if (item.func != null)
    {
      item.func();
    }
  }

  internal void DropDown(Rect position)
  {
    <span class="posthilit">string</span>[] options = new <span class="posthilit">string</span>[this.menuItems.Count];
    bool[] enabled = new bool[this.menuItems.Count];
    ArrayList list = new ArrayList();
    for (int i = 0; i < this.menuItems.Count; i++)
    {
      MenuItem item = (MenuItem) this.menuItems[i];
      options[i] = item.content.text;
      enabled[i] = (item.func != null) || (item.func2 != null);
      if (item.on)
      {
        list.Add(i);
      }
    }
    EditorUtility.DisplayCustomMenu(position, options, enabled, (int[]) list.ToArray(typeof(int)), new EditorUtility.SelectMenuItemFunction(this.CatchMenu), null);
  }

  internal void Popup(Rect position, int selectedIndex)
  {
    if (Application.platform == RuntimePlatform.WindowsEditor)
    {
      this.DropDown(position);
    }
    else
    {
      this.DropDown(position);
    }
  }

  public void ShowAsContext()
  {
    Rect position = new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 0f, 0f);
    this.DropDown(position);
  }

  // Nested Types
  public delegate void MenuFunction();

  public delegate void MenuFunction2(object userData);

  private class MenuItem
  {
    // Fields
    public GUIContent content;
    public GenericMenu.MenuFunction func;
    public GenericMenu.MenuFunction2 func2;
    public bool on;
    public object userData;

    // Methods
    public MenuItem(GUIContent _content, bool _on, GenericMenu.MenuFunction _func)
    {
      this.content = _content;
      this.on = _on;
      this.func = _func;
    }

    public MenuItem(GUIContent _content, bool _on, GenericMenu.MenuFunction2 _func, object _userData)
    {
      this.content = _content;
      this.on = _on;
      this.func2 = _func;
      this.userData = _userData;
    }
  }
}
 
правильный вопрос - половина ответа. учитесь формулировать вопросы понятно.
Новости > _Telegram чат @unity3d_ru (11.6k/4.8k online) > _Telegram канал @unity_news (4.6k подписчиков) > Телеграм тема > "Спасибо"
Аватара пользователя
DbIMok
Адепт
 
Сообщения: 6372
Зарегистрирован: 31 июл 2009, 14:05

Re: Знаете ли вы что...

Сообщение DbIMok 19 апр 2010, 23:43

Синтаксис:
Используется csharp
public class HierarchyProperty : IHierarchyProperty
{
  // Fields
  private IntPtr m_Property;

  // Methods
  [MethodImpl(MethodImplOptions.InternalCall)]
  public extern HierarchyProperty(HierarchyType assetDatabase);
  [MethodImpl(MethodImplOptions.InternalCall)]
  public extern int CountRemaining(int[] expanded);
  [MethodImpl(MethodImplOptions.InternalCall)]
  private extern void Dispose();
  protected override void Finalize();
  [MethodImpl(MethodImplOptions.InternalCall)]
  public extern bool Find(int instanceID, int[] expanded);
  [MethodImpl(MethodImplOptions.InternalCall)]
  public extern bool IsExpanded(int[] expanded);
  [MethodImpl(MethodImplOptions.InternalCall)]
  public extern bool Next(int[] expanded);
  [MethodImpl(MethodImplOptions.InternalCall)]
  public extern bool Parent();
  [MethodImpl(MethodImplOptions.InternalCall)]
  public extern bool Previous(int[] expanded);
  [MethodImpl(MethodImplOptions.InternalCall)]
  public extern void Reset();
  [MethodImpl(MethodImplOptions.InternalCall)]
  public extern void SetSearchFilter(<span class="posthilit">string</span> filter);
  [MethodImpl(MethodImplOptions.InternalCall)]
  public extern bool Skip(int count, int[] expanded);

  // Properties
  public int colorCode { [MethodImpl(MethodImplOptions.InternalCall)] get; }
  public int depth { [MethodImpl(MethodImplOptions.InternalCall)] get; }
  public <span class="posthilit">string</span> guid { [MethodImpl(MethodImplOptions.InternalCall)] get; }
  public bool hasChildren { [MethodImpl(MethodImplOptions.InternalCall)] get; }
  public Texture2D icon { [MethodImpl(MethodImplOptions.InternalCall)] get; }
  public int instanceID { [MethodImpl(MethodImplOptions.InternalCall)] get; }
  public bool isMainRepresentation { [MethodImpl(MethodImplOptions.InternalCall)] get; }
  public bool isValid { [MethodImpl(MethodImplOptions.InternalCall)] get; }
  public <span class="posthilit">string</span> name { [MethodImpl(MethodImplOptions.InternalCall)] get; }
  public Object pptrValue { [MethodImpl(MethodImplOptions.InternalCall)] get; }
  public int row { [MethodImpl(MethodImplOptions.InternalCall)] get; }
}
 
правильный вопрос - половина ответа. учитесь формулировать вопросы понятно.
Новости > _Telegram чат @unity3d_ru (11.6k/4.8k online) > _Telegram канал @unity_news (4.6k подписчиков) > Телеграм тема > "Спасибо"
Аватара пользователя
DbIMok
Адепт
 
Сообщения: 6372
Зарегистрирован: 31 июл 2009, 14:05

Re: Знаете ли вы что...

Сообщение DbIMok 19 апр 2010, 23:46

Синтаксис:
Используется csharp
public class PostprocessBuildPlayer
{
  // Methods
  private static void CopyDirectoryRecursive(<span class="posthilit">string</span> source, <span class="posthilit">string</span> target)
  {
    if (!Directory.Exists(target))
    {
      Directory.CreateDirectory(target);
    }
    <span class="posthilit">string</span>[] files = Directory.GetFiles(source);
    int length = files.Length;
    for (int i = 0; i < length; i++)
    {
      <span class="posthilit">string</span> path = files[i];
      <span class="posthilit">string</span> fileName = Path.GetFileName(path);
      File.Copy(path, Path.Combine(target, fileName));
    }
    <span class="posthilit">string</span>[] directories = Directory.GetDirectories(source);
    int num4 = directories.Length;
    for (int j = 0; j < num4; j++)
    {
      <span class="posthilit">string</span> str3 = directories[j];
      <span class="posthilit">string</span> str4 = Path.GetFileName(str3);
      CopyDirectoryRecursive(Path.Combine(source, str4), Path.Combine(target, str4));
    }
  }

  private static <span class="posthilit">string</span> GenerateBundleIdentifier(<span class="posthilit">string</span> companyName, <span class="posthilit">string</span> productName)
  {
    return ("unity." + companyName + "." + productName);
  }

  private static void InstallMonoDlls(<span class="posthilit">string</span> destination)
  {
    <span class="posthilit">string</span>[] files = Directory.GetFiles(destination);
    int length = files.Length;
    for (int i = 0; i < length; i++)
    {
      <span class="posthilit">string</span> path = files[i];
      if (Path.GetExtension(path) == ".dll")
      {
        File.Delete(path);
      }
    }
    <span class="posthilit">string</span>[] strArray2 = Directory.GetFiles("Temp/BuildingPlayer/ReferencedLibs");
    int num4 = strArray2.Length;
    for (int j = 0; j < num4; j++)
    {
      <span class="posthilit">string</span> str2 = strArray2[j];
      if (Path.GetExtension(str2) == ".dll")
      {
        File.Move(str2, Path.Combine(destination, Path.GetFileName(str2)));
      }
    }
  }

  private static void InstallPlugins(<span class="posthilit">string</span> pluginFolder, BuildTarget target)
  {
    <span class="posthilit">string</span> path = "Assets/Plugins";
    if (Directory.Exists(path))
    {
      bool flag = (((target == BuildTarget.StandaloneOSXPPC) || (target == BuildTarget.StandaloneOSXIntel)) || (target == BuildTarget.StandaloneOSXUniversal)) || (target == BuildTarget.DashboardWidget);
      <span class="posthilit">string</span> strB = "";
      if (((target == BuildTarget.StandaloneOSXPPC) || (target == BuildTarget.StandaloneOSXIntel)) || ((target == BuildTarget.StandaloneOSXUniversal) || (target == BuildTarget.DashboardWidget)))
      {
        strB = ".bundle";
      }
      else if (target == BuildTarget.StandaloneWindows)
      {
        strB = ".dll";
      }
      <span class="posthilit">string</span>[] fileSystemEntries = Directory.GetFileSystemEntries(path);
      int length = fileSystemEntries.Length;
      for (int i = 0; i < length; i++)
      {
        <span class="posthilit">string</span> str3 = fileSystemEntries[i];
        if (<span class="posthilit">string</span>.Compare(Path.GetExtension(str3), strB, true) == 0)
        {
          if (!Directory.Exists(pluginFolder))
          {
            Directory.CreateDirectory(pluginFolder);
          }
          <span class="posthilit">string</span> str4 = Path.Combine(pluginFolder, Path.GetFileName(str3));
          if (flag)
          {
            CopyDirectoryRecursive(str3, str4);
          }
          else
          {
            File.Copy(str3, str4);
          }
        }
      }
    }
  }

  private static void Postprocess(BuildTarget target, <span class="posthilit">string</span> installPath, <span class="posthilit">string</span> companyName, <span class="posthilit">string</span> productName, int width, int height, <span class="posthilit">string</span> downloadWebplayerUrl, <span class="posthilit">string</span> manualDownloadWebplayerUrl, BuildOptions options)
  {
    <span class="posthilit">string</span> str = "Temp/BuildingPlayer";
    <span class="posthilit">string</span> from = "Temp/BuildingPlayer/Data";
    if (((target == BuildTarget.StandaloneOSXPPC) || (target == BuildTarget.StandaloneOSXIntel)) || (target == BuildTarget.StandaloneOSXUniversal))
    {
      <span class="posthilit">string</span> str3 = str + "/UnityPlayer.app/Contents";
      FileUtil.CopyFileOrDirectoryFollowSymlinks(EditorApplication.applicationContentsPath + "/Frameworks/UnityPlayer.app", str + "/UnityPlayer.app");
      FileUtil.DeleteFileOrDirectory(str3 + "/Frameworks/Mono.framework");
      FileUtil.CopyFileOrDirectory(EditorApplication.applicationContentsPath + "/Frameworks/Mono.framework", str3 + "/Frameworks/Mono.framework");
      InstallMonoDlls(str3 + "/Frameworks/Mono.framework");
      FileUtil.DeleteFileOrDirectory(str3 + "/Resources/unity default resources");
      if (target == BuildTarget.StandaloneOSXPPC)
      {
        File.Copy(EditorApplication.applicationContentsPath + "/Resources/unity default resources player big endian", str3 + "/Resources/unity default resources");
      }
      else
      {
        File.Copy(EditorApplication.applicationContentsPath + "/Resources/unity default resources player little endian", str3 + "/Resources/unity default resources");
      }
      if (((options & BuildOptions.Development) != BuildOptions.CompressTextures) && Directory.Exists(EditorApplication.applicationContentsPath + "/Frameworks/DevelopmentUnityPlayer"))
      {
        <span class="posthilit">string</span> sourceFileName = EditorApplication.applicationContentsPath + "/Frameworks/DevelopmentUnityPlayer/UnityPlayer";
        File.Delete(str3 + "/MacOS/UnityPlayer");
        File.Copy(sourceFileName, str3 + "/MacOS/UnityPlayer");
      }
      <span class="posthilit">string</span> str5 = GenerateBundleIdentifier(companyName, productName);
      <span class="posthilit">string</span>[] input = new <span class="posthilit">string</span>[] { "UNITY_BUNDLE_IDENTIFIER", str5, ">UnityPlayer<", ">" + productName + "<" };
      ReplaceText(str3 + "/Info.plist", input);
      RemoveArch(str3 + "/Frameworks/Mono.framework/libglib-2.0.0.dylib", target);
      RemoveArch(str3 + "/Frameworks/Mono.framework/libgmodule-2.0.0.dylib", target);
      RemoveArch(str3 + "/Frameworks/Mono.framework/libgthread-2.0.0.dylib", target);
      RemoveArch(str3 + "/Frameworks/Mono.framework/libiconv.2.dylib", target);
      RemoveArch(str3 + "/Frameworks/Mono.framework/libintl.3.dylib", target);
      RemoveArch(str3 + "/Frameworks/Mono.framework/libmono.0.dylib", target);
      RemoveArch(str3 + "/MacOS/UnityPlayer", target);
      if (target == BuildTarget.StandaloneOSXIntel)
      {
        FileUtil.DeleteFileOrDirectory(str3 + "/Frameworks/al.bundle");
      }
      File.Move(str3 + "/MacOS/UnityPlayer", str3 + "/MacOS/" + productName);
      FileUtil.MoveFileOrDirectory(from, str3 + "/Data");
      InstallPlugins(str3 + "/Plugins", target);
      FileUtil.DeleteFileOrDirectory(installPath);
      FileUtil.MoveFileOrDirectory(str + "/UnityPlayer.app", installPath);
    }
    else if (target == BuildTarget.PlayerDataFolderForDevelopment)
    {
      FileUtil.DeleteFileOrDirectory(Path.GetDirectoryName(EditorApplication.applicationPath) + "/Data");
      FileUtil.MoveFileOrDirectory(from, Path.GetDirectoryName(EditorApplication.applicationPath) + "/Data");
    }
    else if (target == BuildTarget.StandaloneWindows)
    {
      <span class="posthilit">string</span> to = str + "/UnityPlayer";
      <span class="posthilit">string</span> fileNameWithoutExtension = Path.GetFileNameWithoutExtension(installPath);
      <span class="posthilit">string</span> directoryName = Path.GetDirectoryName(installPath);
      FileUtil.CopyFileOrDirectory(EditorApplication.applicationContentsPath + "/Frameworks/WindowsPlayer", to);
      Directory.CreateDirectory(from + "/unity");
      File.Move(to + "/mono-1-vc.dll", from + "/unity/mono-1-vc.dll");
      File.Delete(from + "/unity/unity default resources");
      File.Copy(EditorApplication.applicationContentsPath + "/Resources/unity default resources player little endian", from + "/unity/unity default resources");
      Directory.CreateDirectory(from + "/lib");
      InstallMonoDlls(from + "/lib");
      Directory.CreateDirectory(from + "/etc");
      FileUtil.CopyFileOrDirectory(EditorApplication.applicationContentsPath + "/Frameworks/WindowsPlayerMonoConfig", from + "/etc/mono");
      File.Copy(EditorApplication.applicationContentsPath + "/Frameworks/UnityEngine.dll", from + "/lib/UnityEngine.dll");
      File.Copy(EditorApplication.applicationContentsPath + "/Frameworks/Mono.framework/UnityDomainLoad.exe", from + "/lib/UnityDomainLoad.exe");
      InstallPlugins(from + "/Plugins", target);
      <span class="posthilit">string</span> str9 = fileNameWithoutExtension + "_Data";
      <span class="posthilit">string</span> path = directoryName + "/" + str9;
      FileUtil.DeleteFileOrDirectory(installPath);
      FileUtil.DeleteFileOrDirectory(path);
      FileUtil.DeleteFileOrDirectory(directoryName + "/" + fileNameWithoutExtension + ".pdb");
      FileUtil.MoveFileOrDirectory(from, path);
      if ((options & BuildOptions.Development) != BuildOptions.CompressTextures)
      {
        FileUtil.MoveFileOrDirectory(to + "/player_win_development.pdb", directoryName + "/" + fileNameWithoutExtension + ".pdb");
        FileUtil.MoveFileOrDirectory(to + "/player_win_development.exe", installPath);
      }
      else
      {
        FileUtil.MoveFileOrDirectory(to + "/player_win.exe", installPath);
      }
    }
    else if ((target == BuildTarget.WebPlayer) || (target == BuildTarget.WebPlayerStreamed))
    {
      FileUtil.DeleteFileOrDirectory(installPath);
      FileUtil.MoveFileOrDirectory("Temp/unitystream.unity3d", installPath);
      if ((options & BuildOptions.BuildAdditionalStreamedScenes) == BuildOptions.CompressTextures)
      {
        <span class="posthilit">string</span> str11 = Path.GetFileNameWithoutExtension(installPath);
        <span class="posthilit">string</span> str13 = Path.Combine(Path.GetDirectoryName(installPath), str11) + ".html";
        FileUtil.DeleteFileOrDirectory(str13);
        File.Copy(EditorApplication.applicationContentsPath + "/Resources/Web Player Sample.html", str13);
        <span class="posthilit">string</span>[] textArray2 = new <span class="posthilit">string</span>[] { "UNITY_WIDTH", width.ToString(), "UNITY_HEIGHT", height.ToString(), "UNITY_MANUAL_DOWNLOAD_URL", manualDownloadWebplayerUrl, "UNITY_PLUGIN_PATH", downloadWebplayerUrl, "UNITY_WEB_NAME", str11, "UNITY_WEB_NAME", str11, "UNITY_WEB_PATH", str11 + ".unity3d", "UNITY_BETA_WARNING", !InternalEditorUtility.IsUnityBeta() ? <span class="posthilit">string</span>.Empty : "<h3 style='color:#c00000;'>Built with beta version of Unity. Will only work on your computer!</h3>" };
        ReplaceText(str13, textArray2);
      }
    }
    else if (target == BuildTarget.DashboardWidget)
    {
      <span class="posthilit">string</span> str14 = str + "/DashboardBuild";
      FileUtil.DeleteFileOrDirectory(str14);
      FileUtil.CopyFileOrDirectory(EditorApplication.applicationContentsPath + "/Frameworks/UnityDashboardWidget.wdgt", str14);
      FileUtil.MoveFileOrDirectory("Temp/unitystream.unity3d", str14 + "/widget.unity3d");
      InstallPlugins(str14 + "/Plugins", target);
      <span class="posthilit">string</span> str15 = GenerateBundleIdentifier(companyName, productName) + ".widget";
      int num = width + 0x20;
      int num2 = height + 0x20;
      <span class="posthilit">string</span>[] strArray = new <span class="posthilit">string</span>[] { "UNITY_WIDTH_PLUS32", num.ToString(), "UNITY_HEIGHT_PLUS32", num2.ToString(), "UNITY_WIDTH", width.ToString(), "UNITY_HEIGHT", height.ToString(), "UNITY_BUNDLE_IDENTIFIER", str15, "UNITY_BUNDLE_NAME", productName };
      ReplaceText(str14 + "/UnityWidget.html", strArray);
      ReplaceText(str14 + "/Info.plist", strArray);
      FileUtil.DeleteFileOrDirectory(installPath);
      FileUtil.MoveFileOrDirectory(str14, installPath);
    }
    else
    {
      if (target != BuildTarget.iPhone)
      {
        throw new UnityException("Build target not supported");
      }
      <span class="posthilit">string</span> str16 = EditorApplication.applicationContentsPath + "/Frameworks/iPhoneUnity.app/Data";
      try
      {
        Directory.Delete(str16, true);
      }
      catch (DirectoryNotFoundException)
      {
      }
      Directory.CreateDirectory(str16);
      FileUtil.DeleteFileOrDirectory(str16 + "unity default resources");
      File.Copy(EditorApplication.applicationContentsPath + "/Resources/unity default resources player little endian", str16 + "/unity default resources");
      <span class="posthilit">string</span>[] files = Directory.GetFiles(from);
      int length = files.Length;
      for (int i = 0; i < length; i++)
      {
        <span class="posthilit">string</span> str17 = files[i];
        if (Path.GetExtension(str17) != ".dll")
        {
          <span class="posthilit">string</span> fileName = Path.GetFileName(str17);
          File.Copy(Path.Combine(from, fileName), Path.Combine(str16, fileName));
        }
      }
    }
  }

  private static void RemoveArch(<span class="posthilit">string</span> path, BuildTarget target)
  {
    if (target == BuildTarget.StandaloneOSXPPC)
    {
      Unsupported.StripFatMacho(path, true);
    }
    if (target == BuildTarget.StandaloneOSXIntel)
    {
      Unsupported.StripFatMacho(path, false);
    }
  }

  private static void ReplaceText(<span class="posthilit">string</span> path, params <span class="posthilit">string</span>[] input)
  {
    <span class="posthilit">string</span> contents = File.ReadAllText(path);
    for (int i = 0; i < input.Length; i += 2)
    {
      contents = contents.Replace(input[i], input[i + 1]);
    }
    File.WriteAllText(path, contents);
  }
}
правильный вопрос - половина ответа. учитесь формулировать вопросы понятно.
Новости > _Telegram чат @unity3d_ru (11.6k/4.8k online) > _Telegram канал @unity_news (4.6k подписчиков) > Телеграм тема > "Спасибо"
Аватара пользователя
DbIMok
Адепт
 
Сообщения: 6372
Зарегистрирован: 31 июл 2009, 14:05

Re: Знаете ли вы что...

Сообщение DbIMok 19 апр 2010, 23:52

Синтаксис:
Используется csharp
public class SceneView : EditorWindow
{
  // Fields
  [NonSerialized]
  internal AnimValueManager anims;
  public static SceneView current;
  [SerializeField]
  private SceneViewGrid grid;
  private const float kPerspectiveFov = 90f;
  private static PrefColor kSceneViewBackground = new PrefColor("Scene/Background", 0.278431f, 0.278431f, 0.278431f, 0f);
  internal static Color kSceneViewDownLight;
  internal static Color kSceneViewFrontLight = new Color(0.769f, 0.769f, 0.769f, 1f);
  internal static Color kSceneViewMidLight;
  internal static Color kSceneViewUpLight;
  private static PrefColor kSceneViewWire = new PrefColor("Scene/Wireframe", 0f, 0f, 0f, 0.5f);
  private static PrefColor kSceneViewWireActive = new PrefColor("Scene/Wireframe Active", 0.4901961f, 0.6901961f, 0.9803922f, 0.372549f);
  private static PrefColor kSceneViewWireOverlay = new PrefColor("Scene/Wireframe Overlay", 0f, 0f, 0f, 0.25f);
  private static PrefColor kSceneViewWireSelected = new PrefColor("Scene/Wireframe Selected", 0.3686275f, 0.4666667f, 0.6078432f, 0.25f);
  private const float kToolbarHeight = 17f;
  public bool lockRotation;
  [NonSerialized]
  private Camera m_Camera;
  [NonSerialized]
  private Light[] m_Light;
  internal AnimBool m_Ortho;
  public int m_OverlayMode;
  [SerializeField]
  private AnimVector3 m_Position = new AnimVector3();
  public int m_RenderMode;
  internal AnimQuaternion m_Rotation;
  public bool m_SceneFx;
  public bool m_SceneLighting;
  [SerializeField]
  private AnimFloat m_Size;
  [NonSerialized]
  private ActiveEditorTracker m_Tracker;
  private static Material s_AlphaOverlayMaterial;
  private static int s_CurrentTool;
  private static ArrayList s_DraggedEditors;
  private static GUIContent s_Fx;
  private static SceneView s_LastActiveSceneView;
  private static GUIContent s_Lighting;
  private static Texture2D s_MipColorsTexture;
  private static <span class="posthilit">string</span>[] s_OverlayModes;
  private static GameObject[] s_PickedObject;
  private static <span class="posthilit">string</span>[] s_RenderModes;
  private static ArrayList s_SceneViews;
  private static Shader s_ShowMipsShader;
  private static Shader s_ShowOverdrawShader;
  [NonSerialized]
  private bool slomo;
  internal SceneViewRotation svRot;

  // Methods
  static SceneView()
  {
    kSceneViewFrontLight = kSceneViewFrontLight;
    kSceneViewUpLight = new Color(0.212f, 0.227f, 0.259f, 1f);
    kSceneViewUpLight = kSceneViewUpLight;
    kSceneViewMidLight = new Color(0.114f, 0.125f, 0.133f, 1f);
    kSceneViewMidLight = kSceneViewMidLight;
    kSceneViewDownLight = new Color(0.047f, 0.043f, 0.035f, 1f);
    kSceneViewDownLight = kSceneViewDownLight;
    s_SceneViews = new ArrayList();
    s_DraggedEditors = null;
    s_PickedObject = new GameObject[1];
    s_Lighting = EditorGUIUtility.IconContent("SceneviewLighting");
    s_Fx = EditorGUIUtility.IconContent("SceneviewFx");
    s_RenderModes = new <span class="posthilit">string</span>[] { "Textured", "Wireframe", "Tex - Wire" };
    s_OverlayModes = new <span class="posthilit">string</span>[] { "RGB", "Alpha", "Overdraw", "Mipmaps" };
  }

  public SceneView()
  {
    Vector3 forward = new Vector3(-1f, -0.7f, -1f);
    this.m_Rotation = new AnimQuaternion(Quaternion.LookRotation(forward));
    this.m_Size = new AnimFloat(10f);
    this.m_Ortho = new AnimBool();
    this.m_Light = new Light[3];
    base.depthBufferBits = 0x20;
    base.antiAlias = -1;
  }

  public void AlignViewToObject(Transform t)
  {
    this.FixNegativeSize();
    this.size = 10f;
    this.LookAt(t.position + ((Vector3) (t.forward * this.CalcCameraDist())), t.rotation);
  }

  public void AlignWithView()
  {
    float num;
    Vector3 vector3;
    this.FixNegativeSize();
    Vector3 position = this.camera.transform.position;
    Vector3 vector2 = position - Tools.handlePosition;
    (Quaternion.Inverse(Selection.activeTransform.rotation) * this.camera.transform.rotation).ToAngleAxis(out num, out vector3);
    vector3 = Selection.activeTransform.TransformDirection(vector3);
    Undo.RegisterUndo(Selection.activeTransform, Selection.transforms, "Align with view");
    Transform[] transforms = Selection.transforms;
    int length = transforms.Length;
    for (int i = 0; i < length; i++)
    {
      Transform transform = transforms[i];
      transform.position += vector2;
      transform.RotateAround(position, vector3, num);
    }
  }

  private void Awake()
  {
    this.m_SceneLighting = InternalEditorUtility.CalculateShouldEnableLights();
  }

  private float CalcCameraDist()
  {
    float num = this.m_Ortho.Fade(90f, 0f);
    if (num > 3f)
    {
      this.m_Camera.orthographic = false;
      return (this.size / Mathf.Tan((num * 3.141593f) / 360f));
    }
    return 0f;
  }

  private void CallEditorDragFunctions()
  {
    if (s_DraggedEditors == null)
    {
      Debug.Log("Error: no DraggedEditors - this can only happen because event stream sent us an out-of-order dragExited event.");
    }
    else
    {
      bool flag = true;
      foreach (Editor editor in s_DraggedEditors)
      {
        MethodInfo method = editor.GetType().GetMethod("OnSceneDrag", BindingFlags.FlattenHierarchy | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
        if (method != null)
        {
          method.Invoke(editor, null);
        }
        if (Event.current.type == EventType.used)
        {
          break;
        }
        if (flag)
        {
          flag = false;
          s_PickedObject[0] = HandleUtility.PickGameObject(Event.current.mousePosition);
        }
        if (s_PickedObject[0] != null)
        {
          method = editor.GetType().GetMethod("OnObjectDrag", BindingFlags.FlattenHierarchy | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
          if (method != null)
          {
            if (Event.current.type == EventType.dragPerform)
            {
              Debug.Log(<span class="posthilit">string</span>.Concat(new object[] { "Method: ", method, "    editor: ", editor, "       picked: ", s_PickedObject }));
            }
            method.Invoke(editor, s_PickedObject);
            if (Event.current.type == EventType.used)
            {
              break;
            }
          }
        }
      }
    }
  }

  private void CallOnSceneGUI()
  {
    Editor[] activeEditors = this.GetActiveEditors();
    int length = activeEditors.Length;
    for (int i = 0; i < length; i++)
    {
      Editor editor = activeEditors[i];
      MethodInfo method = editor.GetType().GetMethod("OnSceneGUI", BindingFlags.FlattenHierarchy | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
      if (method != null)
      {
        method.Invoke(editor, null);
      }
    }
  }

  private void CommandsGUI()
  {
    bool flag = Event.current.type == EventType.ExecuteCommand;
    <span class="posthilit">string</span> commandName = Event.current.commandName;
    if (commandName != null)
    {
      commandName = <span class="posthilit">string</span>.IsInterned(commandName);
      if (commandName == "FrameSelected")
      {
        if (flag)
        {
          this.FrameSelected();
        }
        Event.current.Use();
      }
      else if ((commandName == "SoftDelete") || (commandName == "Delete"))
      {
        if (flag)
        {
          Unsupported.DeleteGameObjectSelection();
        }
        Event.current.Use();
      }
      else if (commandName == "Duplicate")
      {
        if (flag)
        {
          Unsupported.DuplicateGameObjectsUsingPasteboard();
        }
        Event.current.Use();
      }
      else if (commandName == "Copy")
      {
        if (flag)
        {
          Unsupported.CopyGameObjectsToPasteboard();
        }
        Event.current.Use();
      }
      else if (commandName == "Paste")
      {
        if (flag)
        {
          Unsupported.PasteGameObjectsFromPasteboard();
        }
        Event.current.Use();
      }
      else if (commandName == "SelectAll")
      {
        if (flag)
        {
          Selection.objects = Object.FindObjectsOfType(typeof(GameObject));
        }
        Event.current.Use();
      }
    }
  }

  private static void CreateMipColorsTexture()
  {
    if (s_MipColorsTexture == null)
    {
      s_MipColorsTexture = new Texture2D(0x20, 0x20, TextureFormat.ARGB32, true);
      s_MipColorsTexture.hideFlags = HideFlags.HideAndDontSave;
      Color[] colorArray = new Color[] { new Color(0f, 0f, 1f, 0.8f), new Color(0f, 0.5f, 1f, 0.4f), new Color(1f, 1f, 1f, 0f), new Color(1f, 0.7f, 0f, 0.2f), new Color(1f, 0.3f, 0f, 0.6f), new Color(1f, 0f, 0f, 0.8f) };
      int num = Mathf.Min(6, s_MipColorsTexture.mipmapCount);
      for (int i = 0; i < num; i++)
      {
        int num3 = Mathf.Max(s_MipColorsTexture.width >> i, 1);
        int num4 = Mathf.Max(s_MipColorsTexture.height >> i, 1);
        Color[] colors = new Color[num3 * num4];
        for (int j = 0; j < colors.Length; j++)
        {
          colors[j] = colorArray[i];
        }
        s_MipColorsTexture.SetPixels(colors, i);
      }
      s_MipColorsTexture.filterMode = FilterMode.Trilinear;
      s_MipColorsTexture.Apply(false);
      Shader.SetGlobalTexture("__SceneViewMipcolorsTexture", s_MipColorsTexture);
    }
  }

  private void DefaultHandles()
  {
    PickTool();
    if (GUIUtility.hotControl == 0)
    {
      s_CurrentTool = ((Event.current.type == EventType.repaint) || !Tools.viewToolActive) ? Tools.current : 0;
    }
    switch (s_CurrentTool)
    {
      case 1:
        MoveTool.OnGUI();
        break;

      case 2:
        RotateTool.OnGUI();
        break;

      case 3:
        ScaleTool.OnGUI();
        break;
    }
    SceneViewMotion.DoViewTool();
  }

  private void DoStatusBarGUI()
  {
    GUISkin skin = GUI.skin;
    GUI.skin = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector);
    GUILayout.BeginHorizontal("toolbar", new GUILayoutOption[0]);
    GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(120f) };
    this.m_RenderMode = EditorGUILayout.Popup(this.m_RenderMode, s_RenderModes, "ToolbarPopup", options);
    EditorGUILayout.Space();
    GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.Width(70f) };
    this.m_OverlayMode = EditorGUILayout.Popup(this.m_OverlayMode, s_OverlayModes, "ToolbarPopup", optionArray2);
    EditorGUILayout.Space();
    this.m_SceneLighting = GUILayout.Toggle(this.m_SceneLighting, s_Lighting, "toolbarbutton", new GUILayoutOption[0]);
    this.m_SceneFx = GUILayout.Toggle(this.m_SceneFx, s_Fx, "toolbarbutton", new GUILayoutOption[0]);
    GUILayout.FlexibleSpace();
    this.anims.speed = !this.slomo ? 2f : 0.2f;
    GUILayout.EndHorizontal();
    GUI.skin = skin;
  }

  private void DrawAlphaOverlay()
  {
    if (this.m_OverlayMode == 1)
    {
      if (s_AlphaOverlayMaterial == null)
      {
        s_AlphaOverlayMaterial = EditorGUIUtility.LoadRequired("SceneView/SceneViewAlphaMaterial.mat") as Material;
      }
      Handles.BeginGUI();
      if (Event.current.type == EventType.repaint)
      {
        Rect screenRect = new Rect(0f, -18f, base.position.width, base.position.height);
        Graphics.DrawTexture(screenRect, EditorGUIUtility.whiteTexture, s_AlphaOverlayMaterial);
      }
      Handles.EndGUI();
    }
  }

  public void FixNegativeSize()
  {
    float num = 90f;
    if (this.size < 0f)
    {
      float z = this.size / Mathf.Tan((num * 3.141593f) / 360f);
      Vector3 vector2 = new Vector3(0f, 0f, -z);
      Vector3 vector = (Vector3) (this.m_Position + (this.rotation * vector2));
      this.size = -this.size;
      z = this.size / Mathf.Tan((num * 3.141593f) / 360f);
      Vector3 vector3 = new Vector3(0f, 0f, z);
      this.m_Position.value = vector + (this.rotation * vector3);
    }
  }

  public bool FrameSelected()
  {
    this.FixNegativeSize();
    Bounds bounds = InternalEditorUtility.CalculateSelectionBounds(false);
    Editor[] activeEditors = this.GetActiveEditors();
    int length = activeEditors.Length;
    for (int i = 0; i < length; i++)
    {
      Editor editor = activeEditors[i];
      MethodInfo method = editor.GetType().GetMethod("OnGetFrameBounds", BindingFlags.FlattenHierarchy | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
      if (method != null)
      {
        object obj2 = method.Invoke(editor, null);
        if ((obj2 != null) && (obj2 is Bounds))
        {
          bounds = (Bounds) obj2;
        }
      }
    }
    float num3 = bounds.extents.magnitude * 1.5f;
    switch (num3)
    {
      case float.PositiveInfinity:
        return false;

      case 0f:
        num3 = 10f;
        break;
    }
    this.LookAt(bounds.center, this.m_Rotation.target, num3 * 2.2f);
    return true;
  }

  private Editor[] GetActiveEditors()
  {
    if (this.m_Tracker == null)
    {
      this.m_Tracker = ActiveEditorTracker.sharedTracker;
    }
    return this.m_Tracker.activeEditors;
  }

  private void HandleDragging()
  {
    Event current = Event.current;
    switch (current.type)
    {
      case EventType.dragUpdated:
      case EventType.dragPerform:
        DragAndDrop.visualMode = InternalEditorUtility.SceneViewDrag(HandleUtility.PickGameObject(Event.current.mousePosition), this.pivot, Event.current.mousePosition, current.type == EventType.dragPerform);
        if ((current.type == EventType.dragPerform) && (DragAndDrop.visualMode != DragAndDropVisualMode.None))
        {
          DragAndDrop.AcceptDrag();
          current.Use();
          GUIUtility.ExitGUI();
        }
        current.Use();
        break;
    }
  }

  public void LookAt(Vector3 position)
  {
    this.FixNegativeSize();
    this.m_Position.target = position;
  }

  public void LookAt(Vector3 position, Quaternion rotation)
  {
    this.FixNegativeSize();
    this.m_Position.target = position;
    this.m_Rotation.target = rotation;
    this.lockRotation = false;
    if (this.orthographic)
    {
      this.svRot.SwitchDirNameVisible(6);
    }
  }

  public void LookAt(Vector3 position, Quaternion rotation, float size)
  {
    this.FixNegativeSize();
    this.m_Position.target = position;
    this.m_Rotation.target = rotation;
    this.m_Size.target = Mathf.Abs(size);
  }

  public void LookAt(Vector3 position, Quaternion rotation, float size, bool orthographic)
  {
    this.FixNegativeSize();
    this.m_Position.target = position;
    this.m_Rotation.target = rotation;
    this.m_Size.target = Mathf.Abs(size);
    this.m_Ortho.target = orthographic;
  }

  [MenuItem("GameObject/Align View to Selected")]
  private static void MenuAlignViewToSelected()
  {
    if (ValidateAlignViewToSelected())
    {
      s_LastActiveSceneView.AlignViewToObject(Selection.activeTransform);
    }
  }

  [MenuItem("GameObject/Align With View %#f")]
  private static void MenuAlignWithView()
  {
    if (ValidateAlignWithView())
    {
      s_LastActiveSceneView.AlignWithView();
    }
  }

  [MenuItem("GameObject/Move To View %&f")]
  private static void MenuMoveToView()
  {
    if (ValidateMoveToView())
    {
      s_LastActiveSceneView.MoveToView();
    }
  }

  public void MoveToView()
  {
    this.FixNegativeSize();
    Vector3 vector = this.pivot - Tools.handlePosition;
    Undo.RegisterUndo(Selection.activeTransform, Selection.transforms, "Move to view");
    Transform[] transforms = Selection.transforms;
    int length = transforms.Length;
    for (int i = 0; i < length; i++)
    {
      Transform transform = transforms[i];
      transform.position += vector;
    }
  }

  public void MoveToView(Transform target)
  {
    target.position = this.pivot;
  }

  private void OnDidOpenScene()
  {
    foreach (SceneView view in s_SceneViews)
    {
      view.m_SceneLighting = InternalEditorUtility.CalculateShouldEnableLights();
    }
  }

  public void OnDisable()
  {
    if (this.m_Camera != null)
    {
      Object.DestroyImmediate(this.m_Camera.gameObject, true);
    }
    if (this.m_Light[0] != null)
    {
      Object.DestroyImmediate(this.m_Light[0].gameObject, true);
    }
    if (this.m_Light[1] != null)
    {
      Object.DestroyImmediate(this.m_Light[1].gameObject, true);
    }
    if (this.m_Light[2] != null)
    {
      Object.DestroyImmediate(this.m_Light[2].gameObject, true);
    }
    if (s_MipColorsTexture != null)
    {
      Object.DestroyImmediate(s_MipColorsTexture, true);
    }
    s_SceneViews.Remove(this);
    if (s_LastActiveSceneView == this)
    {
      if (s_SceneViews.Count > 0)
      {
        s_LastActiveSceneView = s_SceneViews[0] as SceneView;
      }
      else
      {
        s_LastActiveSceneView = null;
      }
    }
  }

  public void OnEnable()
  {
    this.anims = new AnimValueManager();
    if (this.grid == null)
    {
      this.grid = new SceneViewGrid();
    }
    this.grid.Register(this);
    if (this.svRot == null)
    {
      this.svRot = new SceneViewRotation();
    }
    this.svRot.Register(this);
    base.autoRepaintOnSceneChange = true;
    this.anims.Add(this.m_Rotation);
    this.anims.Add(this.m_Position);
    this.anims.Add(this.m_Size);
    this.anims.Add(this.m_Ortho);
    this.anims.callback = new AnimValueManager.Callback(this.Repaint);
    base.wantsMouseMove = true;
    base.dontClearBackground = true;
    s_SceneViews.Add(this);
  }

  private static void OnForceEnableLights()
  {
    foreach (SceneView view in s_SceneViews)
    {
      view.m_SceneLighting = true;
    }
  }

  private void OnGUI()
  {
    if (s_LastActiveSceneView == null)
    {
      s_LastActiveSceneView = this;
    }
    if (Event.current.type == EventType.ValidateCommand)
    {
      this.CommandsGUI();
    }
    else
    {
      if ((Event.current.type == EventType.mouseDown) || (Event.current.type == EventType.mouseDrag))
      {
        s_LastActiveSceneView = this;
      }
      current = this;
      bool fog = RenderSettings.fog;
      if (!this.m_SceneFx && (Event.current.type == EventType.repaint))
      {
        Unsupported.SetRenderSettingsUseFogNoDirty(false);
      }
      this.DoStatusBarGUI();
      GUI.skin = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Scene);
      this.SetupCamera();
      if (!this.m_SceneLighting)
      {
        this.m_Light[0].transform.rotation = this.m_Camera.transform.rotation;
        if (Event.current.type == EventType.repaint)
        {
          InternalEditorUtility.SetCustomLighting(this.m_Light, kSceneViewMidLight);
        }
      }
      Rect position = new Rect(0f, 17f, base.position.width, base.position.height - 17f);
      float num = Mathf.Sqrt(8100f / (1f + this.m_Camera.aspect));
      float fieldOfView = this.m_Camera.fieldOfView;
      this.m_Camera.fieldOfView = num;
      Handles.ClearCamera(position, this.m_Camera);
      this.m_Camera.fieldOfView = fieldOfView;
      this.m_Camera.cullingMask = Tools.visibleLayers;
      if (Event.current.type == EventType.repaint)
      {
        this.grid.DrawGrid(!this.m_SceneFx);
        Handles.SetSceneViewColors((Color) kSceneViewWire, (Color) kSceneViewWireOverlay, (Color) kSceneViewWireActive, (Color) kSceneViewWireSelected);
        if (this.m_OverlayMode == 2)
        {
          if (s_ShowOverdrawShader == null)
          {
            s_ShowOverdrawShader = EditorGUIUtility.LoadRequired("SceneView/SceneViewShowOverdraw.shader") as Shader;
          }
          this.m_Camera.SetReplacementShader(s_ShowOverdrawShader, "RenderType");
        }
        else if (this.m_OverlayMode == 3)
        {
          if (s_ShowMipsShader == null)
          {
            s_ShowMipsShader = EditorGUIUtility.LoadRequired("SceneView/SceneViewShowMips.shader") as Shader;
          }
          if (s_ShowMipsShader.isSupported)
          {
            CreateMipColorsTexture();
            this.m_Camera.SetReplacementShader(s_ShowMipsShader, "RenderType");
          }
          else
          {
            this.m_Camera.SetReplacementShader(null, "");
          }
        }
        else
        {
          this.m_Camera.SetReplacementShader(null, "");
        }
      }
      Handles.DrawCamera(position, this.m_Camera, this.m_RenderMode);
      if (Event.current.type == EventType.ExecuteCommand)
      {
        this.CommandsGUI();
      }
      else
      {
        this.DrawAlphaOverlay();
        if (!this.m_SceneLighting && (Event.current.type == EventType.repaint))
        {
          InternalEditorUtility.RemoveCustomLighting();
        }
        Handles.DrawBuiltinGizmos();
        this.DefaultHandles();
        this.HandleDragging();
        SceneViewMotion.ArrowKeys(this);
        this.svRot.HandleContextClick();
        SceneViewMotion.FPSControls(this.camera.transform, this);
        this.svRot.OnGUI();
        this.CallOnSceneGUI();
        current = null;
        if (Event.current.type == EventType.repaint)
        {
          Unsupported.SetRenderSettingsUseFogNoDirty(fog);
        }
        GUI.color = Color.white;
      }
    }
  }

  private void OnSelectionChange()
  {
    base.Repaint();
  }

  public static void PickTool()
  {
    Event current = Event.current;
    int controlID = GUIUtility.GetControlID(FocusType.Passive);
    EventType typeForControl = current.GetTypeForControl(controlID);
    switch (typeForControl)
    {
      case EventType.mouseDown:
        if ((HandleUtility.nearestControl == controlID) && (current.button == 0))
        {
          GUIUtility.hotControl = controlID;
        }
        break;

      case EventType.mouseUp:
        if ((GUIUtility.hotControl == controlID) && (current.button == 0))
        {
          Object obj2 = HandleUtility.PickGameObject(Event.current.mousePosition);
          GUIUtility.hotControl = 0;
          if (!EditorGUI.actionKey && !current.shift)
          {
            Selection.activeObject = obj2;
            break;
          }
          if (obj2 == null)
          {
            return;
          }
          Object[] objects = Selection.objects;
          if (Selection.activeGameObject != obj2)
          {
            if (Array.IndexOf<Object>(objects, obj2) != -1)
            {
              Selection.activeObject = obj2;
              Selection.objects = objects;
            }
            else
            {
              Object[] destinationArray = new Object[objects.Length + 1];
              Array.Copy(objects, destinationArray, objects.Length);
              destinationArray[objects.Length] = obj2;
              Selection.activeObject = obj2;
              Selection.objects = destinationArray;
            }
            break;
          }
          Object[] objArray2 = new Object[objects.Length - 1];
          int num2 = 0;
          Object[] objArray3 = objects;
          int length = objArray3.Length;
          for (int i = 0; i < length; i++)
          {
            Object obj3 = objArray3[i];
            if (obj3 != obj2)
            {
              objArray2[num2++] = obj3;
            }
          }
          Selection.objects = objArray2;
        }
        break;

      default:
        if ((typeForControl == EventType.layout) && !Tools.viewToolActive)
        {
          HandleUtility.AddDefaultControl(controlID);
        }
        break;
    }
  }

  private static void PlaceGameObjectInFrontOfSceneView(GameObject go)
  {
    if (s_SceneViews.Count >= 1)
    {
      SceneView view = s_LastActiveSceneView;
      if (view == null)
      {
        view = s_SceneViews[0] as SceneView;
      }
      if (view != null)
      {
        view.MoveToView(go.transform);
      }
    }
  }

  public static void RepaintAll()
  {
    foreach (SceneView view in s_SceneViews)
    {
      view.Repaint();
    }
  }

  private void Setup()
  {
    Type[] components = new Type[] { typeof(Camera) };
    GameObject obj2 = EditorUtility.CreateGameObjectWithHideFlags("SceneCamera", HideFlags.HideAndDontSave, components);
    obj2.AddComponent("GUILayer");
    obj2.AddComponent("FlareLayer");
    obj2.AddComponent("HaloLayer");
    this.m_Camera = obj2.camera;
    this.m_Camera.enabled = false;
    for (int i = 0; i < 3; i++)
    {
      Type[] typeArray2 = new Type[] { typeof(Light) };
      GameObject obj3 = EditorUtility.CreateGameObjectWithHideFlags("SceneLight", HideFlags.HideAndDontSave, typeArray2);
      this.m_Light[i] = obj3.light;
      this.m_Light[i].type = LightType.Directional;
      this.m_Light[i].intensity = 0.5f;
      this.m_Light[i].enabled = false;
    }
    this.m_Light[0].color = kSceneViewFrontLight;
    this.m_Light[1].color = kSceneViewUpLight - kSceneViewMidLight;
    this.m_Light[1].transform.LookAt(Vector3.down);
    this.m_Light[1].renderMode = LightRenderMode.ForceVertex;
    this.m_Light[2].color = kSceneViewDownLight - kSceneViewMidLight;
    this.m_Light[2].transform.LookAt(Vector3.up);
    this.m_Light[2].renderMode = LightRenderMode.ForceVertex;
    HandleUtility.handleMaterial.SetColor("_SkyColor", (Color) (kSceneViewUpLight * 1.5f));
    HandleUtility.handleMaterial.SetColor("_GroundColor", (Color) (kSceneViewDownLight * 1.5f));
    HandleUtility.handleMaterial.SetColor("_Color", (Color) (kSceneViewFrontLight * 1.5f));
  }

  private void SetupCamera()
  {
    if (this.m_Camera == null)
    {
      this.Setup();
    }
    if (this.m_OverlayMode == 2)
    {
      this.m_Camera.backgroundColor = Color.black;
    }
    else
    {
      this.m_Camera.backgroundColor = (Color) kSceneViewBackground;
    }
    this.m_Camera.transform.rotation = (Quaternion) this.m_Rotation;
    float num = this.m_Ortho.Fade(90f, 0f);
    if (num > 3f)
    {
      this.m_Camera.orthographic = false;
      float aspect = this.m_Camera.aspect;
      this.m_Camera.fieldOfView = Mathf.Sqrt((num * num) / (1f + aspect));
      float num3 = this.size / Mathf.Tan((num * 3.141593f) / 360f);
      Vector3 vector = new Vector3(0f, 0f, -num3);
      this.m_Camera.transform.position = (Vector3) (this.m_Position + (this.m_Camera.transform.rotation * vector));
      if (this.size < 1f)
      {
        this.m_Camera.near = 0.005f;
        this.m_Camera.far = 1000f;
      }
      else if (this.size < 100f)
      {
        this.m_Camera.near = 0.03f;
        this.m_Camera.far = 3000f;
      }
      else if (this.size < 1000f)
      {
        this.m_Camera.near = 0.5f;
        this.m_Camera.far = 20000f;
      }
      else
      {
        this.m_Camera.near = 1f;
        this.m_Camera.far = 1000000f;
      }
    }
    else
    {
      float num4 = this.m_Camera.aspect;
      float num5 = Mathf.Sqrt((this.size * this.size) / (1f + num4));
      Vector3 vector2 = new Vector3(0f, 0f, -num5);
      this.m_Camera.transform.position = (Vector3) (this.m_Position + (this.m_Camera.transform.rotation * vector2));
      this.m_Camera.orthographic = true;
      this.m_Camera.orthographicSize = num5;
      this.m_Camera.transform.position = (Vector3) this.m_Position;
      this.m_Camera.far = this.size + 3000f;
      this.m_Camera.near = -this.size - 3000f;
    }
    Handles.EnableCameraFx(this.m_Camera, this.m_SceneFx);
    this.m_Light[0].transform.position = this.m_Camera.transform.position;
    this.m_Light[0].transform.rotation = this.m_Camera.transform.rotation;
  }

  [MenuItem("GameObject/Align View to Selected", true)]
  private static bool ValidateAlignViewToSelected()
  {
    return ((s_LastActiveSceneView != null) && (Selection.activeTransform != null));
  }

  [MenuItem("GameObject/Align With View %#f", true)]
  private static bool ValidateAlignWithView()
  {
    return ((s_LastActiveSceneView != null) && (Selection.activeTransform != null));
  }

  [MenuItem("GameObject/Move To View %f", true)]
  private static bool ValidateMoveToView()
  {
    return ((s_LastActiveSceneView != null) && (Selection.transforms.Length != 0));
  }

  // Properties
  public IEnumerable<GameObject> activeGameObjects
  {
    get
    {
      <>c__CompilerGenerated2 generated = new <>c__CompilerGenerated2(-2);
      return (IEnumerable<GameObject>) generated;
    }
  }

  public Camera camera
  {
    get
    {
      return this.m_Camera;
    }
  }

  public bool orthographic
  {
    get
    {
      return this.m_Ortho.value;
    }
    set
    {
      this.m_Ortho.value = value;
    }
  }

  public Vector3 pivot
  {
    get
    {
      return (Vector3) this.m_Position;
    }
    set
    {
      this.m_Position.value = value;
    }
  }

  public Quaternion rotation
  {
    get
    {
      return (Quaternion) this.m_Rotation;
    }
    set
    {
      this.m_Rotation.value = value;
    }
  }

  public float size
  {
    get
    {
      return (float) this.m_Size;
    }
    set
    {
      this.m_Size.value = value;
    }
  }
}

 
 
правильный вопрос - половина ответа. учитесь формулировать вопросы понятно.
Новости > _Telegram чат @unity3d_ru (11.6k/4.8k online) > _Telegram канал @unity_news (4.6k подписчиков) > Телеграм тема > "Спасибо"
Аватара пользователя
DbIMok
Адепт
 
Сообщения: 6372
Зарегистрирован: 31 июл 2009, 14:05

Re: Знаете ли вы что...

Сообщение DbIMok 19 апр 2010, 23:53

Синтаксис:
Используется csharp
public class TerrainLightmapper
{
  // Methods
  public static void Generate(Vector3 terrainPosition, TerrainData terrainData, TerrainCollider collider, Light[] lights, Color ambient, int shadowSamples, Texture2D lightmap, Texture2D shadowMap)
  {
    int width = lightmap.width;
    int height = lightmap.height;
    Color[] colors = new Color[width * height];
    Color[] colorArray2 = new Color[width * height];
    int index = 0;
    for (int i = 0; i < height; i++)
    {
      for (int m = 0; m < width; m++)
      {
        colors[index] = (Color) (ambient * 0.5f);
        float r = ambient.grayscale;
        colorArray2[index] = new Color(r, r, r, r);
        index++;
      }
    }
    float grayscale = ambient.grayscale;
    Light[] lightArray = lights;
    int length = lightArray.Length;
    for (int j = 0; j < length; j++)
    {
      Light light = lightArray[j];
      grayscale += light.color.grayscale * light.intensity;
    }
    Vector3 size = terrainData.size;
    RaycastHit hitInfo = new RaycastHit();
    float distance = size.magnitude * 3f;
    Quaternion[] quaternionArray = SuperSampleShadowJitter(4f, shadowSamples);
    TerrainInspectorUtil.RefreshPhysicsInEditMode();
    index = 0;
    for (int k = 0; k < height; k++)
    {
      EditorUtility.DisplayProgressBar("Computing Lightmap", <span class="posthilit">string</span>.Format("Computing Lightmap with resolution {0}x{1}", width, height), ((float) k) / ((float) height));
      for (int n = 0; n < width; n++)
      {
        float x = ((float) n) / ((float) (width - 1));
        float y = ((float) k) / ((float) (height - 1));
        Vector3 interpolatedNormal = terrainData.GetInterpolatedNormal(x, y);
        Vector3 vector3 = new Vector3(terrainPosition.x + (size.x * x), (terrainPosition.y + terrainData.GetInterpolatedHeight(x, y)) + (size.y * 0.001f), terrainPosition.z + (size.z * y));
        Light[] lightArray2 = lights;
        int num16 = lightArray2.Length;
        for (int num15 = 0; num15 < num16; num15++)
        {
          Light light2 = lightArray2[num15];
          Vector3 rhs = Vector3.op_UnaryNegation(light2.transform.forward);
          Color color = (Color) (light2.color * light2.intensity);
          float num17 = light2.color.grayscale * light2.intensity;
          int cullingMask = light2.cullingMask;
          int num19 = 0;
          if (light2.shadows != LightShadows.None)
          {
            num19 = shadowSamples;
          }
          Color color2 = (Color) (Mathf.Max(Vector3.Dot(interpolatedNormal, rhs), 0f) * color);
          int num21 = 0;
          if (num19 != 0)
          {
            for (int num22 = 0; num22 < quaternionArray.Length; num22++)
            {
              Vector3 direction = (Vector3) (quaternionArray[num22] * rhs);
              Vector3 origin = vector3;
              Ray ray = new Ray(origin, direction);
              if (Physics.Raycast(ray, out hitInfo, distance, cullingMask & -5))
              {
                if (!hitInfo.collider.isTrigger)
                {
                  num21++;
                }
                else
                {
                  RaycastHit[] hitArray2 = Physics.RaycastAll(ray, distance, cullingMask & -5);
                  int num24 = hitArray2.Length;
                  for (int num23 = 0; num23 < num24; num23++)
                  {
                    RaycastHit hit2 = hitArray2[num23];
                    if (!hit2.collider.isTrigger)
                    {
                      num21++;
                      break;
                    }
                  }
                }
              }
            }
            float num25 = 1f - (((float) num21) / ((float) quaternionArray.Length));
            colors[index] += (Color) (num25 * color2);
            float num26 = (num17 / grayscale) * num25;
            Color color5 = new Color(num26, num26, num26, num26);
            colorArray2[index] += color5;
          }
          else
          {
            colors[index] += color2;
            float num27 = num17 / grayscale;
            Color color6 = new Color(num27, num27, num27, num27);
            colorArray2[index] += color6;
          }
        }
        colors[index].a = 1f;
        colorArray2[index].a = 1f;
        index++;
      }
    }
    shadowMap.SetPixels(colorArray2);
    shadowMap.Apply();
    lightmap.SetPixels(colors);
    lightmap.Apply();
    EditorUtility.ClearProgressBar();
  }

  public static Quaternion[] SuperSampleShadowJitter(float shadowAngle, int shadowSamples)
  {
    Quaternion[] quaternionArray = new Quaternion[shadowSamples];
    for (int i = 0; i < shadowSamples; i++)
    {
      quaternionArray[i] = Quaternion.Euler(Random.Range((float) -1f, (float) 1f) * shadowAngle, Random.Range((float) -1f, (float) 1f) * shadowAngle, 0f);
    }
    return quaternionArray;
  }

  public static Vector3[] SuperSampleShadowOffset(float shadowSize, int shadowSamples)
  {
    Vector3[] vectorArray = new Vector3[shadowSamples];
    for (int i = 0; i < shadowSamples; i++)
    {
      vectorArray[i] = (Vector3) (Random.insideUnitSphere * shadowSize);
    }
    return vectorArray;
  }

  public static void UpdateTreeColor(Texture2D shadowMap, TerrainData terrain)
  {
    TreeInstance[] treeInstances = terrain.treeInstances;
    for (int i = 0; i < treeInstances.Length; i++)
    {
      float x = treeInstances[i].position.x;
      float z = treeInstances[i].position.z;
      Color pixelBilinear = shadowMap.GetPixelBilinear(x, z);
      pixelBilinear.a = 1f;
      treeInstances[i].color = pixelBilinear;
    }
    terrain.treeInstances = treeInstances;
  }

  public static void UpdateTreeLightmapColor(Texture2D shadowMap, TerrainData terrain)
  {
    TreeInstance[] treeInstances = terrain.treeInstances;
    for (int i = 0; i < treeInstances.Length; i++)
    {
      float x = treeInstances[i].position.x;
      float z = treeInstances[i].position.z;
      Color pixelBilinear = shadowMap.GetPixelBilinear(x, z);
      pixelBilinear.a = 1f;
      treeInstances[i].lightmapColor = pixelBilinear;
    }
    terrain.treeInstances = treeInstances;
  }
}
правильный вопрос - половина ответа. учитесь формулировать вопросы понятно.
Новости > _Telegram чат @unity3d_ru (11.6k/4.8k online) > _Telegram канал @unity_news (4.6k подписчиков) > Телеграм тема > "Спасибо"
Аватара пользователя
DbIMok
Адепт
 
Сообщения: 6372
Зарегистрирован: 31 июл 2009, 14:05

Re: Знаете ли вы что...

Сообщение DbIMok 19 апр 2010, 23:54

Синтаксис:
Используется csharp
public class UndoSnapshot
{
  // Fields
  private MonoReloadableIntPtrClear m_Property;

  // Methods
  [MethodImpl(MethodImplOptions.InternalCall)]
  public extern UndoSnapshot(Object[] objectsToUndo);
  [MethodImpl(MethodImplOptions.InternalCall)]
  public extern void Dispose();
  [MethodImpl(MethodImplOptions.InternalCall)]
  public extern void Restore();
}
 
правильный вопрос - половина ответа. учитесь формулировать вопросы понятно.
Новости > _Telegram чат @unity3d_ru (11.6k/4.8k online) > _Telegram канал @unity_news (4.6k подписчиков) > Телеграм тема > "Спасибо"
Аватара пользователя
DbIMok
Адепт
 
Сообщения: 6372
Зарегистрирован: 31 июл 2009, 14:05

Re: Знаете ли вы что...

Сообщение DbIMok 19 апр 2010, 23:55

Синтаксис:
Используется csharp
public class UnityStats
{
  // Methods
  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern <span class="posthilit">string</span> GetNetworkStats(int i);

  // Properties
  public static int drawCalls { [MethodImpl(MethodImplOptions.InternalCall)] get; }

  public static float frameTime { [MethodImpl(MethodImplOptions.InternalCall)] get; }

  public static int ibUploadBytes { [MethodImpl(MethodImplOptions.InternalCall)] get; }

  public static int ibUploads { [MethodImpl(MethodImplOptions.InternalCall)] get; }

  public static int renderTextureBytes { [MethodImpl(MethodImplOptions.InternalCall)] get; }

  public static int renderTextureChanges { [MethodImpl(MethodImplOptions.InternalCall)] get; }

  public static int renderTextureCount { [MethodImpl(MethodImplOptions.InternalCall)] get; }

  public static int screenBytes { [MethodImpl(MethodImplOptions.InternalCall)] get; }

  public static <span class="posthilit">string</span> screenRes { [MethodImpl(MethodImplOptions.InternalCall)] get; }

  public static int triangles { [MethodImpl(MethodImplOptions.InternalCall)] get; }

  public static int usedTextureCount { [MethodImpl(MethodImplOptions.InternalCall)] get; }

  public static int usedTextureMemorySize { [MethodImpl(MethodImplOptions.InternalCall)] get; }

  public static int vboTotal { [MethodImpl(MethodImplOptions.InternalCall)] get; }

  public static int vboTotalBytes { [MethodImpl(MethodImplOptions.InternalCall)] get; }

  public static int vboUploadBytes { [MethodImpl(MethodImplOptions.InternalCall)] get; }

  public static int vboUploads { [MethodImpl(MethodImplOptions.InternalCall)] get; }

  public static int vertices { [MethodImpl(MethodImplOptions.InternalCall)] get; }

  public static int visibleAnimations { [MethodImpl(MethodImplOptions.InternalCall)] get; }

  public static int visibleSkinnedMeshes { [MethodImpl(MethodImplOptions.InternalCall)] get; }
}
 
правильный вопрос - половина ответа. учитесь формулировать вопросы понятно.
Новости > _Telegram чат @unity3d_ru (11.6k/4.8k online) > _Telegram канал @unity_news (4.6k подписчиков) > Телеграм тема > "Спасибо"
Аватара пользователя
DbIMok
Адепт
 
Сообщения: 6372
Зарегистрирован: 31 июл 2009, 14:05

Re: Знаете ли вы что...

Сообщение DbIMok 20 апр 2010, 00:00

Синтаксис:
Используется csharp
public class AssetUtility
{
  // Methods
  public AssetUtility();
  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern void AddAssetToSameFile(Object newAsset, Object sameAssetFile);
  public static void CreateAsset(Object theAsset, <span class="posthilit">string</span> assetName);
  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern void CreateAsset(Object theAsset, <span class="posthilit">string</span> assetName, <span class="posthilit">string</span> extension);
  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern Object CreateEngineObject(<span class="posthilit">string</span> className);
  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern int GetObjectCountAtPath(<span class="posthilit">string</span> path);
  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern Object LoadWithPathAndFileID(<span class="posthilit">string</span> path, int i);
  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern void SaveAsset(Object newAsset);
}
 
правильный вопрос - половина ответа. учитесь формулировать вопросы понятно.
Новости > _Telegram чат @unity3d_ru (11.6k/4.8k online) > _Telegram канал @unity_news (4.6k подписчиков) > Телеграм тема > "Спасибо"
Аватара пользователя
DbIMok
Адепт
 
Сообщения: 6372
Зарегистрирован: 31 июл 2009, 14:05

Re: Знаете ли вы что...

Сообщение DbIMok 20 апр 2010, 00:02

Синтаксис:
Используется csharp
public class Caching
{
  // Methods
  public Caching();
  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern bool Authorize(<span class="posthilit">string</span> name, <span class="posthilit">string</span> domain, int size, <span class="posthilit">string</span> signature);
  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern void CleanCache();
  [MethodImpl(MethodImplOptions.InternalCall), Obsolete("this API is for not for public use.")]
  public static extern void CleanNamedCache(<span class="posthilit">string</span> name);
  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern bool DeleteFromCache(<span class="posthilit">string</span> url);

  // Properties
  public static bool enabled { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }
  public static int expirationDelay { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }
  [Obsolete("this API is for not for public use.")]
  public static CacheIndex[] index { [MethodImpl(MethodImplOptions.InternalCall)] get; }
  public static int spaceAvailable { [MethodImpl(MethodImplOptions.InternalCall)] get; }
  public static int spaceUsed { [MethodImpl(MethodImplOptions.InternalCall)] get; }
}
 
правильный вопрос - половина ответа. учитесь формулировать вопросы понятно.
Новости > _Telegram чат @unity3d_ru (11.6k/4.8k online) > _Telegram канал @unity_news (4.6k подписчиков) > Телеграм тема > "Спасибо"
Аватара пользователя
DbIMok
Адепт
 
Сообщения: 6372
Зарегистрирован: 31 июл 2009, 14:05

Re: Знаете ли вы что...

Сообщение DbIMok 20 апр 2010, 00:04

Синтаксис:
Используется csharp
public class ControllerControllerHit
{
  // Fields
  private CharacterController m_Controller;
  private CharacterController m_Other;
  private bool m_Push;

  // Methods
  public ControllerControllerHit();

  // Properties
  public CharacterController controller { get; }
  public CharacterController other { get; }
  private bool push { get; set; }
}
 
правильный вопрос - половина ответа. учитесь формулировать вопросы понятно.
Новости > _Telegram чат @unity3d_ru (11.6k/4.8k online) > _Telegram канал @unity_news (4.6k подписчиков) > Телеграм тема > "Спасибо"
Аватара пользователя
DbIMok
Адепт
 
Сообщения: 6372
Зарегистрирован: 31 июл 2009, 14:05

Re: Знаете ли вы что...

Сообщение DbIMok 20 апр 2010, 00:10

Синтаксис:
Используется csharp
public class GUIClip
{
  // Fields
  internal static bool enabled = true;
  private Vector2 globalScrollOffset;
  private static float o1 = -10000f;
  private static float o2 = 10000f;
  private static float o3 = 0f;
  private static float o4 = 0f;
  private Rect physicalRect;
  private Vector2 renderOffset;
  internal static Vector2 s_AbsoluteLastMousePosition;
  internal static Vector2 s_AbsoluteMousePosition;
  public static Stack s_GUIClips = new Stack();
  private static Matrix4x4 s_InverseMatrix = Matrix4x4.identity;
  private static Matrix4x4 s_Matrix = Matrix4x4.identity;
  private static Rect s_VisibleRect;
  private Vector2 scrollOffset;

  // Methods
  private GUIClip(Rect physicalRect, Vector2 scrollOffset, Vector2 renderOffset, Vector2 globalScrollOffset)
  {
    this.physicalRect = physicalRect;
    this.scrollOffset = scrollOffset;
    this.renderOffset = renderOffset;
    this.globalScrollOffset = globalScrollOffset;
  }

  private void Apply()
  {
    this.CalculateMouseValues();
    s_VisibleRect = new Rect(-this.scrollOffset.x, -this.scrollOffset.y, this.physicalRect.width, this.physicalRect.height);
    if (Event.current.type == EventType.repaint)
    {
      Rect rect = new Rect(this.physicalRect);
      if (rect.width < 0f)
      {
        rect.width = 0f;
      }
      if (rect.height < 0f)
      {
        rect.height = 0f;
      }
      rect.x -= this.renderOffset.x;
      rect.y -= this.renderOffset.y;
      rect.x = Mathf.Round(rect.x);
      rect.y = Mathf.Round(rect.y);
      rect.width = Mathf.Round(rect.width);
      rect.height = Mathf.Round(rect.height);
      Matrix4x4 identity = Matrix4x4.identity;
      Vector3 s = new Vector3(rect.width / ((float) Screen.width), rect.height / ((float) Screen.height), 1f);
      Vector3 v = new Vector3(rect.x, rect.y, 0f);
      Vector3 vector2 = s_Matrix.MultiplyVector(v);
      Vector2 vector5 = new Vector2(vector2.x * s.x, vector2.y * s.y);
      identity = Matrix4x4.TRS((Vector3) vector5, Quaternion.identity, s);
      Rect pixelRect = new Rect(0f, 0f, (float) Screen.width, (float) Screen.height);
      GL.Viewport(pixelRect);
      SetGUIClipRect(s_VisibleRect);
      Vector2 vector3 = s_Matrix.MultiplyVector((Vector3) Vector2.op_UnaryNegation(this.scrollOffset));
      vector3.x *= s.x;
      vector3.y *= s.y;
      LoadPixelMatrix(vector3.x, Mathf.Round(this.physicalRect.width) + vector3.x, Mathf.Round(this.physicalRect.height) + vector3.y, vector3.y, identity * s_Matrix);
    }
  }

  internal static void Begin()
  {
    s_AbsoluteMousePosition = Event.current.mousePosition;
    s_AbsoluteLastMousePosition = s_AbsoluteMousePosition - Event.current.delta;
    s_GUIClips.Clear();
    Matrix4x4 identity = Matrix4x4.identity;
    s_InverseMatrix = identity;
    s_Matrix = identity;
    Rect physicalRect = new Rect(o1, o1, 40000f, 40000f);
    Vector2 scrollOffset = new Vector2(o2, o2);
    Vector2 renderOffset = new Vector2(o3, o3);
    Vector2 globalScrollOffset = new Vector2(o4, o4);
    GUIClip clip = new GUIClip(physicalRect, scrollOffset, renderOffset, globalScrollOffset);
    s_GUIClips.Push(clip);
    clip.Apply();
  }

  private void CalculateMouseValues()
  {
    GUIClip clip = (GUIClip) s_GUIClips.Peek();
    Event.current.mousePosition = Clip(s_AbsoluteMousePosition);
    enabled = clip.physicalRect.Contains((Vector2) s_InverseMatrix.MultiplyPoint((Vector3) s_AbsoluteMousePosition));
    if (Event.current.type != EventType.scrollWheel)
    {
      Event.current.delta = Event.current.mousePosition - Clip(s_AbsoluteLastMousePosition);
    }
  }

  public static Rect Clip(Rect absoluteRect)
  {
    GUIClip clip = (GUIClip) s_GUIClips.Peek();
    return new Rect((absoluteRect.x - clip.globalScrollOffset.x) - clip.physicalRect.x, (absoluteRect.y - clip.globalScrollOffset.y) - clip.physicalRect.y, absoluteRect.width, absoluteRect.height);
  }

  public static Vector2 Clip(Vector2 absolutePos)
  {
    GUIClip clip = (GUIClip) s_GUIClips.Peek();
    Vector2 vector = new Vector2(clip.physicalRect.x, clip.physicalRect.y);
    return ((s_InverseMatrix.MultiplyPoint((Vector3) absolutePos) - clip.scrollOffset) - vector);
  }

  internal static void End()
  {
    if (((s_GUIClips.Count != 1) && (Event.current.type != EventType.ignore)) && (Event.current.type != EventType.used))
    {
      if (s_GUIClips.Count <= 1)
      {
        Debug.LogError("GUI Error: You are popping more GUIClips than you are pushing. Make sure they are balanced (type:" + Event.current.type + ")");
        return;
      }
      Debug.LogError("GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced (type:" + Event.current.type + ")");
    }
    s_GUIClips.Pop();
  }

  internal static void EndThroughException()
  {
    s_GUIClips.Clear();
  }

  [MethodImpl(MethodImplOptions.InternalCall)]
  private static extern void LoadPixelMatrix(float left, float right, float bottom, float top, Matrix4x4 mat);
  public static void Pop()
  {
    s_GUIClips.Pop();
    ((GUIClip) s_GUIClips.Peek()).Apply();
  }

  public static void Push(Rect screenRect)
  {
    Push(screenRect, Vector2.zero, Vector2.zero, false);
  }

  public static void Push(Rect screenRect, Vector2 scrollOffset)
  {
    Push(screenRect, scrollOffset, Vector2.zero, false);
  }

  public static void Push(Rect screenRect, Vector2 scrollOffset, Vector2 renderOffset, bool resetOffset)
  {
    GUIClip clip2;
    GUIClip clip = (GUIClip) s_GUIClips.Peek();
    float left = (screenRect.x + clip.physicalRect.x) + clip.scrollOffset.x;
    float right = (screenRect.xMax + clip.physicalRect.x) + clip.scrollOffset.x;
    float top = (screenRect.y + clip.physicalRect.y) + clip.scrollOffset.y;
    float bottom = (screenRect.yMax + clip.physicalRect.y) + clip.scrollOffset.y;
    if (left < clip.physicalRect.x)
    {
      scrollOffset.x += left - clip.physicalRect.x;
      left = clip.physicalRect.x;
    }
    if (top < clip.physicalRect.y)
    {
      scrollOffset.y += top - clip.physicalRect.y;
      top = clip.physicalRect.y;
    }
    if (right > clip.physicalRect.xMax)
    {
      right = clip.physicalRect.xMax;
    }
    if (bottom > clip.physicalRect.yMax)
    {
      bottom = clip.physicalRect.yMax;
    }
    if (right <= left)
    {
      right = left;
    }
    if (bottom <= top)
    {
      bottom = top;
    }
    Rect physicalRect = Rect.MinMaxRect(left, top, right, bottom);
    if (!resetOffset)
    {
      clip2 = new GUIClip(physicalRect, scrollOffset, clip.renderOffset, clip.globalScrollOffset + scrollOffset);
    }
    else
    {
      Vector2 vector = new Vector2((physicalRect.x + scrollOffset.x) + renderOffset.x, (physicalRect.y + scrollOffset.y) + renderOffset.y);
      clip2 = new GUIClip(physicalRect, scrollOffset, vector, clip.globalScrollOffset + scrollOffset);
    }
    s_GUIClips.Push(clip2);
    clip2.Apply();
  }

  public static void Reapply()
  {
    ((GUIClip) s_GUIClips.Peek()).Apply();
  }

  [MethodImpl(MethodImplOptions.InternalCall)]
  public static extern void SetGUIClipRect(Rect r);
  public override <span class="posthilit">string</span> ToString()
  {
    object[] args = new object[] { this.physicalRect, this.scrollOffset, this.renderOffset, this.globalScrollOffset };
    return <span class="posthilit">string</span>.Format("GUIClip: physicalRect {0}, scrollOffset {1}, renderOffset {2}, globalScrollOffset{3}", args);
  }

  public static Rect Unclip(Rect rect)
  {
    GUIClip clip = (GUIClip) s_GUIClips.Peek();
    return new Rect((rect.x + clip.scrollOffset.x) + clip.physicalRect.x, (rect.y + clip.scrollOffset.y) + clip.physicalRect.y, rect.width, rect.height);
  }

  public static Vector2 Unclip(Vector2 pos)
  {
    GUIClip clip = (GUIClip) s_GUIClips.Peek();
    Vector2 vector = new Vector2(clip.physicalRect.x, clip.physicalRect.y);
    return ((s_Matrix.MultiplyPoint((Vector3) pos) + clip.scrollOffset) + vector);
  }

  // Properties
  public static Matrix4x4 matrix
  {
    get
    {
      return s_Matrix;
    }
    set
    {
      Matrix4x4 matrixx;
      if (!Matrix4x4.Invert(value, out matrixx))
      {
        Debug.LogError("Ignoring invalid matrix assinged to GUI.matrix - the matrix needs to be invertible. Did you scale by 0 on Z-axis?");
      }
      else
      {
        s_Matrix = value;
        s_InverseMatrix = matrixx;
        Reapply();
      }
    }
  }

  public static Rect topmostRect
  {
    get
    {
      return ((GUIClip) s_GUIClips.Peek()).physicalRect;
    }
  }

  public static Rect visibleRect
  {
    get
    {
      return s_VisibleRect;
    }
  }
}
правильный вопрос - половина ответа. учитесь формулировать вопросы понятно.
Новости > _Telegram чат @unity3d_ru (11.6k/4.8k online) > _Telegram канал @unity_news (4.6k подписчиков) > Телеграм тема > "Спасибо"
Аватара пользователя
DbIMok
Адепт
 
Сообщения: 6372
Зарегистрирован: 31 июл 2009, 14:05

След.

Вернуться в Tips & Tricks

Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 1