Exemplo n.º 1
0
 public void Copy(CharacterData _in)
 {
     order = _in.order;
     unit_part = _in.unit_part;
     unit_index = _in.unit_index;
     armor_part = _in.armor_part;
     armor_index = _in.armor_index;
     armor_color = _in.armor_color;
     main_weapon_part = _in.main_weapon_part;
     main_weapon_index = _in.main_weapon_index;
     sub_weapon_part = _in.sub_weapon_part;
     sub_weapon_index = _in.sub_weapon_index;
     wing_part = _in.wing_part;
     wing_index = _in.wing_index;
 }
Exemplo n.º 2
0
        public Texture2D CreateCharacterTexture(CharacterData _info, string _save_path)
        {
            PackageData_Unit _pak_unit = GetPackage_Unit(_info.unit_part, _info.unit_index);
            PackageData_Armor _pak_armor = GetPackage_Armor(_info.armor_part, _info.armor_index, _info.armor_color);

            if (_pak_armor == null)
            {
                m_part_glove_main.sprite = GetSprite_Unit(_info.unit_part, CHARACTER_PART.GLOVE_MAIN, _info.unit_index, false, false);
                m_part_glove_main.color = _pak_unit == null ? Color.white : _pak_unit.glove_color;
                m_part_glove_sub.sprite = GetSprite_Unit(_info.unit_part, CHARACTER_PART.GLOVE_SUB, _info.unit_index, false, false);
                m_part_glove_sub.color = _pak_unit == null ? Color.white : _pak_unit.glove_color;
                m_part_arm_back.sprite = GetSprite_Unit(_info.unit_part, CHARACTER_PART.ARM_MAIN, _info.unit_index, false, false);
                m_part_arm_back.color = _pak_unit == null ? Color.white : _pak_unit.arm_color;
                m_part_arm_front.sprite = GetSprite_Unit(_info.unit_part, CHARACTER_PART.ARM_SUB, _info.unit_index, false, false);
                m_part_arm_front.color = _pak_unit == null ? Color.white : _pak_unit.arm_color;
                m_part_body.sprite = GetSprite_Unit(_info.unit_part, CHARACTER_PART.BODY, _info.unit_index, false, false);
                m_part_eye_0.sprite = GetSprite_Unit(_info.unit_part, CHARACTER_PART.EYE, _info.unit_index, false, false);
                m_part_eye_0.color = _pak_unit == null ? Color.white : _pak_unit.eye_color;
                m_part_eye_1.sprite = GetSprite_Unit(_info.unit_part, CHARACTER_PART.EYE, _info.unit_index, false, true);
                m_part_eye_1.color = _pak_unit == null ? Color.white : _pak_unit.eye_color;
                m_part_head_normal.sprite = GetSprite_Unit(_info.unit_part, CHARACTER_PART.FACE, _info.unit_index, false, false);
                m_part_leg_0.sprite = GetSprite_Unit(_info.unit_part, CHARACTER_PART.LEG_0, _info.unit_index, false, false);
                m_part_leg_1.sprite = GetSprite_Unit(_info.unit_part, CHARACTER_PART.LEG_1, _info.unit_index, false, false);
            }
            else
            {
                switch (_pak_armor.option)
                {
                    case SHOW_OPTION.HIDE_FACE:
                        m_part_eye_0.sprite = null;
                        m_part_eye_1.sprite = null;
                        m_part_head_normal.sprite = null;
                        break;
                    case SHOW_OPTION.SHOW_HAIR:
                        m_part_eye_0.sprite = GetSprite_Unit(_info.unit_part, CHARACTER_PART.EYE, _info.unit_index, false, false);
                        m_part_eye_0.color = _pak_unit == null ? Color.white : _pak_unit.eye_color;
                        m_part_eye_1.sprite = GetSprite_Unit(_info.unit_part, CHARACTER_PART.EYE, _info.unit_index, false, true);
                        m_part_eye_1.color = _pak_unit == null ? Color.white : _pak_unit.eye_color;
                        m_part_head_normal.sprite = GetSprite_Unit(_info.unit_part, CHARACTER_PART.FACE, _info.unit_index, false, false);
                        break;
                    default:
                        m_part_eye_0.sprite = GetSprite_Unit(_info.unit_part, CHARACTER_PART.EYE, _info.unit_index, false, false);
                        m_part_eye_0.color = _pak_unit == null ? Color.white : _pak_unit.eye_color;
                        m_part_eye_1.sprite = GetSprite_Unit(_info.unit_part, CHARACTER_PART.EYE, _info.unit_index, false, true);
                        m_part_eye_1.color = _pak_unit == null ? Color.white : _pak_unit.eye_color;
                        m_part_head_normal.sprite = GetSprite_Unit(_info.unit_part, CHARACTER_PART.FACE, _info.unit_index, true, false);
                        break;
                }

                m_part_arm_back.sprite = GetSprite_Armor(_info.armor_part, CHARACTER_PART.ARM_MAIN, _info.armor_index, _info.armor_color);
                m_part_arm_back.color = _pak_unit == null ? Color.white : _pak_armor.arm_color;
                m_part_arm_front.sprite = GetSprite_Armor(_info.armor_part, CHARACTER_PART.ARM_SUB, _info.armor_index, _info.armor_color);
                m_part_arm_front.color = _pak_unit == null ? Color.white : _pak_armor.arm_color;
                m_part_neck.color = _pak_armor.arm_color;
                m_part_body.sprite = GetSprite_Armor(_info.armor_part, CHARACTER_PART.BODY, _info.armor_index, _info.armor_color);
                m_part_glove_main.sprite = GetSprite_Armor(_info.armor_part, CHARACTER_PART.GLOVE_MAIN, _info.armor_index, _info.armor_color);
                m_part_glove_main.color = _pak_unit == null ? Color.white : _pak_armor.glove_color;
                m_part_glove_sub.sprite = GetSprite_Armor(_info.armor_part, CHARACTER_PART.GLOVE_SUB, _info.armor_index, _info.armor_color);
                m_part_glove_sub.color = _pak_unit == null ? Color.white : _pak_armor.glove_color;
                m_part_leg_0.sprite = GetSprite_Armor(_info.armor_part, CHARACTER_PART.LEG_0, _info.armor_index, _info.armor_color);
                m_part_leg_1.sprite = GetSprite_Armor(_info.armor_part, CHARACTER_PART.LEG_1, _info.armor_index, _info.armor_color);
            }

            // helm
            m_part_helm.sprite = GetSprite_Armor(_info.armor_part, CHARACTER_PART.HELM, _info.armor_index, _info.armor_color);
            m_part_neck.sprite = GetSprite_Armor(_info.armor_part, CHARACTER_PART.NECK, _info.armor_index, _info.armor_color);

            m_part_weapon_main.sprite = GetSprite_Weapon(_info.main_weapon_part, _info.main_weapon_index);
            m_part_weapon_sub.sprite = GetSprite_Weapon(_info.sub_weapon_part, _info.sub_weapon_index);
            m_part_cape.sprite = GetSprite_Wing(_info.wing_part, _info.wing_index);

            m_render_camera.Render();

            RenderTexture.active = m_render_camera.targetTexture;
            Texture2D output = new Texture2D(DevEngine.texture_size, DevEngine.texture_size, TextureFormat.ARGB32, false);
            output.ReadPixels(new Rect(0, 0, DevEngine.texture_size, DevEngine.texture_size), 0, 0);
            output.Apply();

            if (string.IsNullOrEmpty(_save_path) == false)
            {
                byte[] pngShot = output.EncodeToPNG();
                //System.IO.File.WriteAllBytes(_save_path, pngShot);

                System.IO.FileStream fs = new System.IO.FileStream(_save_path, System.IO.FileMode.Create);
                System.IO.BinaryWriter bw = new System.IO.BinaryWriter(fs);
                bw.Write(pngShot);
                bw.Close();
                fs.Close();
            }
            return output;
        }
Exemplo n.º 3
0
 public Texture2D CreateCharacterTexture(CharacterData _info)
 {
     return CreateCharacterTexture(_info, null);
 }