﻿// Decompiled with JetBrains decompiler
// Type: EZScreenPlacementMirror
// Assembly: Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 19851F1B-4780-4223-BA01-2C20F2CD781E
// Assembly location: C:\Users\CGA Computer\Desktop\LEGO Universe Stuff\LOCO Server\Unity Web Player Extractor\Saved Files\LOCO Server.unity3d_unpacked\Assembly-CSharp.dll

using UnityEngine;

public class EZScreenPlacementMirror
{
  public Vector3 worldPos;
  public Vector3 screenPos;
  public EZScreenPlacement.RelativeTo relativeTo;
  public Transform relativeObject;
  public Camera renderCamera;
  public Vector2 screenSize;

  public EZScreenPlacementMirror()
  {
    this.relativeTo = new EZScreenPlacement.RelativeTo((EZScreenPlacement) null);
  }

  public virtual void Mirror(EZScreenPlacement sp)
  {
    this.worldPos = ((Component) sp).get_transform().get_position();
    this.screenPos = sp.screenPos;
    this.relativeTo.Copy(sp.relativeTo);
    this.relativeObject = sp.relativeObject;
    this.renderCamera = sp.renderCamera;
    this.screenSize = new Vector2(sp.renderCamera.get_pixelWidth(), sp.renderCamera.get_pixelHeight());
  }

  public virtual bool Validate(EZScreenPlacement sp)
  {
    if (sp.relativeTo.horizontal != EZScreenPlacement.HORIZONTAL_ALIGN.OBJECT && sp.relativeTo.vertical != EZScreenPlacement.VERTICAL_ALIGN.OBJECT)
      sp.relativeObject = (Transform) null;
    if (Object.op_Inequality((Object) sp.relativeObject, (Object) null) && !EZScreenPlacement.TestDepenency(sp))
    {
      string[] strArray = new string[5];
      int index1 = 0;
      string str1 = "ERROR: The Relative Object you recently assigned on \"";
      strArray[index1] = str1;
      int index2 = 1;
      string name1 = ((Object) sp).get_name();
      strArray[index2] = name1;
      int index3 = 2;
      string str2 = "\" which points to \"";
      strArray[index3] = str2;
      int index4 = 3;
      string name2 = ((Object) sp.relativeObject).get_name();
      strArray[index4] = name2;
      int index5 = 4;
      string str3 = "\" would create a circular dependency.  Please check your placement dependencies to resolve this.";
      strArray[index5] = str3;
      Debug.LogError((object) string.Concat(strArray));
      sp.relativeObject = (Transform) null;
    }
    return true;
  }

  public virtual bool DidChange(EZScreenPlacement sp)
  {
    if (Vector3.op_Inequality(this.worldPos, ((Component) sp).get_transform().get_position()))
    {
      if (sp.allowTransformDrag)
        sp.WorldToScreenPos(((Component) sp).get_transform().get_position());
      else
        sp.PositionOnScreen();
      return true;
    }
    return Vector3.op_Inequality(this.screenPos, sp.screenPos) || Object.op_Inequality((Object) this.renderCamera, (Object) null) && (this.screenSize.x != (double) sp.renderCamera.get_pixelWidth() || this.screenSize.y != (double) sp.renderCamera.get_pixelHeight()) || (!this.relativeTo.Equals(sp.relativeTo) || Object.op_Inequality((Object) this.renderCamera, (Object) sp.renderCamera) || Object.op_Inequality((Object) this.relativeObject, (Object) sp.relativeObject));
  }
}
