Example #1
0
        public ChargeApplyForm(OrderEntity order) : this()
        {
            GridItem dgi1 = new GridItem();
            GridItem dgi2 = new GridItem();
            GridItem dgi3 = new GridItem();
            GridItem dgi4 = new GridItem();
            GridItem dgi5 = new GridItem();

            AGrid.Items.Add(dgi1);
            AGrid.Items.Add(dgi2);
            AGrid.Items.Add(dgi3);
            AGrid.Items.Add(dgi4);
            AGrid.Items.Add(dgi5);

            dgi1.PropertyDisplayName = "单据编号";
            dgi1.PropertyName        = "OrderCode";
            dgi1.Width = 75;

            dgi2.PropertyDisplayName = "单据类型";
            dgi2.PropertyName        = "OrderType";
            dgi2.Width = 75;

            dgi3.PropertyDisplayName = "状态";
            dgi3.PropertyName        = "OrderStates";
            dgi3.Width = 75;

            dgi4.PropertyDisplayName = "申请人";
            dgi4.PropertyName        = "Applicant";
            dgi4.Width = 75;

            dgi5.PropertyDisplayName = "申请部门";
            dgi5.PropertyName        = "AppliedDepartMent";
            dgi5.Width = 75;
            AGrid.InitGrid();
        }
Example #2
0
    // Start is called before the first frame update
    void Start()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        source = GetComponent <AudioSource>();
        if (isThereBegVoiceAct) //if level does not have beginning voicing
        {
            StartCoroutine("BeginningVoiceActing");
        }
        currentWave = waves[wavePoint];

        bossWave = false;

        if (boss != null)
        {
            bossCode = boss.GetComponent <BossGOAP>();
        }

        currentVoice = null;

        grid = new AGrid(this.transform, gridSizeX, gridSizeY, nodeRadius, unwalkable);// set up astar dll
        grid.CreateNodes();
        pathfinding = new APathFinding();
    }
Example #3
0
    public static ArrayList closeList; // 关闭列表:已探索,无需再探索的格子

    public void Init(int row, int col, Vector2 startPos, Vector2 endPos)
    {
        this.col    = col;
        this.row    = row;
        this.xStart = (int)startPos.x;
        this.yStart = (int)startPos.y;
        this.xEnd   = (int)endPos.x;
        this.yEnd   = (int)endPos.y;

        // 初始化地图
        map = new AGrid[row, col];
        for (int i = 0; i < row; i++)
        {
            for (int j = 0; j < col; j++)
            {
                map[i, j]   = new AGrid();
                map[i, j].x = i;
                map[i, j].y = j;
            }
        }
        map[xStart, yStart].gridType = GridType.Start;
        map[xEnd, yEnd].gridType     = GridType.End;

        openList  = new ArrayList();
        closeList = new ArrayList();
        // 计算始点H值
        map[xStart, yStart].H = Manhattan(xStart, yStart);
        // 将始点添加到开启列表,准备搜索
        openList.Add(map[xStart, yStart]);
    }
Example #4
0
    private void Awake()
    {
        CharacterMng.Instance.Init();
        UIMng.Instance.Init();
        AStarMng.Instance.Init();
        PlayerCharacter mainCharacter = CharacterMng.Instance.MainCharacter;

        UIMng.Instance.Open <VirtualJoystick>(UIMng.UIName.VirtualJoystick).Enabled(mainCharacter);
        UIMng.Instance.Open <MapUI>(UIMng.UIName.MapUI);

        string    path  = "Assets/AStarBuildArray.astar";
        TextAsset asset = new TextAsset(File.ReadAllText(path));

        string[]   value = asset.text.Split('_');
        GameObject obj   = new GameObject(typeof(AGrid).ToString(), typeof(AGrid));
        AGrid      grid  = obj.GetComponent <AGrid>();

        string[] arr = value[0].Split(',');
        grid.UnwalkableLayer = int.Parse(arr[0]);
        grid.NodeRadius      = float.Parse(arr[1]);
        grid.WorldSize.x     = float.Parse(arr[2]);
        grid.WorldSize.y     = float.Parse(arr[3]);
        grid.CreateGrid(value);
        AStarMng.Instance.Grid = grid;
    }
Example #5
0
    public static void Window(AGrid grid)
    {
        m_window = GetWindow(typeof(AStarTestEditor));
        AStarMng.Instance.Init();
        AStarMng.Instance.Grid = grid;
        GameObject obj = new GameObject(typeof(AStarAgent).ToString(), typeof(AStarAgent));

        m_agent = obj.AddComponent <AStarAgent>();
    }
 public static void Window()
 {
     m_window = GetWindow(typeof(AStarBuildEditor));
     m_grid   = LoadPathGrid();
     if (m_grid == null)
     {
         GameObject obj = new GameObject(typeof(AGrid).ToString(), typeof(AGrid));
         m_grid = obj.GetComponent <AGrid>();
     }
 }
 void Awake()
 {
     if (requestManager == null)
     {
         requestManager = GetComponent <PathRequestManager>();
     }
     if (aGrid == null)
     {
         aGrid = this.GetComponent <AGrid>();
     }
     thisScript = this;
 }
Example #8
0
    private void DrawPath(GameObject g, AGrid grid)
    {
        if (grid.fatherNode != null) {
            Vector3 startPos = new Vector3(grid.x, 0.5f, grid.y);
            Vector3 endPos = new Vector3(grid.fatherNode.x, 0.5f, grid.fatherNode.y );

            LineRenderer l = g.GetComponent<LineRenderer>();
            l.SetPosition(0, Vector3.up);
            l.SetPosition(1, (endPos - startPos) + Vector3.up);

        }
    }
