public void SetPlaneKey(string imageKey) { Transform transform = base.transform.FindChild("NamePlane"); if (transform != null) { SimpleSprite component = transform.GetComponent <SimpleSprite>(); if (component != null) { float num = 1.5f; float num2 = 8f; Transform transform2 = base.transform.FindChild("NameText"); if (transform2 != null) { SpriteText component2 = transform2.GetComponent <SpriteText>(); if (component2) { float num3 = Math.Abs(component2.BottomRight.x - component2.TopLeft.x); float num4 = Math.Abs(component2.BottomRight.y - component2.TopLeft.y); component.Setup(num3 + num2 * 2f, num4 * num, imageKey); component.Hide(false); return; } } component.Hide(true); } } }
public void SetPlaneKey(string imageKey, ref float addY) { Transform transform = base.transform.FindChild("ChatPlane"); if (transform != null) { SimpleSprite component = transform.GetComponent <SimpleSprite>(); if (component != null) { Transform transform2 = base.transform.FindChild("ChatText"); if (transform2 != null) { UIListItemContainer component2 = transform2.GetComponent <UIListItemContainer>(); if (null != component2) { Vector2 vector = (Vector2)component2.Data; float num = vector.x + 20f; float h = vector.y + 10f; component.Setup(num, h, imageKey); component.SetColor(new Color(1f, 1f, 1f, 0.8f)); component.transform.rotation = base.transform.rotation; component.transform.localScale = new Vector3(this.fBackImageScaleX, this.fBackImageScaleY, 1f); component2.transform.localPosition = new Vector3(-(num * this.fEmoticonScale) / 2f + 20f * this.fEmoticonScale / 2f, vector.y * this.fEmoticonScale / 2f, 0f); } } else { component.Hide(true); } } } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); msgFont = Content.Load <SpriteFont>("colMsg"); // TODO: use this.Content to load your game content here Texture2D bg = Content.Load <Texture2D>(@"Sprites/download"); background = new SimpleSprite(bg, Vector2.Zero); Texture2D rGhost = Content.Load <Texture2D>(@"Sprites/redghost"); redghost = new SimpleSprite(rGhost, Vector2.Zero); Texture2D bGhost = Content.Load <Texture2D>(@"Sprites/blueghost"); blueghost = new SimpleSprite(bGhost, new Vector2(viewWidth / 2 - bGhost.Width / 2, viewHeight - bGhost.Height - 30f)); Texture2D gr = Content.Load <Texture2D>(@"Sprites/ground"); ground = new SimpleSprite(gr, new Vector2(viewWidth / 2 - gr.Width / 2, viewHeight - gr.Height)); //viewports mainViewport = GraphicsDevice.Viewport; GraphicsDevice.Viewport = mainViewport; mapViewport.Bounds = new Rectangle(0, 0, mainViewport.Width / 10, mainViewport.Height / 10); mapViewport.X = 0; mapViewport.Y = 0; }
static FatPlatform() { sprites = new Sprite[4]; Picture bmp = ResourceUtil.loadSystemPicture("FatPlatform.bmp"); // don't dispose this surface sprites[0] = sprites[2] = new SimpleSprite(bmp, new Point(0, 16), new Point(0, 0), new Size(32, 32)); sprites[1] = sprites[3] = new SimpleSprite(bmp, new Point(0, 16), new Point(32, 0), new Size(32, 32)); }
/// <summary> /// /// </summary> protected internal override void OnInitComplete() { Picture picture = LoadPicture("StealSupportedRail.bmp"); sprites[0] = new SimpleSprite(picture, new Point(0, 16), new Point(0, 0), new Size(32, 32)); sprites[1] = new SimpleSprite(picture, new Point(0, 16), new Point(32, 0), new Size(32, 32)); sprites[2] = new SimpleSprite(picture, new Point(0, 16), new Point(64, 0), new Size(32, 32)); sprites[3] = new SimpleSprite(picture, new Point(0, 16), new Point(96, 0), new Size(32, 32)); }
static ThinPlatform() { Picture pic = PictureManager.get("{3FF9F902-6B2A-44A4-9C5F-DE8D82CFD37D}"); for (int i = 0; i < 8; i++) { sprites[i] = new SimpleSprite(pic, new Point(0, 8), new Point(i * 32, 0), new Size(32, 24)); } }
// static initializer /// <summary> /// /// </summary> protected internal override void OnInitComplete() { Picture picture = LoadPicture("TunnelRail.bmp"); for (int i = 0; i < 2; i++) { backgrounds[i] = new SimpleSprite(picture, new Point(0, 16), new Point(32 * i, 0), new Size(32, 32)); foregrounds[i] = new SimpleSprite(picture, new Point(0, 16), new Point(32 * i + 64, 0), new Size(32, 32)); } }
// static initializer protected override void onInitComplete() { Picture picture = loadPicture("garage.bmp"); for (int i = 0; i < 2; i++) { backgrounds[i] = new SimpleSprite(picture, new Point(0, 11), new Point(32 * i, 0), new Size(32, 27)); foregrounds[i] = new SimpleSprite(picture, new Point(0, 11), new Point(32 * i + 64, 0), new Size(32, 27)); } }
public WeatherOverlaySpriteSet(string pictureId, int frameLength, Size sz) { Picture pic = PictureManager.get(pictureId); imageSize = sz; overlayImages = new Sprite[frameLength]; for (int i = 0; i < frameLength; i++) { overlayImages[i] = new SimpleSprite(pic, new Point(0, 0), new Point(sz.Width * i, 0), sz); } }
private void Start() { _rb = GetComponent <Rigidbody2D>(); _ss = GetComponent <SimpleSprite>(); if (triggerButton) { triggerButton.ButtonActivateEvent.AddListener(ToggleOn); triggerButton.ButtonDeactivateEvent.AddListener(ToggleOff); } }
public A3RoadContribution(XmlElement e) : base(e) { // load resource, but don't dispose it as sprites will still refer to this surface. Picture picture = getPicture(e); sprites = new Sprite[3]; for (int i = 0; i < 3; i++) { sprites[i] = new SimpleSprite(picture, new Point(0, 16), new Point(i * 32, 0), new Size(32, 32)); } }
//check for collision public void CheckCollision(SimpleSprite other) { if (Bounds.Intersects(other.Bounds)) { Tint = Color.Black; } else { Tint = Color.White; } }
private void initProperties() { this._controlPanel = new SimpleSprite(new Rect(0, 0, 1, 1), ControlPanel.normal, "ControlPanelBG", "Background"); this._controlPanel.ZIndex = 0; //Default ZIndex = 0; this._startButton = new SimpleButton(new Rect(0, 0, 1, 1), SpinButton.normal, "StartButton", "Background"); this._startButton.OnClick += new SimpleButton.ClickEventHandler(this.clickStartButton); this._startButton.ZIndex = 1; this._startButton.IsEnabled = true; //Default Enable true; this._startButton.SetFrames = SpinButton.normal; this._symbolHelio = new AnimatedSprite(new Rect(1, 2, 1, 1), SymbolHelio.normal, true, "HelioSymbol", "Background", 1f); this._symbolHelio.gotoAndPlay(); }
public Sprite[] createSprites(Bitmap bit, Picture picture, Point offset, Point origin, Size size) { int sprites = steps; int shift = 360 / sprites; // hue shift per step Sprite[] dest = new Sprite[sprites]; ArrayList work = new ArrayList(); for (int y = 0; y < size.Height; y++) { for (int x = 0; x < size.Width; x++) { Color c = bit.GetPixel(x + origin.X, y + origin.Y); if (!work.Contains(c)) { work.Add(c); } } } work.Remove(bit.GetPixel(0, 0)); dest[0] = new SimpleSprite(picture, offset, origin, size); if (work.Count == 0) { // no replace color for (int i = 1; i < sprites; i++) { dest[i] = dest[0]; } } else { Color[] srcColors = new Color[work.Count]; Color[] dstColors = new Color[work.Count]; for (int j = 0; j < work.Count; j++) { srcColors[j] = (Color)work[j]; } for (int i = 1; i < sprites; i++) { int s2 = shift * i; for (int j = 0; j < srcColors.GetLength(0); j++) { HSVColor c = new HSVColor(srcColors[j]); c.Hue += s2; dstColors[j] = c.ToRGBColor(); } dest[i] = new ColorMappedSprite(picture, offset, origin, size, srcColors, dstColors); } } return(dest); }
// Use this for initialization void Start() { this.sprite = this.gameObject.AddComponent <SimpleSprite>(); this.sprite.setTexture(this.texture); this.sprite.setSize(this.texture.width * 0.03f / 3.0f, this.texture.height * 0.03f / 3.0f); this.sprite.create(); this.GetComponent <MeshCollider>().sharedMesh = this.GetComponent <MeshFilter>().mesh; this.game_control = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameControl>(); }
private void showPathTiles(List <Tile> _path) { _pathTiles.Clear(); foreach (Tile t in _path) { SimpleSprite s = new SimpleSprite(Game.Content.Load <SpriteFont>("DebugFont"), Game.Content.Load <Texture2D>("Collison"), new Vector2(t.X * t.TileWidth, t.Y * t.TileHeight), new Vector2(t.TileWidth, t.TileHeight)); s.Visible = true; _pathTiles.Add(s); } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); _txBackGround = Content.Load <Texture2D>(@"Textures\backgroundImage"); _txCharacter = Content.Load <Texture2D>(@"Textures\body2"); _txDot = Content.Load <Texture2D>(@"Textures\body"); character1 = new SimpleSprite(_txCharacter, Vector2.Zero); background = new SimpleSprite(_txBackGround, Vector2.Zero); dot = new SimpleSprite(_txDot, Vector2.Zero); // TODO: use this.Content to load your game content here }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); _txBackGround = Content.Load <Texture2D>(@"Textures\backgroundImage"); BackGroundSprite = new SimpleSprite(_txBackGround, Vector2.Zero); _txCharacter = Content.Load <Texture2D>(@"Textures\body2"); CharacterSprite = new SimpleSprite(_txCharacter, originalViewPort.Bounds.Center.ToVector2()); _txDot = Content.Load <Texture2D>(@"Textures\body"); DotSprite = new SimpleSprite(_txDot, mapViewport.Bounds.Center.ToVector2()); GameFont = Content.Load <SpriteFont>(@"GameFont"); // TODO: use this.Content to load your game content here }
public void ShowResultMessage(QuestResult _result) { // play sound effect PlayResultSound(_result); HideAll(); if (dicSimpleSprite.ContainsKey(_result)) { nowSpite = dicSimpleSprite[_result]; nowSpite.Start(); fPassedTime = 0.0f; bShow = true; nowSpite.Hide(false); } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); Texture2D _txBackground = Content.Load <Texture2D>(@"Textures/background"); Texture2D _txBlueGhost = Content.Load <Texture2D>(@"Textures/blueghost"); Texture2D _txPurpleGhost = Content.Load <Texture2D>(@"Textures/purpleghost"); collisionFont = Content.Load <SpriteFont>(@"Font/collisionFont"); background = new SimpleSprite(_txBackground, Vector2.Zero); character1 = new SimpleSprite(_txBlueGhost, new Vector2(30, 30)); character2 = new SimpleSprite(_txPurpleGhost, Vector2.Zero); // TODO: use this.Content to load your game content here }
public StandardRoadContribution(XmlElement e) : base(e) { // load resource, but don't dispose it as sprites will still refer to this surface. Picture pic = getPicture(e); XmlElement picture = (XmlElement)XmlUtil.selectSingleNode(e, "picture"); Size sz = XmlUtil.parseSize(picture.Attributes["size"].Value); int offsetY = int.Parse(picture.Attributes["offset"].Value); flatSprites = new Sprite[16]; for (int i = 0; i < 15; i++) { flatSprites[i + 1] = new SimpleSprite( pic, new Point(0, offsetY), new Point(locations[i * 2] * sz.Width, locations[i * 2 + 1] * sz.Height), sz); } }
// ---------------------------------------------------------------- // void Start() { this.sprite = this.gameObject.AddComponent <SimpleSprite>(); this.sprite.SetSize(9.0f * 1.2f, 56.25f * 1.2f); // this.y_max = this.sprite.size.y / 2.0f - 10.0f; this.y_min = -(this.sprite.size.y / 2.0f - 7.0f); this.rate = 0.0f; this.setHeightRateDirect(this.rate); this.is_scrolling = false; }
//SimpleSprite Texture Change public void Set_Tex( SimpleSprite Obj_Sprite, Texture2D tex, int index, int size, int count) { if( index < 0) { Debug.LogError( "AsNpcMenu:Set_Tex() index < 0 "); index = 0; } Obj_Sprite.SetTexture( tex); int nU, nV; int uIndex = index % count; int vIndex = index / count; nU = uIndex * size; nV = ( vIndex + 1) * size; Obj_Sprite.SetLowerLeftPixel( nU, nV); }
/// <summary> Load sprites for cliffs. </summary> private static void initCliffSprites() { Picture picture = ResourceUtil.LoadSystemPicture("cliff.bmp"); for (int side = 0; side < 2; side++) { for (int l = 0; l <= 4; l++) { for (int r = 0; r <= 4; r++) { cliff[side, l, r] = new SimpleSprite(picture, new Point(0, 8), new Point(side * 16 + r * 32, l * 24), new Size(16, 24)); } } } }
static RRCrossing() { // load sprites Picture pic = PictureManager.get("{F4380415-A2F2-41d8-8FCD-ED25A470A84D}"); for (int x = 0; x < 2; x++) { for (int y = 0; y < 2; y++) { for (int z = 0; z < 4; z++) { sprites[x, y, z] = new SimpleSprite(pic, new Point(0, z == 0?16:8), new Point(((x == 0?2:0) + y) * 32, z * 24 + (z == 0?0:8)), new Size(32, z == 0?32:24)); } } } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); gameFont = Content.Load <SpriteFont>(@"Fonts\Font"); Texture2D _bktx = Content.Load <Texture2D>("background"); background = new SimpleSprite(_bktx, Vector2.Zero); Texture2D _char1 = Content.Load <Texture2D>("Down Arrow"); character1 = new SimpleSprite(_char1, Vector2.One); Texture2D _char2 = Content.Load <Texture2D>("body"); character2 = new SimpleSprite(_char2, Vector2.Zero); // TODO: use this.Content to load your game content here }
protected internal override void onInitComplete() { Picture surface = loadPicture("BridgeRail.bmp"); for (int i = 0; i < 6; i++) { backgrounds[i] = new SimpleSprite(surface, new Point(0, 16), new Point(32 * i, 0), new Size(32, 32)); foregrounds[i] = new SimpleSprite(surface, new Point(0, 16), new Point(32 * i, 32), new Size(32, 32)); } Picture bridgePierImages = loadPicture("BridgePier.bmp"); for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { bridgePierSprites[i, j] = new SimpleSprite(bridgePierImages, new Point(0, 16), new Point(j * 32, i * 32), new Size(32, 32)); } } }
static public UISlotItem CreateItemIcon( GameObject goItemIcon, SimpleSprite iconImgPos, Vector3 pos, Vector2 _size, bool isNeedCollider = true) { if( null == goItemIcon) return null; GameObject obj = GameObject.Instantiate( goItemIcon) as GameObject; UISlotItem _SlotItem = obj.GetComponent<UISlotItem>(); if( null != _SlotItem) { _SlotItem.transform.parent = iconImgPos.transform; _SlotItem.transform.localPosition = pos; _SlotItem.transform.localRotation = Quaternion.identity; _SlotItem.transform.localScale = Vector3.one; _SlotItem.iconImg.width = iconImgPos.width - _size.x; _SlotItem.iconImg.height = iconImgPos.height - _size.y; if( true == isNeedCollider) _SlotItem.iconImg.gameObject.AddComponent<BoxCollider>(); } return _SlotItem; }
public void Init(Tbl_Promotion_Record _record) { m_Record = _record; m_FadeInTime = AsTableManager.Instance.GetTbl_GlobalWeight_Record(101).Value * 0.001f; m_PromotionTime = _record.PromotionTime * 0.001f; m_FadeOutTime = AsTableManager.Instance.GetTbl_GlobalWeight_Record(102).Value * 0.001f; Item item = ItemMgr.ItemManagement.GetItem(_record.Item_Index); // icon GameObject obj = Instantiate(item.GetIcon()) as GameObject; UISlotItem slot = obj.GetComponent<UISlotItem>(); SimpleSprite sprite = slot.iconImg; sprite.transform.parent = m_spSlot.transform; sprite.transform.localPosition = new Vector3(0f, 0f, -0.1f); Destroy(m_spIcon.gameObject); // sprite.transform.position = m_spIcon.transform.position; // sprite.transform.rotation = m_spIcon.transform.rotation; // Destroy(m_spIcon.gameObject); // m_spIcon.gameObject.SetActiveRecursively(false); // sprite.transform.parent = m_spIcon.transform; // sprite.transform.position = Vector3.zero; // sprite.transform.rotation = Quaternion.identity; m_spIcon = sprite; string name = AsTableManager.Instance.GetTbl_String(item.ItemData.nameId); string str = AsTableManager.Instance.GetTbl_String(_record.String_Index); string buttonStr = AsTableManager.Instance.GetTbl_String(1769); m_textTitle.Text = name; m_textIndex.Text = str; m_btnBuy.Text = buttonStr; // alpha SetAlpha(0f); m_btnBuy.SetInputDelegate(OnBuyBtnClicked_Del); m_spPromotion.GetComponent<AsPromotionBtn_Cancel>().SetInput_Del(OnCancelClicked_Del); }
protected override void Awake() { base.Awake(); this.m_value = this.defaultValue; this.upButton = (UIButton) new GameObject { name = base.name + " - UpButton", transform = { parent = base.transform } }.AddComponent(typeof(UIButton)); this.upButton.renderCamera = this.renderCamera; this.upButton.AddValueChangedDelegate(new EZValueChangedDelegate(this.ClickUpButton)); this.downButton = (UIButton) new GameObject { name = base.name + " - DownButton", transform = { parent = base.transform } }.AddComponent(typeof(UIButton)); this.downButton.renderCamera = this.renderCamera; this.downButton.AddValueChangedDelegate(new EZValueChangedDelegate(this.ClickDownButton)); this.emptySprite = (SimpleSprite) new GameObject { name = base.name + " - Bar", transform = { parent = base.transform } }.AddComponent(typeof(SimpleSprite)); this.emptySprite.autoResize = false; this.emptySprite.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT); this.emptySprite.renderCamera = this.renderCamera; this.emptySprite.gameObject.layer = GUICamera.UILayer; this.emptySprite.SetWindingOrder(SpriteRoot.WINDING_ORDER.CW); }
public float Get_Plane_Width() { float result = 0f; Transform transform = base.transform.FindChild("NamePlane"); if (transform != null) { SimpleSprite component = transform.GetComponent <SimpleSprite>(); if (component != null) { Transform transform2 = base.transform.FindChild("NameText"); if (transform2 != null) { SpriteText component2 = transform2.GetComponent <SpriteText>(); if (component2) { result = Math.Abs(component2.BottomRight.x - component2.TopLeft.x); } } } } return(result); }
// ---------------------------------------------------------------- // void Start() { this.SetLinedPosition(StackBlockControl.BLOCK_NUM_X / 2); GameObject game_object = Instantiate(this.CarryBlockPrefab) as GameObject; this.carry_block = game_object.GetComponent <CarryBlock>(); this.carry_block.player = this; this.carry_block.transform.position = this.transform.position + new Vector3(0.0f, 1.0f, 0.0f); this.carry_block.GetComponent <Renderer>().enabled = false; // this.sprite = this.gameObject.AddComponent <SimpleSprite>(); this.sprite.SetTexture(this.textures_normal[0]); // this.life = LIFE_MAX; this.is_controlable = true; }
public void unregisterSprite(SimpleSprite sprite) { sprites.Remove(sprite); }
static VoxelImpl() { // load fence sprites Picture fence = ResourceUtil.loadSystemPicture("ConstructionFence.bmp"); fenceSprites = new Sprite[4 /*direction*/, 2 /*door or no door*/]; for (int i = 0; i < 4; i++) { fenceSprites[i, 0] = new SimpleSprite(fence, new Point(0, 16), new Point(32 * i, 0), new Size(32, 32)); } fenceSprites[0, 1] = fenceSprites[0, 0]; fenceSprites[1, 1] = fenceSprites[1, 0]; // no doors for (int i = 0; i < 2; i++) { fenceSprites[i + 2, 1] = new SimpleSprite( fence, new Point(0, 16), new Point(32 * (i + 4), 0), new Size(32, 32)); } // load ground sprites Picture ground = ResourceUtil.loadSystemPicture("ConstructionGround.bmp"); groundSprites = new Sprite[7]; groundSprites[0] = new SimpleSprite( // ground ground, new Point(0, 0), new Point(96, 1), new Size(32, 16)); groundSprites[1] = new SimpleSprite( // woods ground, new Point(0, 0), new Point(64, 17), new Size(32, 16)); groundSprites[2] = new SimpleSprite( // steel ground, new Point(0, 0), new Point(96, 17), new Size(32, 16)); groundSprites[3] = new SimpleSprite( // hole ground, new Point(0, 1), new Point(64, 0), new Size(32, 17)); groundSprites[4] = new SimpleSprite( // machine1 ground, new Point(0, 31), new Point(0, 0), new Size(32, 47)); groundSprites[5] = new SimpleSprite( // machine2 ground, new Point(0, 31), new Point(32, 0), new Size(32, 47)); groundSprites[6] = new SimpleSprite( // machine3 ground, new Point(0, 8), new Point(96, 33), new Size(32, 24)); // load bone sprites Picture bone = ResourceUtil.loadSystemPicture("ConstructionBones.bmp"); boneSprites = new Sprite[3, 2, 2, 2, 2]; for (int l = 0; l < 3; l++) { for (int n = 0; n < 2; n++) { for (int e = 0; e < 2; e++) { for (int s = 0; s < 2; s++) { for (int w = 0; w < 2; w++) { int code = 0x1000 * n + 0x0100 * e + 0x0010 * s + 0x0001 * w; int idx; for (idx = 0; idx < 16; idx++) { if (boneConnectivities[idx] == code) { break; } } Debug.Assert(idx != 16); boneSprites[l, n, e, s, w] = new SimpleSprite(bone, new Point(0, 16), new Point(l * 128 + (idx % 4) * 32, (idx / 4) * 32), new Size(32, 32)); } } } } } // loa dwall sprites Picture wall = ResourceUtil.loadSystemPicture("ConstructionWall.bmp"); wallSprites = new Sprite[4]; wallSprites[0] = new SimpleSprite(wall, new Point(0, 16), new Point(0, 0), new Size(16, 32)); wallSprites[1] = new SimpleSprite(wall, new Point(-16, 16), new Point(16, 0), new Size(16, 32)); wallSprites[2] = new SimpleSprite(wall, new Point(-16, 16), new Point(16, 32), new Size(16, 32)); wallSprites[3] = new SimpleSprite(wall, new Point(0, 16), new Point(0, 32), new Size(16, 32)); }
void resizeBG( SimpleSprite bg ) { if (GotoProxy.getSceneName() == GotoProxy.MAP) { bg.gameObject.transform.localScale= new Vector3(1.1875f, 1.1875f, bg.gameObject.transform.localScale.z); // bg.gameObject.transform.localScale.x = 1.1875f; // bg.gameObject.transform.localScale.y = 1.1875f; }else { bg.SetSize(1137,1137); } /* if (GotoProxy.getSceneName() == GotoProxy.MAIN_MENU) { bg.gameObject.transform.position.y -= 60; } */ }
void Start() { if(null== iconImg) { iconImg = gameObject.GetComponentInChildren<SimpleSprite>(); } if( eSLOT_TYPE.NO_COOLTIME == slotType ) { if(null != coolTime) { GameObject.Destroy( coolTime.gameObject ); } } else { if(null== coolTime) { coolTime = gameObject.GetComponentInChildren<AsIconCooltime>(); } } if(null== itemCountText) { itemCountText = gameObject.GetComponentInChildren<SpriteText>(); } }
/// <summary> /// Loads the content. /// </summary> protected override void LoadContent() { this.consoleFont = this.Content.Load <SpriteFont>("Content\\LucidaConsole"); // Create Tiled Sprites RectangleF bounds = this.RenderSystem.GetCameraRenderBounds(); this.background = new TiledSprite(this.GameWorld, "Content/floortile", "Content/floortilenormal", null, bounds.Position, Vector2.Zero, bounds.AreaBounds) { RenderScale = new Vector2(0.4f, 0.4f), RenderOptions = SpriteRenderOptions.IsLit }; SimpleSprite test = new SimpleSprite(this.GameWorld, "Content/box", null, false) { Position = new Vector2(8, 7), RenderScale = new Vector2(0.4f, 0.4f), RenderOptions = SpriteRenderOptions.CastsShadows | SpriteRenderOptions.IsLit, SpecularReflectivity = 0, LayerDepth = 1 }; test.Body.BodyType = FarseerPhysics.Dynamics.BodyType.Static; test.Body.CollisionCategories = FarseerPhysics.Dynamics.Category.Cat1; test.Body.Friction = 0; test.Body.Restitution = 1.0f; if (this.IsDebug) { var x = new DebugSprite(this.GameWorld, test); } SimpleSprite test2 = new SimpleSprite(this.GameWorld, "Content/box", null, false) { Position = new Vector2(10, 8), Rotation = -MathHelper.PiOver2, RenderScale = new Vector2(0.4f, 0.4f), RenderOptions = SpriteRenderOptions.CastsShadows | SpriteRenderOptions.IsLit, SpecularReflectivity = 0, LayerDepth = 2 }; test2.Body.BodyType = FarseerPhysics.Dynamics.BodyType.Static; test2.Body.CollisionCategories = FarseerPhysics.Dynamics.Category.Cat1; test2.Body.Friction = 0; test2.Body.Restitution = 1.0f; if (this.IsDebug) { var x = new DebugSprite(this.GameWorld, test2); } SimpleSprite test3 = new SimpleSprite(this.GameWorld, "Content/gear", null, true) { Position = new Vector2(20, 8), Rotation = -MathHelper.PiOver2, RenderScale = new Vector2(0.4f, 0.4f), RenderOptions = SpriteRenderOptions.CastsShadows | SpriteRenderOptions.IsLit, SpecularReflectivity = 0, LayerDepth = 2 }; test3.Body.BodyType = FarseerPhysics.Dynamics.BodyType.Static; test3.Body.CollisionCategories = FarseerPhysics.Dynamics.Category.Cat1; test3.Body.Friction = 0; test3.Body.Restitution = 1.0f; if (this.IsDebug) { var x = new DebugSprite(this.GameWorld, test3); } this.amLight = new AmbientLight(Color.White, 0.02f, true, 1); this.RenderSystem.AddPostProcessEffect(this.amLight); mouseLight = new PointLight(this.GameWorld) { Color = Color.White, Power = 1f, Range = 8, SpecularStrength = 4.75f, CastsShadows = true, MinShadowBlurDistance = .5f, MaxShadowBlurDistance = 1.5f }; lightCount++; if (this.IsDebug) { DebugSimulatedPostProcess y = new DebugSimulatedPostProcess(this.GameWorld, mouseLight); } this.RenderSystem.AddPostProcessEffect(mouseLight); // https://www.youtube.com/watch?v=BExTagcymo0 // George Ellinas - Pulse (George Ellinas Remix) (Free - Creative Commons MP3) // http://creativecommons.org/licenses/by/3.0/ this.song = Content.Load <Song>("Content/George_Ellinas_-_Pulse_(George_Ellinas_remix)_LoopEdit"); MediaPlayer.Volume = 0.1f; MediaPlayer.Play(song); base.LoadContent(); }
// Create private void CrateMapImg( string strPath) { Vector3 pos = Vector3.zero; pos.z = mapLayout; GameObject goRes = ResourceLoad.LoadGameObject( strPath); if( null == goRes) { AsUtil.ShutDown( "UIZoneMap::CrateMapImg()[null == gameobject] path : " + strPath); return; } GameObject goInstance = GameObject.Instantiate( goRes) as GameObject; goInstance.transform.parent = transform; goInstance.transform.localPosition = Vector3.zero; goInstance.transform.localRotation = Quaternion.identity; goInstance.transform.localScale = Vector3.one; m_mapImg = goInstance.GetComponent<SimpleSprite>(); if( null == m_mapImg) { AsUtil.ShutDown( "UIZoneMap::CrateBackImg()[ no have SimpleSpritet] path : " + strPath); return; } m_mapImg.transform.localPosition = pos; }
public void LoadContent() { _cursorSprite = new MouseCursor(_manager.Content, _manager.Content.Load<Texture2D>("Interface/cursor"), Vector2.Zero); }
public void registerSprite(SimpleSprite sprite) { sprites.Add(sprite); dirty = true; }
public void SetSelfItem(int iItemTableIndex, SimpleSprite parentSprite) { Item _item = ItemMgr.ItemManagement.GetItem(iItemTableIndex); if (null == _item) { Debug.LogError("AsUIRandItem::Open()[ null == item ] id: " + iItemTableIndex); return; } UISlotItem _SlotItem = ResourceLoad.CreateItemIcon(_item.GetIcon(), parentSprite, Vector3.back, minusItemSize, false); if (null == _SlotItem) { Debug.LogError("AsUIRandItem::Open()[ null == UISlotItem ] id: " + iItemTableIndex); return; } _SlotItem.tempItem = _item; m_SelfSlotItem = _SlotItem; m_SelfSlotItem.gameObject.SetActive(false); }
void Start() { _imgPreview = GetComponent<SimpleSprite>(); _noPreviewAvailable = GameObject.Find("\"No Preview Available\"").GetComponent<MeshRenderer>(); }