コード例 #1
0
ファイル: PlayMode2DR.cs プロジェクト: argul/tri_battle
	void Start()
	{
		rand.Seed(0);
		view.cellProvider = (sa, size)=>{
			var ret = GameObject.Instantiate(prefab);
			ret.Init(sa, size);
			return ret;
		};

		var builder = new PlayableEnvBuilder();
		if (Game.IsClassicScheme)
		{
			env = builder.Build_2DR_Hardcoded();
		}
		else
		{
			env = builder.Build_2DR(new PlayableScheme(Game.Dumps[Game.Selection]));
		}

		env.InitPlayableContainer();
		layout = new ViewLayout2DR(10, 10, env.Foreground.Width, env.Foreground.Height);
		view.Init(env.Foreground, layout);

		tap.OnGesture += OnTap;

	}
コード例 #2
0
ファイル: PlayMode2DR.cs プロジェクト: argul/tri_battle
    void Start()
    {
        rand.Seed(0);
        view.cellProvider = (sa, size) => {
            var ret = GameObject.Instantiate(prefab);
            ret.Init(sa, size);
            return(ret);
        };

        var builder = new PlayableEnvBuilder();

        if (Game.IsClassicScheme)
        {
            env = builder.Build_2DR_Hardcoded();
        }
        else
        {
            env = builder.Build_2DR(new PlayableScheme(Game.Dumps[Game.Selection]));
        }

        env.InitPlayableContainer();
        layout = new ViewLayout2DR(10, 10, env.Foreground.Width, env.Foreground.Height);
        view.Init(env.Foreground, layout);

        tap.OnGesture += OnTap;
    }
コード例 #3
0
    public void LoadData(List <SlotTrait> colorTraits)
    {
        layout = new ViewLayout2DR(8f, 1f, 8, 1);
        UnityExtension.DestroyAllChildren(cellRoot);
        for (int i = 0; i < traitColors.Length; i++)
        {
            var cell = GameObject.Instantiate(pfbCell);
            var sa   = new SlotAttribute(SlotAttribute.Category.TARGET);
            sa.trait = new SlotTraitColor((byte)(traitColors[i].r * 255),
                                          (byte)(traitColors[i].g * 255),
                                          (byte)(traitColors[i].b * 255),
                                          255);
            cell.Init(sa, layout.CellSize);
            cell.transform.SetParent(cellRoot.transform, layout.Logic2View(new Pos2D(i, 0)), cell.transform.localScale);
            cells[i] = cell;

            foreach (var ct in colorTraits)
            {
                if (sa.trait.AbsoluteEqual(ct))
                {
                    cell.SetSelected(true);
                }
            }
        }
    }
コード例 #4
0
 public void Init(Container2D_Rectangular container, ViewLayout2DR layout)
 {
     this.layout = layout;
     cells       = new ViewCell[container.Height, container.Width];
     container.ForeachSlot((x, y, s) => {
         InsertCell(s.slotAttribute, new Pos2D(x, y));
     });
     if (drawCoordinate)
     {
         DrawCoordinates(container);
     }
 }
コード例 #5
0
ファイル: PlayableView2DR.cs プロジェクト: argul/tri_battle
	public void Init(Container2D_Rectangular container, ViewLayout2DR layout)
	{
		this.layout = layout;
		cells = new ViewCell[container.Height,container.Width];
		container.ForeachSlot((x, y, s)=>{
			InsertCell(s.slotAttribute, new Pos2D(x, y));
		});
		if (drawCoordinate)
		{
			DrawCoordinates(container);
		}
	}
コード例 #6
0
ファイル: EditContainer2DR.cs プロジェクト: argul/tri_battle
	public void Draw(float viewWidth, float viewHeight, int logicWidth, int logicHeight)
	{
		this.viewWidth = viewWidth;
		this.viewHeight = viewHeight;
		this.logicWidth = logicWidth;
		this.logicHeight = logicHeight;

		layout = new ViewLayout2DR(viewWidth, viewHeight, logicWidth, logicHeight);
		selection = new bool[logicHeight, logicWidth];
		cells = new GameObject[logicHeight, logicWidth];
		cellRoot.DestroyAllChildren();
		lineRoot.DestroyAllChildren();
		var halfCellSize = layout.CellSize / 2;
		for (int i = 0; i <= logicWidth; i++)
		{
			DrawVerticalLine(layout.Logic2View(new Pos2D(i, 0)).x - halfCellSize.x);
		}
		for (int j = 0; j <= logicHeight; j++)
		{
			DrawHorizontalLine(layout.Logic2View(new Pos2D(0, j)).y - halfCellSize.y);
		}
	}
コード例 #7
0
    public void Draw(float viewWidth, float viewHeight, int logicWidth, int logicHeight)
    {
        this.viewWidth   = viewWidth;
        this.viewHeight  = viewHeight;
        this.logicWidth  = logicWidth;
        this.logicHeight = logicHeight;

        layout    = new ViewLayout2DR(viewWidth, viewHeight, logicWidth, logicHeight);
        selection = new bool[logicHeight, logicWidth];
        cells     = new GameObject[logicHeight, logicWidth];
        cellRoot.DestroyAllChildren();
        lineRoot.DestroyAllChildren();
        var halfCellSize = layout.CellSize / 2;

        for (int i = 0; i <= logicWidth; i++)
        {
            DrawVerticalLine(layout.Logic2View(new Pos2D(i, 0)).x - halfCellSize.x);
        }
        for (int j = 0; j <= logicHeight; j++)
        {
            DrawHorizontalLine(layout.Logic2View(new Pos2D(0, j)).y - halfCellSize.y);
        }
    }