public void SharedShipCreation(ShipEntity shipEntity, PSShip psShip, SimpleManager.GenericDelegate buttonDel) { this.AddShipButtonDelegate((EventTrigger)shipEntity.clickDetector.GetComponent <EventTrigger>(), buttonDel); this.InitializeShipSprites(shipEntity, psShip); shipEntity.CreateStickerEntities(); shipEntity.UpdateFleetFlagIcon(); this.InitializeShipMaterials(shipEntity, psShip); float num1 = 0.0f; float num2 = 0.0f; if (Object.op_Inequality((Object)((SpriteRenderer)shipEntity.shipExterior.GetComponent <SpriteRenderer>()).get_sprite(), (Object)null)) { Bounds bounds1 = ((SpriteRenderer)shipEntity.shipExterior.GetComponent <SpriteRenderer>()).get_sprite().get_bounds(); // ISSUE: explicit reference operation num1 = (float)((Bounds)@bounds1).get_size().x; Bounds bounds2 = ((SpriteRenderer)shipEntity.shipExterior.GetComponent <SpriteRenderer>()).get_sprite().get_bounds(); // ISSUE: explicit reference operation num2 = (float)((Bounds)@bounds2).get_size().y; } if ((double)num1 > (double)num2) { TransformExtensions.ScaleByXY((Transform)shipEntity.exteriorSkin.GetComponent <RectTransform>(), 3.2f); } else { TransformExtensions.ScaleByXY((Transform)shipEntity.exteriorSkin.GetComponent <RectTransform>(), 3.5f); } ((Component)shipEntity).get_gameObject().SetActive(true); }
public PSShip InitShip(PSShip tempPSShipObject, bool temp) { PSShip psShip = tempPSShipObject; foreach (ShipDesign shipDesign in this.shipDesignDict.Values.ToArray <ShipDesign>()) { if (shipDesign.ShipDesignId == psShip.ShipDesignId) { int index1 = 0; string[] array1 = ((IEnumerable <char>)shipDesign.Mask.ToCharArray()).Select <char, string>((Func <char, string>)(c => c.ToString())).ToArray <string>(); // ISSUE: reference to a compiler-generated field if (ShipManager.\u003C\u003Ef__mg\u0024cache0 == null) { // ISSUE: reference to a compiler-generated field ShipManager.\u003C\u003Ef__mg\u0024cache0 = new Func <string, int>(int.Parse); } // ISSUE: reference to a compiler-generated field Func <string, int> fMgCache0 = ShipManager.\u003C\u003Ef__mg\u0024cache0; int[] array2 = ((IEnumerable <string>)array1).Select <string, int>(fMgCache0).ToArray <int>(); psShip.rows = shipDesign.Rows; psShip.columns = shipDesign.Columns; psShip.mask = new int[psShip.columns, psShip.rows]; for (int index2 = 0; index2 < psShip.rows; ++index2) { for (int index3 = 0; index3 < psShip.columns; ++index3) { psShip.mask[index3, index2] = array2[index1]; ++index1; } } break; } } return(psShip); }
public void InitializeShipMaterials(ShipEntity shipEntity, PSShip psShip) { Material material1 = Object.Instantiate(Resources.Load("HSBMaterial")) as Material; material1.SetFloat("_Hue", psShip.HueValue); material1.SetFloat("_Saturation", psShip.SaturationValue); material1.SetFloat("_Brightness", psShip.BrightnessValue); shipEntity.sharedMaterial = material1; ((Renderer)shipEntity.shipInterior.GetComponent <SpriteRenderer>()).set_material(shipEntity.sharedMaterial); ((Renderer)shipEntity.shipExterior.GetComponent <SpriteRenderer>()).set_material(shipEntity.sharedMaterial); Material material2 = Object.Instantiate(Resources.Load("SpriteMask")) as Material; material2.SetFloat("_Hue", psShip.HueValue); material2.SetFloat("_Saturation", psShip.SaturationValue); material2.SetFloat("_Brightness", psShip.BrightnessValue); shipEntity.skinMaskMaterial = material2; ((Renderer)shipEntity.skinLayer.GetComponent <SpriteRenderer>()).set_material(shipEntity.skinMaskMaterial); Material material3 = Object.Instantiate(Resources.Load("BlendModeRamp")) as Material; material3.SetFloat("_Hue", psShip.HueValue); material3.SetFloat("_Saturation", psShip.SaturationValue); material3.SetFloat("_Brightness", psShip.BrightnessValue); shipEntity.skinMaterial = material3; ((Renderer)shipEntity.exteriorSkin.GetComponent <SpriteRenderer>()).set_material(shipEntity.skinMaterial); }
public void CreateMainShip(PSShip psShip, GameObject shipLayer, SimpleManager.GenericDelegate buttonDel, ShipManager.ShipCreationDelegate shipDel) { if (psShip == null || !Object.op_Inequality((Object)shipLayer, (Object)null)) { return; } ShipMainEntity mainShipObject = this.CreateMainShipObject(psShip, shipLayer); this.SharedShipCreation((ShipEntity)mainShipObject, psShip, buttonDel); if (shipDel == null) { return; } shipDel((ShipEntity)mainShipObject); }
public ShipBattleEntity CreateBattleShipObject(PSShip psShip, GameObject shipLayer) { GameObject gameObject = Object.Instantiate(Resources.Load("ShipBattlePrefab"), shipLayer.get_transform()) as GameObject; ((Object)gameObject).set_name(psShip.ShipName + "-" + (object)psShip.ShipId); gameObject.get_transform().set_localScale(Vector3.get_one()); gameObject.get_transform().set_position(new Vector3(99999f, 0.0f, 0.0f)); ShipBattleEntity component = (ShipBattleEntity)gameObject.GetComponent <ShipBattleEntity>(); component.shipEntity = (ShipEntity)component; component.PSShip = psShip; component.gridMap = new GridMap(new Grid[psShip.columns, psShip.rows]); component.PSShip.ConvertedHp = psShip.Hp * 100.0; component.PSShip.InitialHP = component.PSShip.ConvertedHp; return(component); }
public void CompleteShipItemsDownload(List <PSItem> itemList, string url, string message, bool success, Action failAction = null) { if (success) { PSShip playerShip = (PSShip)SingletonManager <ShipManager> .Instance.PlayerShip; if (itemList == null) { return; } foreach (PSItem psItem in itemList) { playerShip.AddItemToShip(psItem); } } else { Debug.LogWarning((object)"Failed Ship Items Download", (Object)null); } }
public void CreateBattleShip(PSShip psShip, GameObject shipLayer, SimpleManager.GenericDelegate buttonDel, ShipManager.ShipCreationDelegate shipDel) { if (psShip == null || !Object.op_Inequality((Object)shipLayer, (Object)null)) { return; } ShipBattleEntity battleShipObject = this.CreateBattleShipObject(psShip, shipLayer); this.SharedShipCreation((ShipEntity)battleShipObject, psShip, buttonDel); SceneViewManager instance = SingletonManager <SceneViewManager> .Instance; if (instance.CurrentPsBackground != null) { battleShipObject.cloakEntity.OuterCloak.set_sprite(SingletonManager <SpriteManager> .Instance.GetSpriteById(instance.CurrentPsBackground.BackgroundSpriteId).UnitySprite); battleShipObject.cloakEntity.InnerCloak.set_sprite(SingletonManager <SpriteManager> .Instance.GetSpriteById(instance.CurrentPsBackground.BackgroundSpriteId).UnitySprite); } if (shipDel == null) { return; } shipDel((ShipEntity)battleShipObject); }
public void InitializeShipSprites(ShipEntity shipEntity, PSShip psShip) { Vector2 vector2; // ISSUE: explicit reference operation ((Vector2)@vector2).\u002Ector((float)psShip.columns * 25f, (float)psShip.rows * 25f); Sprite unitySprite1 = psShip.ShipDesign.InteriorSprite.UnitySprite; ((SpriteRenderer)shipEntity.shipInterior.GetComponent <SpriteRenderer>()).set_sprite(unitySprite1); Sprite unitySprite2 = psShip.ShipDesign.ExteriorSprite.UnitySprite; ((SpriteRenderer)shipEntity.shipExterior.GetComponent <SpriteRenderer>()).set_sprite(unitySprite2); Vector2 size = ((SpriteRenderer)shipEntity.shipExterior.GetComponent <SpriteRenderer>()).get_size(); ((BoxCollider)shipEntity.shipExterior.GetComponent <BoxCollider>()).set_size(Vector2.op_Implicit(new Vector2(Mathf.Abs((float)size.x), Mathf.Abs((float)size.y)))); ((SpriteRenderer)shipEntity.skinLayer.GetComponent <SpriteRenderer>()).set_sprite(unitySprite2); ((SpriteMask)shipEntity.stickerLayer.GetComponent <SpriteMask>()).set_sprite(unitySprite2); ShipBattleEntity shipBattleEntity = shipEntity as ShipBattleEntity; Material material = Object.Instantiate(Resources.Load("SpriteMask")) as Material; if (Object.op_Inequality((Object)shipBattleEntity, (Object)null)) { ((SpriteRenderer)shipBattleEntity.cloakOverlayLayer.GetComponent <SpriteRenderer>()).set_sprite(unitySprite2); ((Renderer)shipBattleEntity.cloakOverlayLayer.GetComponent <SpriteRenderer>()).set_material(material); } ((SpriteRenderer)shipEntity.innerLayer.GetComponent <SpriteRenderer>()).set_sprite(unitySprite1); ((Renderer)shipEntity.innerLayer.GetComponent <SpriteRenderer>()).set_material(material); Sprite unitySprite3 = psShip.ShipDesign.ShieldSprite.UnitySprite; SpriteRenderer component = (SpriteRenderer)shipEntity.shipShield.GetComponent <SpriteRenderer>(); component.set_sprite(unitySprite3); component.set_drawMode((SpriteDrawMode)1); component.set_size(vector2); component.set_drawMode((SpriteDrawMode)0); SpriteDesign spriteDesign = psShip.SkinItemDesignId != 0 ? psShip.SkinItemDesign.LogoSprite : SingletonManager <SpriteManager> .Instance.GetSpriteByKey("blankPixel"); ((SpriteRenderer)shipEntity.exteriorSkin.GetComponent <SpriteRenderer>()).set_sprite(spriteDesign.UnitySprite); ((RectTransform)((Component)shipEntity).GetComponent <RectTransform>()).set_sizeDelta(vector2); }