Example #9
0
    private void DrawPath(GameObject g, AGrid grid)
    {
        if (grid.fatherNode != null)
        {
            Vector3 startPos = new Vector3(grid.x, 0.5f, grid.y);
            Vector3 endPos   = new Vector3(grid.fatherNode.x, 0.5f, grid.fatherNode.y);

            LineRenderer l = g.GetComponent <LineRenderer>();
            l.SetPosition(0, Vector3.up);
            l.SetPosition(1, (endPos - startPos) + Vector3.up);
        }
    }
Example #10
0
    // 实现接口方法:比较(用于排序)
    public int CompareTo(object obj)
    {
        AGrid g = (AGrid)obj;

        if (this.F < g.F)
        {
            return(-1);
        }
        else if (this.F > g.F)
        {
            return(1);
        }
        else
        {
            return(0);
        }
    }
    static AGrid LoadPathGrid()
    {
        string path = "Assets/AStarBuildArray.astar";

        if (!File.Exists(path))
        {
            return(null);
        }

        TextAsset asset = new TextAsset(File.ReadAllText(path));

        string[]   value = asset.text.Split('_');
        GameObject obj   = new GameObject(typeof(AGrid).ToString(), typeof(AGrid));
        AGrid      grid  = obj.GetComponent <AGrid>();

        string[] arr = value[0].Split(',');
        grid.UnwalkableLayer = int.Parse(arr[0]);
        grid.NodeRadius      = float.Parse(arr[1]);
        grid.WorldSize.x     = float.Parse(arr[2]);
        grid.WorldSize.y     = float.Parse(arr[3]);
        grid.CreateGrid(value);
        return(grid);
    }
Example #12
0
    // 搜索下一步
    void NextStep()
    {
        // 如果开启列表中已经无节点,表示搜索完毕
        if (openList.Count == 0)
        {
            Debug.Log("Over !");
            return;
        }
        // 对开启列表排序(F)
        openList.Sort();

        // 1. 选择第一个格子为当前格,进行搜索
        AGrid grid = (AGrid)openList[0];

        grid.isCurrent = true;

        // 2. 判断是否是终点
        if (grid.gridType == GridType.End)
        {
            Debug.Log("Find Way!!");
            return;
        }
        // 3. 搜索当前格周边格子
        for (int i = -1; i <= 1; i++)
        {
            for (int j = -1; j <= 1; j++)
            {
                if (i != 0 || j != 0)
                {
                    int x = grid.x + i;
                    int y = grid.y + j;
                    // 如果周边格子不越界且不是障碍且不在关闭列表中
                    if (x >= 0 && x < row && y >= 0 && y < col &&
                        map[x, y].gridType != GridType.Obstacle &&
                        !closeList.Contains(map[x, y]))
                    {
                        // 4. 【重点】重新计算G值并分情况比较
                        int g = grid.G + (int)(Mathf.Sqrt(Mathf.Abs(i) +
                                                          Mathf.Abs(j)) * 10);
                        if (!openList.Contains(map[x, y]))
                        {
                            map[x, y].G = g;
                            map[x, y].H = Manhattan(x, y);
                            map[x, y].F = map[x, y].G + map[x, y].H;
                            // 【重点】记录“我从哪里来”
                            map[x, y].fatherNode = grid;
                            // 【重点】将新搜索的格子放到开启列表中
                            openList.Add(map[x, y]);
                        }
                        else if (map[x, y].G > g)
                        {
                            map[x, y].G          = g;
                            map[x, y].F          = map[x, y].G + map[x, y].H;
                            map[x, y].fatherNode = grid;
                        }
                    }
                }
            }
        }

        grid.isCurrent = false;
        closeList.Add(grid);
        openList.Remove(grid);
    }
Example #13
0
    public Transform TargetPosition;             //Starting position to pathfind to

    private void Awake()                         //When the program starts
    {
        AGridReference = GetComponent <AGrid>(); //Get a reference to the game manager
    }
 private void Awake()
 {
     requestManager = GetComponent <PathRequestManager>();
     aGrid          = GetComponent <AGrid>();
 }
Example #15
0
 public static void GetGrid(LayoutStyle style, AGrid grid)
 {
 }
Example #16
0
 private void Awake()
 {
     grid = GetComponent <AGrid>();
 }
Example #17
0
    private int yStart; // 始点y坐标

    #endregion Fields

    #region Methods

    public void Init(int row, int col, Vector2 startPos, Vector2 endPos)
    {
        this.col = col;
        this.row = row;
        this.xStart = (int) startPos.x;
        this.yStart = (int) startPos.y;
        this.xEnd = (int) endPos.x;
        this.yEnd = (int) endPos.y;

        // 初始化地图
        map = new AGrid[row, col];
        for (int i = 0; i < row; i++) {
            for (int j = 0; j < col; j++) {
                map[i, j] = new AGrid();
                map[i, j].x = i;
                map[i, j].y = j;
            }
        }
        map[xStart, yStart].gridType = GridType.Start;
        map[xEnd, yEnd].gridType = GridType.End;

        openList = new ArrayList();
        closeList = new ArrayList();
        // 计算始点H值
        map[xStart, yStart].H = Manhattan(xStart, yStart);
        // 将始点添加到开启列表,准备搜索
        openList.Add (map[xStart, yStart]);
    }