public void create() { Vector2 root_position = new Vector2(640.0f / 2.0f - 100.0f, 480.0f / 2.0f - 100.0f); // 아래에 깔리는 레이스. this.lace_sprite = Sprite2DRoot.get().createSprite(this.lace_texture, true); this.lace_sprite.setSize(new Vector2(128.0f, 128.0f) * SCALE); // 쿠키(대강의 HP). this.cookie_sprite = Sprite2DRoot.get().createSprite(this.cookie_icon_textures[0], true); this.cookie_sprite.setSize(new Vector2(80.0f, 80.0f) * SCALE); // 얼굴 아이콘. this.face_sprite = Sprite2DRoot.get().createSprite(this.face_icon_texture, true); this.face_sprite.setSize(new Vector2(80.0f, 80.0f) * SCALE); // 수치(세 자리). this.digit_sprites = new Sprite2DControl[3]; for (int i = 0; i < 3; i++) { Sprite2DControl digit = Sprite2DRoot.get().createSprite(this.number_textures[0], true); digit.setSize(new Vector2(48.0f, 48.0f) * SCALE); this.digit_sprites[i] = digit; } this.setPosition(root_position); }
public void create() { Vector2 root_position = new Vector2(640.0f/2.0f - 100.0f, 480.0f/2.0f - 100.0f); // 아래에 깔리는 레이스. this.lace_sprite = Sprite2DRoot.get().createSprite(this.lace_texture, true); this.lace_sprite.setSize(new Vector2(128.0f, 128.0f)*SCALE); // 쿠키(대강의 HP). this.cookie_sprite = Sprite2DRoot.get().createSprite(this.cookie_icon_textures[0], true); this.cookie_sprite.setSize(new Vector2(80.0f, 80.0f)*SCALE); // 얼굴 아이콘. this.face_sprite = Sprite2DRoot.get().createSprite(this.face_icon_texture, true); this.face_sprite.setSize(new Vector2(80.0f, 80.0f)*SCALE); // 수치(세 자리). this.digit_sprites = new Sprite2DControl[3]; for(int i = 0;i < 3;i++) { Sprite2DControl digit = Sprite2DRoot.get().createSprite(this.number_textures[0], true); digit.setSize(new Vector2(48.0f, 48.0f)*SCALE); this.digit_sprites[i] = digit; } this.setPosition(root_position); }
public override void initialize() { this.player = PartyControl.get().getLocalPlayer(); this.player_weapon = this.player.gameObject.findDescendant("anim_wepon"); this.data = GameObject.Find("EventDataIceAtari").GetComponent <EventDataIceAtari>(); // 당첨의 막대 모델. this.ice_bar = this.data.prefab_ice_atari_bar.instantiate(); this.ice_bar.setParent(this.player.gameObject.findDescendant("anim_wrist_R")); this.ice_bar.setLocalPosition(new Vector3(-0.056f, -0.086f, 0.039f)); this.ice_bar.SetActive(false); // "!" 말풍선. this.sprite_bikkuri = Sprite2DRoot.get().createSprite(this.data.texture_bikkuri, true); this.sprite_bikkuri.setVisible(false); // 당첨 말풍선. this.sprite_atari = Sprite2DRoot.get().createSprite(this.data.texture_atari, true); this.sprite_atari.setPosition(new Vector2(0.0f, 150.0f)); this.sprite_atari.setVisible(false); this.sprite_ice_bar = Sprite2DRoot.get().createSprite(this.data.texture_ice_bar, true); this.sprite_ice_bar.setVisible(false); this.sprite_ice_bar.setMaterial(this.data.material_ice_sprite); this.spline = this.data.gameObject.findDescendant("spline_ice").GetComponent <SimpleSplineObject>(); this.tracer.attach(this.spline.curve); }
// ================================================================ // public void create() { // 꼬리. this.mini_moya_sprite = new Sprite2DControl[2]; this.mini_moya_sprite[0] = Sprite2DRoot.get().createSprite(this.kara_texture, true); this.mini_moya_sprite[0].setSize(new Vector2(this.kara_texture.width, this.kara_texture.height) * 0.05f); this.mini_moya_sprite[0].transform.parent = this.root_sprite.transform; this.mini_moya_sprite[1] = Sprite2DRoot.get().createSprite(this.kara_texture, true); this.mini_moya_sprite[1].setSize(new Vector2(this.kara_texture.width, this.kara_texture.height) * 0.1f); this.mini_moya_sprite[1].transform.parent = this.root_sprite.transform; // 파/유자. this.negi_sprite = Sprite2DRoot.get().createSprite(this.negi_texture, true); this.negi_sprite.setSize(new Vector2(this.negi_texture.width, this.negi_texture.height) / 4.0f); this.negi_sprite.transform.parent = this.root_sprite.transform; this.yuzu_sprite = Sprite2DRoot.get().createSprite(this.yuzu_texture, true); this.yuzu_sprite.setSize(new Vector2(this.yuzu_texture.width, this.yuzu_texture.height) / 4.0f); this.yuzu_sprite.transform.parent = this.root_sprite.transform; // this.step.set_next(STEP.UUN); }
// スプライトのサイズをセットする. public void setSizeToSprite(Sprite2DControl sprite, Vector2 size) { sprite.internalSetSize(size); Vector3[] positions = this.calcVertexPositions(sprite.getSize().x, sprite.getSize().y, sprite.getDivCount()); this.setVertexPositionsToSprite(sprite, positions); }
// 頂点の位置をセットする. public void setVertexPositionsToSprite(Sprite2DControl sprite, Vector3[] positions) { MeshRenderer mesh_render = sprite.GetComponent <MeshRenderer>(); MeshFilter mesh_filter = sprite.GetComponent <MeshFilter>(); mesh_filter.mesh.vertices = positions; mesh_render.enabled = false; mesh_render.enabled = true; }
// UV をセットする. public void setVertexUVsToSprite(Sprite2DControl sprite, Vector2[] uvs) { MeshRenderer mesh_render = sprite.GetComponent <MeshRenderer>(); MeshFilter mesh_filter = sprite.GetComponent <MeshFilter>(); mesh_filter.mesh.uv = uvs; mesh_render.enabled = false; mesh_render.enabled = true; }
// ================================================================ // void Awake() { this.colors.current = new Color(0.0f, 0.0f, 0.0f, 0.0f); this.colors.goal = this.colors.current; this.sprite = Sprite2DRoot.get().createSprite(this.texture, true); this.sprite.setDepthLayer("fader"); this.sprite.setSize(new Vector2(Screen.width, Screen.height)); this.sprite.setVisible(false); }
public void create(Texture texture) { this.sprite = Sprite2DRoot.get().createSprite(texture, true); this.sprite.setSize(Vector2.one * 64.0f); this.sprite.setVisible(false); this.fcurve = new ipModule.FCurve(); this.fcurve.setSlopeAngle(70.0f, 5.0f); this.fcurve.setDuration(0.7f); this.fcurve.start(); }
// ヌルスプライトをつくる(スプライトを子どもにして、まとめて扱うためのもの). public Sprite2DControl createNull() { GameObject go = new GameObject(); go.name = "sprite-2d/null"; go.layer = LayerMask.NameToLayer(LAYER_NAME); go.transform.parent = this.root_sprite.transform; go.transform.localPosition = new Vector3(0.0f, 0.0f, BASE_DEPTH); go.transform.localRotation = Quaternion.identity; go.transform.localScale = Vector3.one; Sprite2DControl sprite = go.AddComponent <Sprite2DControl>(); return(sprite); }
// ================================================================ // public void create(Texture moji_texture, Texture moji_mae_texture) { this.moji_texture = moji_texture; this.moji_mae_texture = moji_mae_texture; this.moji_texture_size = new Vector2(this.moji_texture.width, this.moji_texture.height); this.sprite = Sprite2DRoot.get().createSprite(this.moji_mae_texture, true); this.sprite.setSize(Vector2.one * 64.0f); this.fcurve = new ipModule.FCurve(); this.fcurve.setSlopeAngle(70.0f, 5.0f); this.fcurve.setDuration(0.3f); this.spring = new ipModule.Spring(); this.spring.k = 100.0f; this.spring.reduce = 0.90f; }
public void create() { Vector2 root_position = new Vector2(640.0f / 2.0f - 100.0f, 0.0f); // 아래에 깔리는 레이스. this.lace_sprite = Sprite2DRoot.get().createSprite(this.lace_texture, true); this.lace_sprite.setSize(new Vector2(96.0f, 96.0f) * SCALE); // 쿠키. this.cookie_sprite = Sprite2DRoot.get().createSprite(this.cookie_icon_textures[0], true); this.cookie_sprite.setSize(new Vector2(60.0f, 60.0f) * SCALE); // 얼굴 아이콘. this.face_sprite = Sprite2DRoot.get().createSprite(this.face_icon_texture, true); this.face_sprite.setSize(new Vector2(60.0f, 60.0f) * SCALE); this.setPosition(root_position); }
// スプライトに頂点カラーをセットする. public void setVertexColorToSprite(Sprite2DControl sprite, Color color) { MeshRenderer mesh_render = sprite.GetComponent <MeshRenderer>(); MeshFilter mesh_filter = sprite.GetComponent <MeshFilter>(); int div_count = sprite.getDivCount(); Color[] colors = new Color[div_count * div_count]; foreach (var i in System.Linq.Enumerable.Range(0, div_count * div_count)) { colors[i] = color; } mesh_filter.mesh.colors = colors; mesh_render.enabled = false; mesh_render.enabled = true; }
// ================================================================ // // MonoBehaviour에서 상속. void Awake() { this.root_sprite = Sprite2DRoot.get().createNull(); this.cookie_sprite = Sprite2DRoot.get().createSprite(this.cookie_icon_textures[0], true); this.cookie_sprite.setMaterial(this.cookie_material); this.cookie_sprite.setSize(this.cookie_size); this.cookie_sprite.setParent(this.root_sprite); this.cookie_material.SetTexture("_MainTexture", this.cookie_icon_textures[0]); this.cookie_material.SetTexture("_HariTexture", this.hari_shadow_texture); this.hari_sprite = Sprite2DRoot.get().createSprite(this.hari_texture, true); this.hari_sprite.setSize(this.hari_size); this.hari_sprite.setParent(this.root_sprite); this.hari_sprite.setPosition(this.hari_position); this.root_sprite.setPosition(new Vector2(0.0f, 160.0f)); }
public void create() { Vector2 root_position = new Vector2(640.0f/2.0f - 100.0f, 0.0f); // 아래에 깔리는 레이스. this.lace_sprite = Sprite2DRoot.get().createSprite(this.lace_texture, true); this.lace_sprite.setSize(new Vector2(96.0f, 96.0f)*SCALE); // 쿠키. this.cookie_sprite = Sprite2DRoot.get().createSprite(this.cookie_icon_textures[0], true); this.cookie_sprite.setSize(new Vector2(60.0f, 60.0f)*SCALE); // 얼굴 아이콘. this.face_sprite = Sprite2DRoot.get().createSprite(this.face_icon_texture, true); this.face_sprite.setSize(new Vector2(60.0f, 60.0f)*SCALE); this.setPosition(root_position); }
// ================================================================ // // 생성. public void create() { // 밑받침 (팔 주위 파란 테두리). this.under_sprite = Sprite2DRoot.get().createSprite(this.under_texture, true); this.under_sprite.setSize(new Vector2(this.under_texture.width, this.under_texture.height) / 4.0f); // 몸. this.karada_sprite = Sprite2DRoot.get().createSprite(this.karada_texture, true); this.karada_sprite.setSize(new Vector2(this.karada_texture.width, this.karada_texture.height) / 4.0f); // 팔. this.ude_sprite = Sprite2DRoot.get().createSprite(this.ude_texture, true); this.ude_sprite.setSize(new Vector2(this.ude_texture.width, this.ude_texture.height) / 4.0f); // 위치를 설정해 둔다. this.base_position = this.base_position_start; this.set_position(); }
// 표시 위치 설정. public void setPosition(Vector2 root_position) { this.lace_sprite.setPosition(root_position + new Vector2(0.0f, 0.0f)); this.cookie_sprite.setPosition(root_position + new Vector2(0.0f, 0.0f)); this.face_sprite.setPosition(root_position + new Vector2(35.0f, 35.0f) * SCALE); // Vector3 digit_position; Vector3 center = root_position; center.x += 70.0f * SCALE; center.y -= 30.0f * SCALE; center.y += 140.0f * SCALE; float angle = -45.0f; for (int i = 0; i < this.digit_sprites.Length; i++) { Sprite2DControl digit = this.digit_sprites[i]; digit_position = center + Quaternion.AngleAxis(angle, Vector3.forward) * Vector3.down * 140.0f * SCALE; digit.setPosition(digit_position); digit.setAngle(angle); if (i == 0) { angle += 10.0f; } else { angle += 15.0f; } } }
public void create() { // 스프라이트를 만든다. this.sprite = Sprite2DRoot.get().createSprite(this.font_texture, 3, true); this.sprite.setSize(this.font_size); // 변형용 정점을 초기화해 둔다.. Vector3[] positions = this.sprite.getVertexPositions(); this.vertices = new ControlVertex[positions.Length]; for (int i = 0; i < this.vertices.Length; i++) { this.vertices[i] = new ControlVertex(); this.vertices[i].position = positions[i]; this.vertices[i].position_org = this.vertices[i].position; this.vertices[i].velocity = Vector2.zero; } // 초기 위치를 난수로 변경하고 형태를 왜곡한다. for (int i = 0; i < this.vertices.Length; i++) { this.vertices[i].position *= Random.Range(0.8f, 1.3f); positions[i] = this.vertices[i].position; } this.sprite.setVertexPositions(positions); this.sprite.setVisible(false); this.time_scale = Random.Range(0.9f, 1.2f); this.step.set_next(STEP.HIDE); }
// ================================================================ // // 생성한다. public void create() { this.root_sprite = Sprite2DRoot.get().createNull(); // 캐릭터. this.chr_sprite = Sprite2DRoot.get().createSprite(this.uun_texture, true); this.chr_sprite.setSize(new Vector2(this.uun_texture.width, this.uun_texture.height) / 4.0f); this.chr_sprite.transform.parent = this.root_sprite.transform; // 모락모락. this.moya = new WeaponSelectNavi.Moya(); this.moya.root_sprite = this.root_sprite; this.moya.negi_texture = this.moya_negi_texture; this.moya.yuzu_texture = this.moya_yuzu_texture; this.moya.oke_texture = this.moya_oke_texture; this.moya.kara_texture = this.moya_kara_texture; this.moya.selecting_icon = this; this.moya.create(); this.moya.setPosition(new Vector3(20.0f, 50.0f, 0.0f)); // this.setPosition(Vector3.zero); }
void Start() { this.item_rects = new Rect[Item.SlotArray.MISC_NUM]; Vector2 base_pos = BASE_POS; base_pos.x += 8.0f; base_pos.y += 8.0f; // ---------------------------------------------------------------- // // 열쇠. Vector2 pos; // 방 열쇠. pos = base_pos - WINDOW_SIZE/2.0f; pos.x += KEY_ICON_SIZE.x*0.5f; pos.y += KEY_ICON_SIZE.y*0.5f; this.sprite_key_waku = Sprite2DRoot.get().createSprite(this.texture_key_waku, true); this.sprite_key_waku.setSize(ICON_SIZE); this.sprite_key_waku.setPosition(pos); foreach(var i in System.Linq.Enumerable.Range(0, 4)) { pos = base_pos - WINDOW_SIZE/2.0f; pos.x += KEY_ICON_SIZE.x*(i%2); pos.y += KEY_ICON_SIZE.y*(i/2); this.sprite_key[i] = Sprite2DRoot.get().createSprite(null, true); this.sprite_key[i].setSize(KEY_ICON_SIZE); this.sprite_key[i].setPosition(pos); this.sprite_key[i].setVisible(false); } // 플로어 키. pos.y = (base_pos - WINDOW_SIZE/2.0f).y; pos.y += KEY_ICON_SIZE.y*0.5f; pos.x += KEY_ICON_SIZE.x*1.2f; this.sprite_floor_key_waku = Sprite2DRoot.get().createSprite(this.texture_key_waku, true); this.sprite_floor_key_waku.setSize(ICON_SIZE); this.sprite_floor_key_waku.setPosition(pos); this.sprite_floor_key = Sprite2DRoot.get().createSprite(null, true); this.sprite_floor_key.setSize(FLOOR_KEY_ICON_SIZE); this.sprite_floor_key.setPosition(pos); this.sprite_floor_key.setVisible(false); // ---------------------------------------------------------------- // // 캔디. pos.y = (base_pos - WINDOW_SIZE/2.0f).y; pos.y += 16.0f; pos.x += 64.0f; this.sprite_candy_waku = Sprite2DRoot.get().createSprite(this.texture_waku, true); this.sprite_candy_waku.setSize(ICON_SIZE); this.sprite_candy_waku.setPosition(pos); this.sprite_candy = Sprite2DRoot.get().createSprite(null, true); this.sprite_candy.setSize(ICON_SIZE); this.sprite_candy.setPosition(pos); this.sprite_candy.setVisible(false); // ---------------------------------------------------------------- // // 기타. pos.x += 48.0f; for(int i = 0;i < (int)Item.SlotArray.MISC_NUM;i++) { this.sprite_wakus[i] = Sprite2DRoot.get().createSprite(this.texture_waku, true); this.sprite_wakus[i].setSize(ICON_SIZE); this.sprite_wakus[i].setPosition(pos); this.sprite_miscs[i] = Sprite2DRoot.get().createSprite(null, true); this.sprite_miscs[i].setSize(ICON_SIZE); this.sprite_miscs[i].setPosition(pos); this.sprite_miscs[i].setVisible(false); pos.x += ICON_SIZE.x + ICON_PITCH.x; } this.setActive(true); }
protected int disp_count = 0; // 몇 글자까지 표시했는가?. // ================================================================ // // MonoBehaviour에서 상속. void Awake() { Vector2 base_position = new Vector2(0.0f, -50.0f); // 받침대. this.balloon_sprite = Sprite2DRoot.get().createSprite(this.balloon_texture, true); this.balloon_sprite.setVertexAlpha(0.7f); this.balloon_sprite.setSize(new Vector2(540.0f, 100.0f)); this.balloon_sprite.setPosition(base_position); // 폰트 데이터 초기화. this.font_datas = new FontData[this.font_textures.Length]; this.font_datas[(int)FONT.KAKKO_L] = new FontData(0.0f, 0.5f); this.font_datas[(int)FONT.KAKKO_R] = new FontData(0.5f, 0.0f); this.font_datas[(int)FONT.HATENA] = new FontData(0.0f, 0.0f); this.font_datas[(int)FONT.TO] = new FontData(0.0f, 0.0f); this.font_datas[(int)FONT.U] = new FontData(0.0f, 0.0f); this.font_datas[(int)FONT.FU] = new FontData(0.0f, 0.0f); this.font_datas[(int)FONT.NE] = new FontData(0.0f, 0.0f); this.font_datas[(int)FONT.KI] = new FontData(0.0f, 0.0f); this.font_datas[(int)FONT.TENTEN] = new FontData(0.0f, 0.7f); this.font_datas[(int)FONT.MAME] = new FontData(0.05f, 0.05f); this.font_datas[(int)FONT.DAIKON] = new FontData(0.1f, 0.1f); this.font_datas[(int)FONT.JT] = new FontData(0.1f, 0.1f); this.font_datas[(int)FONT.UNITY] = new FontData(0.1f, 0.05f); Vector2 font_size = Vector2.one * 48.0f; for (int i = 0; i < this.font_datas.Length; i++) { this.font_datas[i].l_margin *= font_size.x; this.font_datas[i].r_margin *= font_size.x; } // 텍스트 전체의 가로폭. float total_serif_width = 0.0f; for (int i = 0; i < this.serif.Length; i++) { FontData font_data = this.font_datas[(int)this.serif[i]]; float draw_size = font_size.x - (font_data.l_margin + font_data.r_margin); total_serif_width += draw_size; } // 스프라이트를 만든다. this.mojis = new KabusanMoji[this.serif.Length]; for (int i = 0; i < this.serif.Length; i++) { this.mojis[i] = new KabusanMoji(); this.mojis[i].font_texture = this.font_textures[(int)this.serif[i]]; this.mojis[i].font_size = font_size; this.mojis[i].create(); } // 각 스프라이트의 위치. Vector2 position = Vector2.zero; position.x = -total_serif_width / 2.0f; for (int i = 0; i < this.serif.Length; i++) { FontData font_data = this.font_datas[(int)this.serif[i]]; position.x -= font_data.l_margin; this.mojis[i].sprite.setPosition(base_position + position + Vector2.right * font_size.x / 2.0f); position.x += font_size.x - font_data.r_margin; } }
// ================================================================ // public void create() { Navi navi = Navi.get(); // this.root_sprite = Sprite2DRoot.get().createNull(); this.root_sprite.setPosition(new Vector3(0.0f, POSITION_Y, 0.0f)); // 아이콘, 문자 오브젝트 생성. this.icon = new Yell.Icon(); this.icon.create(this.icon_texture); this.icon.sprite.transform.parent = this.root_sprite.transform; // this.mojis = new List <Yell.Moji>(); for (int i = 0; i < this.yell_words.Length; i++) { YellFontData font_data = navi.getYellFontData(this.yell_words[i]); Yell.Moji moji = new Yell.Moji(); moji.create(font_data.texture, this.moji_mae_texture); if (font_data.is_small) { moji.moji_mae_scale *= 0.5f; } moji.yell = this; moji.index = i; moji.sprite.transform.parent = this.root_sprite.transform; moji.reset(); if (i % 3 == 0) { moji.sprite.setVertexColor(new Color(1.0f, 1.0f, 0.5f)); } else if (i % 3 == 1) { moji.sprite.setVertexColor(new Color(1.0f, 0.7f, 0.7f)); } else if (i % 3 == 2) { moji.sprite.setVertexColor(new Color(0.3f, 1.0f, 1.0f)); } this.mojis.Add(moji); } this.icon.sprite.setDepth(this.mojis[this.mojis.Count - 1].sprite.getDepth() - 0.1f); // 문자 위치. float pitch = 54.0f; Vector2 p0 = Vector2.zero; Vector2 p1 = Vector2.zero; p0.x = (float)this.mojis.Count * pitch / 2.0f; p0.y = 0.0f; p1.x = 0.0f - ((float)this.mojis.Count) * pitch / 2.0f - pitch / 2.0f; p1.y = p0.y; this.icon.p0 = p0; this.icon.p1 = p1; p1.x += pitch; p0.x = p1.x; for (int i = 0; i < this.mojis.Count; i++) { YellFontData font_data = navi.getYellFontData(this.yell_words[i]); this.mojis[i].p0 = p0; this.mojis[i].reset(); if (font_data.is_small) { this.mojis[i].p0.x -= pitch * 0.25f; this.mojis[i].p0.y -= pitch * 0.25f; p0.x += pitch * 0.5f; } else { p0.x += pitch; } } }
protected int disp_count = 0; // 몇 글자까지 표시했는가?. // ================================================================ // // MonoBehaviour에서 상속. void Awake() { Vector2 base_position = new Vector2(0.0f, -50.0f); // 받침대. this.balloon_sprite = Sprite2DRoot.get().createSprite(this.balloon_texture, true); this.balloon_sprite.setVertexAlpha(0.7f); this.balloon_sprite.setSize(new Vector2(540.0f, 100.0f)); this.balloon_sprite.setPosition(base_position); // 폰트 데이터 초기화. this.font_datas = new FontData[this.font_textures.Length]; this.font_datas[(int)FONT.KAKKO_L] = new FontData(0.0f, 0.5f); this.font_datas[(int)FONT.KAKKO_R] = new FontData(0.5f, 0.0f); this.font_datas[(int)FONT.HATENA] = new FontData(0.0f, 0.0f); this.font_datas[(int)FONT.TO] = new FontData(0.0f, 0.0f); this.font_datas[(int)FONT.U] = new FontData(0.0f, 0.0f); this.font_datas[(int)FONT.FU] = new FontData(0.0f, 0.0f); this.font_datas[(int)FONT.NE] = new FontData(0.0f, 0.0f); this.font_datas[(int)FONT.KI] = new FontData(0.0f, 0.0f); this.font_datas[(int)FONT.TENTEN] = new FontData(0.0f, 0.7f); this.font_datas[(int)FONT.MAME] = new FontData(0.05f, 0.05f); this.font_datas[(int)FONT.DAIKON] = new FontData(0.1f, 0.1f); this.font_datas[(int)FONT.JT] = new FontData(0.1f, 0.1f); this.font_datas[(int)FONT.UNITY] = new FontData(0.1f, 0.05f); Vector2 font_size = Vector2.one*48.0f; for(int i = 0;i < this.font_datas.Length;i++) { this.font_datas[i].l_margin *= font_size.x; this.font_datas[i].r_margin *= font_size.x; } // 텍스트 전체의 가로폭. float total_serif_width = 0.0f; for(int i = 0;i < this.serif.Length;i++) { FontData font_data = this.font_datas[(int)this.serif[i]]; float draw_size = font_size.x - (font_data.l_margin + font_data.r_margin); total_serif_width += draw_size; } // 스프라이트를 만든다. this.mojis = new KabusanMoji[this.serif.Length]; for(int i = 0;i < this.serif.Length;i++) { this.mojis[i] = new KabusanMoji(); this.mojis[i].font_texture = this.font_textures[(int)this.serif[i]]; this.mojis[i].font_size = font_size; this.mojis[i].create(); } // 각 스프라이트의 위치. Vector2 position = Vector2.zero; position.x = -total_serif_width/2.0f; for(int i = 0;i < this.serif.Length;i++) { FontData font_data = this.font_datas[(int)this.serif[i]]; position.x -= font_data.l_margin; this.mojis[i].sprite.setPosition(base_position + position + Vector2.right*font_size.x/2.0f); position.x += font_size.x - font_data.r_margin; } }
// ================================================================ // public void create() { // 꼬리. this.mini_moya_sprite = new Sprite2DControl[2]; this.mini_moya_sprite[0] = Sprite2DRoot.get().createSprite(this.kara_texture, true); this.mini_moya_sprite[0].setSize(new Vector2(this.kara_texture.width, this.kara_texture.height)*0.05f); this.mini_moya_sprite[0].transform.parent = this.root_sprite.transform; this.mini_moya_sprite[1] = Sprite2DRoot.get().createSprite(this.kara_texture, true); this.mini_moya_sprite[1].setSize(new Vector2(this.kara_texture.width, this.kara_texture.height)*0.1f); this.mini_moya_sprite[1].transform.parent = this.root_sprite.transform; // 파/유자. this.negi_sprite = Sprite2DRoot.get().createSprite(this.negi_texture, true); this.negi_sprite.setSize(new Vector2(this.negi_texture.width, this.negi_texture.height)/4.0f); this.negi_sprite.transform.parent = this.root_sprite.transform; this.yuzu_sprite = Sprite2DRoot.get().createSprite(this.yuzu_texture, true); this.yuzu_sprite.setSize(new Vector2(this.yuzu_texture.width, this.yuzu_texture.height)/4.0f); this.yuzu_sprite.transform.parent = this.root_sprite.transform; // this.step.set_next(STEP.UUN); }
// ================================================================ // // 创建 public void create(Texture texture, Vector2 size) { this.sprite = Sprite2DRoot.get().createSprite(texture, 2, true); this.sprite.setSize(size); this.sprite.setDepthLayer("ui.item"); }
// 정점 위치를 획득한다. public Vector3[] getVertexPositionsFromSprite(Sprite2DControl sprite) { MeshFilter mesh_filter = sprite.GetComponent<MeshFilter>(); return(mesh_filter.mesh.vertices); }
// 정점 위치를 설정한다. public void setVertexPositionsToSprite(Sprite2DControl sprite, Vector3[] positions) { MeshRenderer mesh_render = sprite.GetComponent<MeshRenderer>(); MeshFilter mesh_filter = sprite.GetComponent<MeshFilter>(); mesh_filter.mesh.vertices = positions; mesh_render.enabled = false; mesh_render.enabled = true; }
public void setParent(Sprite2DControl parent) { this.transform.parent = parent.transform; }
void Start() { this.item_rects = new Rect[Item.SlotArray.MISC_NUM]; Vector2 base_pos = BASE_POS; base_pos.x += 8.0f; base_pos.y += 8.0f; // ---------------------------------------------------------------- // // 열쇠. Vector2 pos; // 방 열쇠. pos = base_pos - WINDOW_SIZE / 2.0f; pos.x += KEY_ICON_SIZE.x * 0.5f; pos.y += KEY_ICON_SIZE.y * 0.5f; this.sprite_key_waku = Sprite2DRoot.get().createSprite(this.texture_key_waku, true); this.sprite_key_waku.setSize(ICON_SIZE); this.sprite_key_waku.setPosition(pos); foreach (var i in System.Linq.Enumerable.Range(0, 4)) { pos = base_pos - WINDOW_SIZE / 2.0f; pos.x += KEY_ICON_SIZE.x * (i % 2); pos.y += KEY_ICON_SIZE.y * (i / 2); this.sprite_key[i] = Sprite2DRoot.get().createSprite(null, true); this.sprite_key[i].setSize(KEY_ICON_SIZE); this.sprite_key[i].setPosition(pos); this.sprite_key[i].setVisible(false); } // 플로어 키. pos.y = (base_pos - WINDOW_SIZE / 2.0f).y; pos.y += KEY_ICON_SIZE.y * 0.5f; pos.x += KEY_ICON_SIZE.x * 1.2f; this.sprite_floor_key_waku = Sprite2DRoot.get().createSprite(this.texture_key_waku, true); this.sprite_floor_key_waku.setSize(ICON_SIZE); this.sprite_floor_key_waku.setPosition(pos); this.sprite_floor_key = Sprite2DRoot.get().createSprite(null, true); this.sprite_floor_key.setSize(FLOOR_KEY_ICON_SIZE); this.sprite_floor_key.setPosition(pos); this.sprite_floor_key.setVisible(false); // ---------------------------------------------------------------- // // 캔디. pos.y = (base_pos - WINDOW_SIZE / 2.0f).y; pos.y += 16.0f; pos.x += 64.0f; this.sprite_candy_waku = Sprite2DRoot.get().createSprite(this.texture_waku, true); this.sprite_candy_waku.setSize(ICON_SIZE); this.sprite_candy_waku.setPosition(pos); this.sprite_candy = Sprite2DRoot.get().createSprite(null, true); this.sprite_candy.setSize(ICON_SIZE); this.sprite_candy.setPosition(pos); this.sprite_candy.setVisible(false); // ---------------------------------------------------------------- // // 기타. pos.x += 48.0f; for (int i = 0; i < (int)Item.SlotArray.MISC_NUM; i++) { this.sprite_wakus[i] = Sprite2DRoot.get().createSprite(this.texture_waku, true); this.sprite_wakus[i].setSize(ICON_SIZE); this.sprite_wakus[i].setPosition(pos); this.sprite_miscs[i] = Sprite2DRoot.get().createSprite(null, true); this.sprite_miscs[i].setSize(ICON_SIZE); this.sprite_miscs[i].setPosition(pos); this.sprite_miscs[i].setVisible(false); pos.x += ICON_SIZE.x + ICON_PITCH.x; } this.setActive(true); }
// 设置父对象 public void setParent(Sprite2DControl parent) { this.transform.parent = parent.transform; }
public void create() { // 스프라이트를 만든다. this.sprite = Sprite2DRoot.get().createSprite(this.font_texture, 3, true); this.sprite.setSize(this.font_size); // 변형용 정점을 초기화해 둔다.. Vector3[] positions = this.sprite.getVertexPositions(); this.vertices = new ControlVertex[positions.Length]; for(int i = 0;i < this.vertices.Length;i++) { this.vertices[i] = new ControlVertex(); this.vertices[i].position = positions[i]; this.vertices[i].position_org = this.vertices[i].position; this.vertices[i].velocity = Vector2.zero; } // 초기 위치를 난수로 변경하고 형태를 왜곡한다. for(int i = 0;i < this.vertices.Length;i++) { this.vertices[i].position *= Random.Range(0.8f, 1.3f); positions[i] = this.vertices[i].position; } this.sprite.setVertexPositions(positions); this.sprite.setVisible(false); this.time_scale = Random.Range(0.9f, 1.2f); this.step.set_next(STEP.HIDE); }
public override void initialize() { this.player = PartyControl.get().getLocalPlayer(); this.player_weapon = this.player.gameObject.findDescendant("anim_wepon"); this.data = GameObject.Find("EventDataIceAtari").GetComponent<EventDataIceAtari>(); // 당첨의 막대 모델. this.ice_bar = this.data.prefab_ice_atari_bar.instantiate(); this.ice_bar.setParent(this.player.gameObject.findDescendant("anim_wrist_R")); this.ice_bar.setLocalPosition(new Vector3(-0.056f, -0.086f, 0.039f)); this.ice_bar.SetActive(false); // "!" 말풍선. this.sprite_bikkuri = Sprite2DRoot.get().createSprite(this.data.texture_bikkuri, true); this.sprite_bikkuri.setVisible(false); // 당첨 말풍선. this.sprite_atari = Sprite2DRoot.get().createSprite(this.data.texture_atari, true); this.sprite_atari.setPosition(new Vector2(0.0f, 150.0f)); this.sprite_atari.setVisible(false); this.sprite_ice_bar = Sprite2DRoot.get().createSprite(this.data.texture_ice_bar, true); this.sprite_ice_bar.setVisible(false); this.sprite_ice_bar.setMaterial(this.data.material_ice_sprite); this.spline = this.data.gameObject.findDescendant("spline_ice").GetComponent<SimpleSplineObject>(); this.tracer.attach(this.spline.curve); }
// ================================================================ // public void create() { Navi navi = Navi.get(); // this.root_sprite = Sprite2DRoot.get().createNull(); this.root_sprite.setPosition(new Vector3(0.0f, POSITION_Y, 0.0f)); // 아이콘, 문자 오브젝트 생성. this.icon = new Yell.Icon(); this.icon.create(this.icon_texture); this.icon.sprite.transform.parent = this.root_sprite.transform; // this.mojis = new List<Yell.Moji>(); for(int i = 0;i < this.yell_words.Length;i++) { YellFontData font_data = navi.getYellFontData(this.yell_words[i]); Yell.Moji moji = new Yell.Moji(); moji.create(font_data.texture, this.moji_mae_texture); if(font_data.is_small) { moji.moji_mae_scale *= 0.5f; } moji.yell = this; moji.index = i; moji.sprite.transform.parent = this.root_sprite.transform; moji.reset(); if(i%3 == 0) { moji.sprite.setVertexColor(new Color(1.0f, 1.0f, 0.5f)); } else if(i%3 == 1) { moji.sprite.setVertexColor(new Color(1.0f, 0.7f, 0.7f)); } else if(i%3 == 2) { moji.sprite.setVertexColor(new Color(0.3f, 1.0f, 1.0f)); } this.mojis.Add(moji); } this.icon.sprite.setDepth(this.mojis[this.mojis.Count - 1].sprite.getDepth() - 0.1f); // 문자 위치. float pitch = 54.0f; Vector2 p0 = Vector2.zero; Vector2 p1 = Vector2.zero; p0.x = (float)this.mojis.Count*pitch/2.0f; p0.y = 0.0f; p1.x = 0.0f - ((float)this.mojis.Count)*pitch/2.0f - pitch/2.0f; p1.y = p0.y; this.icon.p0 = p0; this.icon.p1 = p1; p1.x += pitch; p0.x = p1.x; for(int i = 0;i < this.mojis.Count;i++) { YellFontData font_data = navi.getYellFontData(this.yell_words[i]); this.mojis[i].p0 = p0; this.mojis[i].reset(); if(font_data.is_small) { this.mojis[i].p0.x -= pitch*0.25f; this.mojis[i].p0.y -= pitch*0.25f; p0.x += pitch*0.5f; } else { p0.x += pitch; } } }
public void create(Texture texture) { this.sprite = Sprite2DRoot.get().createSprite(texture, true); this.sprite.setSize(Vector2.one*64.0f); this.sprite.setVisible(false); this.fcurve = new ipModule.FCurve(); this.fcurve.setSlopeAngle(70.0f, 5.0f); this.fcurve.setDuration(0.7f); this.fcurve.start(); }
// ================================================================ // // 생성한다. public void create() { this.root_sprite = Sprite2DRoot.get().createNull(); // 캐릭터. this.chr_sprite = Sprite2DRoot.get().createSprite(this.uun_texture, true); this.chr_sprite.setSize(new Vector2(this.uun_texture.width, this.uun_texture.height)/4.0f); this.chr_sprite.transform.parent = this.root_sprite.transform; // 모락모락. this.moya = new WeaponSelectNavi.Moya(); this.moya.root_sprite = this.root_sprite; this.moya.negi_texture = this.moya_negi_texture; this.moya.yuzu_texture = this.moya_yuzu_texture; this.moya.oke_texture = this.moya_oke_texture; this.moya.kara_texture = this.moya_kara_texture; this.moya.selecting_icon = this; this.moya.create(); this.moya.setPosition(new Vector3(20.0f, 50.0f, 0.0f)); // this.setPosition(Vector3.zero); }
// ================================================================ // public void create(Texture moji_texture, Texture moji_mae_texture) { this.moji_texture = moji_texture; this.moji_mae_texture = moji_mae_texture; this.moji_texture_size = new Vector2(this.moji_texture.width, this.moji_texture.height); this.sprite = Sprite2DRoot.get().createSprite(this.moji_mae_texture, true); this.sprite.setSize(Vector2.one*64.0f); this.fcurve = new ipModule.FCurve(); this.fcurve.setSlopeAngle(70.0f, 5.0f); this.fcurve.setDuration(0.3f); this.spring = new ipModule.Spring(); this.spring.k = 100.0f; this.spring.reduce = 0.90f; }
// 스프라이트 크기를 설정한다. public void setSizeToSprite(Sprite2DControl sprite, Vector2 size) { sprite.internalSetSize(size); Vector3[] positions = this.calcVertexPositions(sprite.getSize().x, sprite.getSize().y, sprite.getDivCount()); this.setVertexPositionsToSprite(sprite, positions); }
// スプライトをつくる. public Sprite2DControl createSprite(Texture texture, int div_count, bool is_transparent) { GameObject go = new GameObject(); go.name = "sprite-2d/"; if (texture != null) { go.name += texture.name; } go.layer = LayerMask.NameToLayer(LAYER_NAME); go.transform.parent = this.root_sprite.transform; go.transform.localPosition = new Vector3(0.0f, 0.0f, BASE_DEPTH); go.transform.localRotation = Quaternion.identity; go.transform.localScale = Vector3.one; MeshRenderer mesh_render = go.AddComponent <MeshRenderer>(); MeshFilter mesh_filter = go.AddComponent <MeshFilter>(); float w = 32.0f; float h = 32.0f; if (texture != null) { w = texture.width; h = texture.height; } // ---------------------------------------------------------------- // // 位置. Vector3[] positions = this.calcVertexPositions(w, h, div_count); // ---------------------------------------------------------------- // // UV. Vector2[] uvs = new Vector2[div_count * div_count]; float du = 1.0f / ((float)div_count - 1.0f); float dv = 1.0f / ((float)div_count - 1.0f); for (int y = 0; y < div_count; y++) { for (int x = 0; x < div_count; x++) { uvs[y * div_count + x] = new Vector2(0.0f + (float)x * du, 0.0f + (float)y * dv); } } // ---------------------------------------------------------------- // // 頂点カラー. Color[] colors = new Color[div_count * div_count]; for (int y = 0; y < div_count; y++) { for (int x = 0; x < div_count; x++) { colors[y * div_count + x] = Color.white; } } // ---------------------------------------------------------------- // // インデックス. int[] indices = new int[(div_count - 1) * (div_count - 1) * 3 * 2]; int n = 0; for (int y = 0; y < div_count - 1; y++) { for (int x = 0; x < div_count - 1; x++) { indices[n++] = (y + 1) * div_count + (x + 0); indices[n++] = (y + 1) * div_count + (x + 1); indices[n++] = (y + 0) * div_count + (x + 1); indices[n++] = (y + 0) * div_count + (x + 1); indices[n++] = (y + 0) * div_count + (x + 0); indices[n++] = (y + 1) * div_count + (x + 0); } } mesh_filter.mesh.vertices = positions; mesh_filter.mesh.uv = uvs; mesh_filter.mesh.colors = colors; mesh_filter.mesh.triangles = indices; // ---------------------------------------------------------------- // // マテリアル. if (is_transparent) { mesh_render.material = new Material(this.shader_transparent); } else { mesh_render.material = new Material(this.shader_opaque); } mesh_render.material.mainTexture = texture; // Sprite2DControl sprite = go.AddComponent <Sprite2DControl>(); sprite.internalSetSize(new Vector2(w, h)); sprite.internalSetDivCount(div_count); //this.sprite_depth -= 0.01f; return(sprite); }
// 스프라이트에 정점 색을 설정한다. public void setVertexColorToSprite(Sprite2DControl sprite, Color color) { MeshRenderer mesh_render = sprite.GetComponent<MeshRenderer>(); MeshFilter mesh_filter = sprite.GetComponent<MeshFilter>(); int div_count = sprite.getDivCount(); Color[] colors = new Color[div_count*div_count]; foreach(var i in System.Linq.Enumerable.Range(0, div_count*div_count)) { colors[i] = color; } mesh_filter.mesh.colors = colors; mesh_render.enabled = false; mesh_render.enabled = true; }
// ================================================================ // // 생성. public void create() { // 밑받침 (팔 주위 파란 테두리). this.under_sprite = Sprite2DRoot.get().createSprite(this.under_texture, true); this.under_sprite.setSize(new Vector2(this.under_texture.width, this.under_texture.height)/4.0f); // 몸. this.karada_sprite = Sprite2DRoot.get().createSprite(this.karada_texture, true); this.karada_sprite.setSize(new Vector2(this.karada_texture.width, this.karada_texture.height)/4.0f); // 팔. this.ude_sprite = Sprite2DRoot.get().createSprite(this.ude_texture, true); this.ude_sprite.setSize(new Vector2(this.ude_texture.width, this.ude_texture.height)/4.0f); // 위치를 설정해 둔다. this.base_position = this.base_position_start; this.set_position(); }
// 生成する. public void create(Vector2 size) { this.size = size; this.null_sprite = Sprite2DRoot.get().createNull(); // for (int i = 0; i < (int)PART.NUM; i++) { this.sprites.Add(null); } this.sprites[(int)PART.CENTER] = Sprite2DRoot.get().createSprite(this.root.texture_white8x8, 2, true); this.sprites[(int)PART.CENTER].name = "Botan.waku"; this.sprites[(int)PART.CENTER].setSize(size); this.sprites[(int)PART.CENTER].setDepthLayer("ui.item"); // this.sprites[(int)PART.RIGHT_TOP] = Sprite2DRoot.get().createSprite(this.root.texture_waku_kado, 2, true); this.sprites[(int)PART.RIGHT_TOP].name = "Botan.waku"; this.sprites[(int)PART.RIGHT_TOP].setPosition(new Vector2((size.x / 2.0f + this.margin / 2.0f), size.y / 2.0f + this.margin / 2.0f)); this.sprites[(int)PART.RIGHT_TOP].setAngle(-90.0f); this.sprites[(int)PART.RIGHT_TOP].setSize(Vector2.one * this.margin); this.sprites[(int)PART.RIGHT_TOP].setDepthLayer("ui.item"); this.sprites[(int)PART.RIGHT_BOTTOM] = Sprite2DRoot.get().createSprite(this.root.texture_waku_kado, 2, true); this.sprites[(int)PART.RIGHT_BOTTOM].name = "Botan.waku"; this.sprites[(int)PART.RIGHT_BOTTOM].setPosition(new Vector2((size.x / 2.0f + this.margin / 2.0f), -(size.y / 2.0f + this.margin / 2.0f))); this.sprites[(int)PART.RIGHT_BOTTOM].setAngle(-180.0f); this.sprites[(int)PART.RIGHT_BOTTOM].setSize(Vector2.one * this.margin); this.sprites[(int)PART.RIGHT_BOTTOM].setDepthLayer("ui.item"); this.sprites[(int)PART.LEFT_TOP] = Sprite2DRoot.get().createSprite(this.root.texture_waku_kado, 2, true); this.sprites[(int)PART.LEFT_TOP].name = "Botan.waku"; this.sprites[(int)PART.LEFT_TOP].setPosition(new Vector2(-(size.x / 2.0f + this.margin / 2.0f), size.y / 2.0f + this.margin / 2.0f)); this.sprites[(int)PART.LEFT_TOP].setSize(Vector2.one * this.margin); this.sprites[(int)PART.LEFT_TOP].setDepthLayer("ui.item"); this.sprites[(int)PART.LEFT_BOTTOM] = Sprite2DRoot.get().createSprite(this.root.texture_waku_kado, 2, true); this.sprites[(int)PART.LEFT_BOTTOM].name = "Botan.waku"; this.sprites[(int)PART.LEFT_BOTTOM].setPosition(new Vector2(-(size.x / 2.0f + this.margin / 2.0f), -(size.y / 2.0f + this.margin / 2.0f))); this.sprites[(int)PART.LEFT_BOTTOM].setAngle(90.0f); this.sprites[(int)PART.LEFT_BOTTOM].setSize(Vector2.one * margin); this.sprites[(int)PART.LEFT_BOTTOM].setDepthLayer("ui.item"); // this.sprites[(int)PART.RIGHT] = Sprite2DRoot.get().createSprite(this.root.texture_waku_ue, 2, true); this.sprites[(int)PART.RIGHT].name = "Botan.waku"; this.sprites[(int)PART.RIGHT].setPosition(new Vector2(size.x / 2.0f + this.margin / 2.0f, 0.0f)); this.sprites[(int)PART.RIGHT].setAngle(-90.0f); this.sprites[(int)PART.RIGHT].setSize(new Vector2(size.y, this.margin)); this.sprites[(int)PART.RIGHT].setDepthLayer("ui.item"); this.sprites[(int)PART.LEFT] = Sprite2DRoot.get().createSprite(this.root.texture_waku_ue, 2, true); this.sprites[(int)PART.LEFT].name = "Botan.waku"; this.sprites[(int)PART.LEFT].setPosition(new Vector2(-(size.x / 2.0f + this.margin / 2.0f), 0.0f)); this.sprites[(int)PART.LEFT].setAngle(90.0f); this.sprites[(int)PART.LEFT].setSize(new Vector2(size.y, this.margin)); this.sprites[(int)PART.LEFT].setDepthLayer("ui.item"); this.sprites[(int)PART.TOP] = Sprite2DRoot.get().createSprite(this.root.texture_waku_ue, 2, true); this.sprites[(int)PART.TOP].name = "Botan.waku"; this.sprites[(int)PART.TOP].setPosition(new Vector2(0.0f, size.y / 2.0f + this.margin / 2.0f)); this.sprites[(int)PART.TOP].setSize(new Vector2(size.x, this.margin)); this.sprites[(int)PART.TOP].setDepthLayer("ui.item"); this.sprites[(int)PART.BOTTOM] = Sprite2DRoot.get().createSprite(this.root.texture_waku_ue, 2, true); this.sprites[(int)PART.BOTTOM].name = "Botan.waku"; this.sprites[(int)PART.BOTTOM].setPosition(new Vector2(0.0f, -(size.y / 2.0f + this.margin / 2.0f))); this.sprites[(int)PART.BOTTOM].setAngle(-180.0f); this.sprites[(int)PART.BOTTOM].setSize(new Vector2(size.x, this.margin)); this.sprites[(int)PART.BOTTOM].setDepthLayer("ui.item"); foreach (var sprite in this.sprites) { sprite.setParent(this.null_sprite); } }
// 頂点の位置をゲットする. public Vector3[] getVertexPositionsFromSprite(Sprite2DControl sprite) { MeshFilter mesh_filter = sprite.GetComponent <MeshFilter>(); return(mesh_filter.mesh.vertices); }