You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
1.7 KiB
75 lines
1.7 KiB
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace DisComputer
|
|
{
|
|
|
|
public class IIIRegsUnitSet : MonoBehaviour
|
|
{
|
|
|
|
[Header("操作数寄存单元")]
|
|
public List<TwoWayUnit> regs_list;
|
|
|
|
[Header("顶部箭头")]
|
|
public TopProgressArrow top_arrow;
|
|
|
|
[Header("I/O端")]
|
|
public TwoWayUnit io_unit;
|
|
|
|
//运算器
|
|
[Header("运算器ALU")]
|
|
public GameObject alu_go;
|
|
|
|
//内存MEM
|
|
[Header("内存MEM")]
|
|
public GameObject eme_go;
|
|
|
|
[Header("跳转指令箭头")]
|
|
public ProgressArrow jump_arr;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 启动箭头动画
|
|
/// </summary>
|
|
/// <param name="reg_index">当前寄存单元下标</param>
|
|
/// /// <param name="end_index">指向终点单元下标</param>
|
|
/// <param name="dir_id">箭头方向</param>
|
|
/// <param name="finish">完成事件</param>
|
|
public void PlayTopArrow(int reg_index, int end_index, int dir_id, Action finish = null)
|
|
{
|
|
top_arrow.PlayTopCenter(reg_index, end_index, dir_id, finish);
|
|
}
|
|
|
|
|
|
public void RewinRegsUnitSet()
|
|
{
|
|
|
|
for (int i = 0; i < regs_list.Count; i++)
|
|
{
|
|
regs_list[i].RewindUnit();
|
|
|
|
}
|
|
io_unit.RewindUnit();
|
|
|
|
top_arrow.RewindTopArrow();
|
|
}
|
|
|
|
void SetRegName()
|
|
{
|
|
for (int i = 0; i < regs_list.Count; i++)
|
|
{
|
|
|
|
regs_list[i].gameObject.GetComponent<RegItem>().SetName("Reg" + (i + 1).ToString());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|