private void InitializeTool(ToolGeneral tool)
 {
     _tools.Add(tool);
     tool.TrackManager   = _trackManager;
     tool.TileManager    = _tileManager;
     tool.TerrainManager = _terrainManager;
     tool.SomePrefab     = SomePrefab;
     tool.ModelPrefab    = ModelPrefab;
     tool.Initialize();
 }
Example #2
0
    void Start()
    {
        InitializeTool(new Tool_MapSettings());
        InitializeTool(new Tool_MapSize());
        InitializeTool(new Tool_TilePlace());
        InitializeTool(new Tool_TileRemove());
        InitializeTool(new Tool_TerrainEdit());

        _currentTool = _tools[0];
        _currentTool.OnSelected();
    }
Example #3
0
        private DateTime setDateTimePatr(DateTime dt, DateParts dateParts, object val)
        {
            DateTime tmpDT;
            int      tmpInt;

            switch ((int)dateParts)
            {
            //case (int)DateParts.dateTime:
            //    return dt;
            case (int)DateParts.date:
                tmpDT = (DateTime)val;
                return(new DateTime(tmpDT.Year, tmpDT.Month, tmpDT.Day, dt.Hour, dt.Minute, dt.Second));

            case (int)DateParts.dateInt:
                tmpDT = ToolGeneral.intDate2Date((int)val);
                return(new DateTime(tmpDT.Year, tmpDT.Month, tmpDT.Day, dt.Hour, dt.Minute, dt.Second));

            case (int)DateParts.timeInt:
                tmpDT = ToolGeneral.intTime2Time((int)val);
                return(new DateTime(dt.Year, dt.Month, dt.Day, tmpDT.Hour, tmpDT.Minute, tmpDT.Second));

            case (int)DateParts.year:
                tmpInt = ToolType.intoRange(Convert.ToInt32(val), 1, 9999);
                return(new DateTime(tmpInt, dt.Month, dt.Day, dt.Hour, dt.Minute, dt.Second));

            case (int)DateParts.month:
                tmpInt = ToolType.intoRange(Convert.ToInt32(val), 1, 12);
                return(new DateTime(dt.Year, tmpInt, dt.Day, dt.Hour, dt.Minute, dt.Second));

            case (int)DateParts.day:
                tmpInt = ToolType.intoRange(Convert.ToInt32(val), 1, 31);
                return(new DateTime(dt.Year, dt.Month, tmpInt, dt.Hour, dt.Minute, dt.Second));

            case (int)DateParts.hour:
                tmpInt = ToolType.intoRange(Convert.ToInt32(val), 0, 23);
                return(new DateTime(dt.Year, dt.Month, dt.Day, tmpInt, dt.Minute, dt.Second));

            case (int)DateParts.minute:
                tmpInt = ToolType.intoRange(Convert.ToInt32(val), 0, 59);
                return(new DateTime(dt.Year, dt.Month, dt.Day, dt.Hour, tmpInt, dt.Second));

            case (int)DateParts.second:
                tmpInt = ToolType.intoRange(Convert.ToInt32(val), 0, 59);
                return(new DateTime(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, tmpInt));
            }
            return(dt);
        }
