private void SetGetFishUI(FishInfo _info) { if (!Singleton <Manager.Map> .IsInstance()) { return; } FishingManager fishingSystem = Singleton <Manager.Map> .Instance.FishingSystem; this.getFishInfo = _info; this.DestroyGetFishModel(); Resources.FishingTable fishing = Singleton <Resources> .Instance.Fishing; Dictionary <int, Tuple <GameObject, RuntimeAnimatorController> > fishModelTable = fishing.FishModelTable; Renderer renderer = (Renderer)null; float num1 = -50f; int modelId = _info.ModelID; Tuple <GameObject, RuntimeAnimatorController> tuple; if (fishModelTable.TryGetValue(modelId, out tuple) && Object.op_Inequality((Object)tuple.Item1, (Object)null)) { this.getFishModel = (GameObject)Object.Instantiate <GameObject>((M0)tuple.Item1, new Vector3(0.0f, num1, 0.0f), Quaternion.get_identity()); this.getFishModel.get_transform().SetParent(fishingSystem.RootObject.get_transform(), true); this.SetLayer(this.getFishModel.get_transform(), LayerMask.NameToLayer("Fishing")); Animator componentInChildren = (Animator)this.getFishModel.GetComponentInChildren <Animator>(true); if (Object.op_Inequality((Object)componentInChildren, (Object)null) && Object.op_Inequality((Object)tuple.Item2, (Object)null)) { componentInChildren.set_runtimeAnimatorController(tuple.Item2); } renderer = (Renderer)this.getFishModel.GetComponentInChildren <Renderer>(true); } Camera fishModelCamera = fishingSystem.fishModelCamera; if (Object.op_Inequality((Object)renderer, (Object)null)) { float num2 = fishModelCamera.get_nearClipPlane() + 5f; Bounds bounds = renderer.get_bounds(); Vector3 center = ((Bounds) ref bounds).get_center(); ref Vector3 local = ref center; local.x = (__Null)(local.x - ((double)num2 + ((Bounds) ref bounds).get_extents().x)); ((Component)fishModelCamera).get_transform().set_position(center); ((Component)fishModelCamera).get_transform().set_rotation(Quaternion.Euler(0.0f, 90f, 0.0f)); fishModelCamera.set_orthographic(true); float num3 = Mathf.Max((float)((Bounds) ref bounds).get_extents().z, (float)((Bounds) ref bounds).get_extents().y); fishModelCamera.set_orthographicSize(Mathf.Max(num3, fishing.ResultFishReferenceExtent) * 1.2f); }
public void Initialize(PetHomePoint _homePoint) { this.Clear(); PetHomePoint petHomePoint = _homePoint; this.HomePoint = petHomePoint; if (Object.op_Equality((Object)petHomePoint, (Object)null) || this.AnimalData == null) { return; } Resources.FishingTable fishingTable = !Singleton <Resources> .IsInstance() ? (Resources.FishingTable)null : Singleton <Resources> .Instance.Fishing; if (fishingTable == null) { return; } Dictionary <int, Dictionary <int, FishInfo> > fishInfoTable = fishingTable.FishInfoTable; Dictionary <int, Tuple <GameObject, RuntimeAnimatorController> > fishModelTable = fishingTable.FishModelTable; Dictionary <int, FishInfo> dictionary; FishInfo fishInfo; Tuple <GameObject, RuntimeAnimatorController> tuple; if (!((IReadOnlyDictionary <int, Dictionary <int, FishInfo> >)fishInfoTable).IsNullOrEmpty <int, Dictionary <int, FishInfo> >() && !((IReadOnlyDictionary <int, Tuple <GameObject, RuntimeAnimatorController> >)fishModelTable).IsNullOrEmpty <int, Tuple <GameObject, RuntimeAnimatorController> >() && (fishInfoTable.TryGetValue(this.AnimalData.ItemCategoryID, out dictionary) && !((IReadOnlyDictionary <int, FishInfo>)dictionary).IsNullOrEmpty <int, FishInfo>()) && (dictionary.TryGetValue(this.AnimalData.ItemID, out fishInfo) && fishModelTable.TryGetValue(fishInfo.ModelID, out tuple))) { this.LoadBody(tuple.Item1); if (Object.op_Inequality((Object)this.animator, (Object)null)) { this.animator.set_runtimeAnimatorController(tuple.Item2); } _homePoint.SetRootPoint(fishInfo.TankPointID, (IPetAnimal)this); this.FollowTarget = _homePoint.GetRootPoint(fishInfo.TankPointID); if (Object.op_Inequality((Object)this.bodyObject, (Object)null)) { this._nicknameRoot = new GameObject("Nickname Root").get_transform(); this._nicknameRoot.SetParent(this.bodyObject.get_transform(), false); Renderer componentInChildren = (Renderer)this.bodyObject.GetComponentInChildren <Renderer>(true); if (Object.op_Inequality((Object)componentInChildren, (Object)null)) { Vector3 position = this.Position; Quaternion rotation = this.Rotation; this.Position = Vector3.get_zero(); this.Rotation = Quaternion.get_identity(); Bounds bounds1 = componentInChildren.get_bounds(); Vector3 center = ((Bounds) ref bounds1).get_center(); Bounds bounds2 = componentInChildren.get_bounds(); this._nicknameRoot.set_localPosition(new Vector3(0.0f, (float)(((Bounds) ref bounds2).get_extents().y / 2.0 + center.y) + this._nicknameHeightOffset, (float)center.z)); this.Position = position; this.Rotation = rotation; } else { this._nicknameRoot.set_localPosition(new Vector3(0.0f, this._nicknameHeightOffset, 0.0f)); } } } if (Object.op_Equality((Object)this._nicknameRoot, (Object)null)) { this._nicknameRoot = new GameObject("Nickname Root").get_transform(); this._nicknameRoot.SetParent(((Component)this).get_transform(), false); this._nicknameRoot.set_localPosition(new Vector3(0.0f, this._nicknameHeightOffset, 0.0f)); } if (Object.op_Equality((Object)this.FollowTarget, (Object)null)) { this.FollowTarget = ((Component)this.HomePoint).get_transform(); } this.SetStateData(); bool flag = false; this.MarkerEnabled = flag; this.BodyEnabled = flag; this.SetState(AnimalState.Start, (Action)null); }