137 lines
2.9 KiB
C#
137 lines
2.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
[Serializable]
|
|
public class raw_class
|
|
{
|
|
public bool foldout;
|
|
|
|
public bool settings_foldout;
|
|
|
|
public int raw_number;
|
|
|
|
public List<int> file_index;
|
|
|
|
public List<bool> file_foldout;
|
|
|
|
public string path;
|
|
|
|
public bool tile_offset;
|
|
|
|
public bool flip_x;
|
|
|
|
public bool flip_y;
|
|
|
|
public bool flipTotalY;
|
|
|
|
public bool flipTotalX;
|
|
|
|
public bool clamp;
|
|
|
|
public int list_length;
|
|
|
|
public int list_row;
|
|
|
|
public bool display_short_list;
|
|
|
|
public list_condition_enum raw_list_mode;
|
|
|
|
public image_mode_enum raw_mode;
|
|
|
|
public object @object;
|
|
|
|
public auto_search_class auto_search;
|
|
|
|
public bool raw_auto_scale;
|
|
|
|
public Vector2 conversion_step;
|
|
|
|
public float tile_x;
|
|
|
|
public float tile_y;
|
|
|
|
public bool tile_link;
|
|
|
|
public float tile_offset_x;
|
|
|
|
public float tile_offset_y;
|
|
|
|
public bool rgb;
|
|
|
|
public bool rotation;
|
|
|
|
public float rotation_value;
|
|
|
|
public bool output;
|
|
|
|
public float output_pos;
|
|
|
|
public raw_class()
|
|
{
|
|
foldout = true;
|
|
file_index = new List<int>();
|
|
file_foldout = new List<bool>();
|
|
path = string.Empty;
|
|
list_length = 1;
|
|
list_row = 4;
|
|
auto_search = new auto_search_class();
|
|
raw_auto_scale = true;
|
|
conversion_step = new Vector2(1f, 1f);
|
|
tile_x = 1f;
|
|
tile_y = 1f;
|
|
rgb = true;
|
|
file_index.Add(-1);
|
|
file_foldout.Add(true);
|
|
}
|
|
|
|
public virtual void adjust_list()
|
|
{
|
|
int num = list_length - file_index.Count;
|
|
int num2 = default(int);
|
|
if (num > 0)
|
|
{
|
|
for (num2 = 0; num2 < num; num2++)
|
|
{
|
|
file_index.Add(-1);
|
|
file_foldout.Add(false);
|
|
}
|
|
}
|
|
if (num < 0)
|
|
{
|
|
num *= -1;
|
|
for (num2 = 0; num2 < num; num2++)
|
|
{
|
|
file_index.RemoveAt(file_index.Count - 1);
|
|
file_foldout.RemoveAt(file_foldout.Count - 1);
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual void set_raw_auto_scale(terrain_class preterrain1, Rect area, List<raw_file_class> raw_files, int raw_number)
|
|
{
|
|
if (raw_number >= file_index.Count || !raw_files[file_index[raw_number]].assigned || preterrain1 == null)
|
|
{
|
|
return;
|
|
}
|
|
if (raw_mode == image_mode_enum.Area)
|
|
{
|
|
conversion_step.x = area.width / (raw_files[file_index[raw_number]].resolution.x - 1f);
|
|
conversion_step.y = area.height / (raw_files[file_index[raw_number]].resolution.y - 1f);
|
|
}
|
|
else if (raw_mode == image_mode_enum.Terrain)
|
|
{
|
|
if ((bool)preterrain1.terrain)
|
|
{
|
|
conversion_step.x = preterrain1.terrain.terrainData.size.x / (raw_files[file_index[raw_number]].resolution.x - 1f);
|
|
conversion_step.y = preterrain1.terrain.terrainData.size.z / (raw_files[file_index[raw_number]].resolution.y - 1f);
|
|
}
|
|
}
|
|
else if (raw_mode == image_mode_enum.MultiTerrain)
|
|
{
|
|
conversion_step.x = preterrain1.terrain.terrainData.size.x * preterrain1.tiles.x / (raw_files[file_index[raw_number]].resolution.x - 1f);
|
|
conversion_step.y = preterrain1.terrain.terrainData.size.z * preterrain1.tiles.y / (raw_files[file_index[raw_number]].resolution.y - 1f);
|
|
}
|
|
}
|
|
}
|