Example #4
0
        private void checkForTouch(DataTable table)
        {
            for (int i = 0; i < table.Rows.Count; ++i)
            {
                DataRow row = table.Rows[i];
                switch (row.RowState)
                {
                case DataRowState.Added:
                    ToolGeneral.setRecordCreator(row, environment);
                    break;

                case DataRowState.Modified:
                    ToolGeneral.setRecordEditor(row, environment);
                    break;
                }
            }
        }
    void OnGUI()
    {
        GUI.Box(new Rect(0, 0, 340, Screen.height), "");

        int i = 0;

        //draw button for every tool
        foreach (var tool in _tools)
        {
            if (GUI.Button(new Rect(5 + (i % 3) * 105, 22 * (i++ / 3) + 45, 100, 20), tool.ToolName))
            {
                _currentTool.OnDeselected();
                _currentTool = tool;
                _currentTool.OnSelected();
            }
        }

        //draw gui of the current tool
        _currentTool.UpdateGUI(new Rect(5, 22 * (i++) + 45, 330, Screen.height));
    }
        protected override void prepareBeforeUpdate(DataSet pDataSet)
        {
            base.prepareBeforeUpdate(pDataSet);
            DataTable tab;
            DataRow   row;

            tab = pDataSet.Tables[TableKSLINES.TABLE];
            for (int i = 0; i < tab.Rows.Count; ++i)
            {
                row = tab.Rows[i];
                if (isUsedRow(row))
                {
                    if (row.RowState == DataRowState.Added)
                    {
                    }
                    else
                    {
                    }
                    ToolGeneral.setReportingCurrInfo(row, reportCurencyExchange, TableKSLINES.REPORTRATE, TableKSLINES.AMOUNT, TableKSLINES.REPORTNET);
                }
            }
        }
        public override DataTable get()
        {
            DataTable exch;
            int       date;
            short     curr = (short)ToolCell.isNull(getBuilder().getParameterValue(TableDAILYEXCHANGES.CRTYPE), (short)0);

            object dt = getBuilder().getParameterValue(E_DATE_);

            if (dt != null)
            {
                date = ToolGeneral.date2IntDate((DateTime)dt);
                getBuilder().deleteParameter(E_DATE_);
                getBuilder().addParameterValue(TableDAILYEXCHANGES.DATE_, date);
            }
            else
            {
                date = (int)ToolCell.isNull(getBuilder().getParameterValue(TableDAILYEXCHANGES.DATE_), (int)0);
            }

            if ((curr == 0) || (curr == environment.getInfoApplication().periodCurrencyNativeId))
            {
                exch = getTableInstance();
                exch.Rows.Add(ToolRow.initTableNewRow(exch.NewRow()));
                ToolColumn.setColumnValue(exch, TableDAILYEXCHANGES.CRTYPE, curr);
                ToolColumn.setColumnValue(exch, TableDAILYEXCHANGES.DATE_, date);
                ToolColumn.setColumnValue(exch, TableDAILYEXCHANGES.RATES1, 1);
                ToolColumn.setColumnValue(exch, TableDAILYEXCHANGES.RATES2, 1);
                ToolColumn.setColumnValue(exch, TableDAILYEXCHANGES.RATES3, 1);
                ToolColumn.setColumnValue(exch, TableDAILYEXCHANGES.RATES4, 1);
            }
            else
            {
                exch = base.get();
            }
            exch.Columns.Add(ToolColumn.getColumnFullName(TableDUMMY.TABLE, TableDUMMY.EXCHANGE), typeof(double), TableDAILYEXCHANGES.RATES1);
            return(exch);
        }
Example #8
0
        private object dateTimePart(DateTime dt, DateParts dateParts)
        {
            switch ((int)dateParts)
            {
            case (int)DateParts.dateTime:
                return(dt);

            case (int)DateParts.date:
                return(dt.Date);

            case (int)DateParts.dateInt:
                return(ToolGeneral.date2IntDate(dt));

            case (int)DateParts.timeInt:
                return(ToolGeneral.time2IntTime(dt));

            case (int)DateParts.year:
                return(dt.Year);

            case (int)DateParts.month:
                return(dt.Month);

            case (int)DateParts.day:
                return(dt.Day);

            case (int)DateParts.hour:
                return(dt.Hour);

            case (int)DateParts.minute:
                return(dt.Minute);

            case (int)DateParts.second:
                return(dt.Second);
            }
            return(typeof(object));
        }
Example #9
0
 public override void setTime(DateTime pDateTime)
 {
     setHeader(TableINVOICE.FTIME, ToolGeneral.time2IntTime(pDateTime));
 }