public void Die() { MenuMode = MenuMode.Dead; Game1.GameMode = GameModes.Menu; TransFrame = 1f; Level = Level.Dead; TransType = Trans.All; }
public DataTable ExecuteDataTable(DbCommand cmd, Trans t) { cmd.Connection = t.DbConnection; cmd.Transaction = t.DbTrans; DbProviderFactory dbfactory = DbProviderFactories.GetFactory(MyDbHelper.dbProviderName); DbDataAdapter dbDataAdapter = dbfactory.CreateDataAdapter(); dbDataAdapter.SelectCommand = cmd; DataTable dataTable = new DataTable(); dbDataAdapter.Fill(dataTable); return dataTable; }
private long CommitBase(BaseItem baseInfo, ref FSM.FileSet fset,string srcIp,ShareManDBDataContext context) { // 插入基本信息 baseInfo.Ext4 = fset.File.Length.ToString(); context.BaseItem.InsertOnSubmit(baseInfo); context.SubmitChanges(); // 插入审核信息 Audit ad = new Audit { ID = baseInfo.ID, AuditDate = DateTime.Now, State = 0 }; context.Audit.InsertOnSubmit(ad); // 開始創建文件集 FSM.FileSetMan src = new ShareMan.FSM.FileSetMan(); QS.Queries qs = new ShareMan.QS.Queries(); qs.Url ="http://localhost/QS/QueryService.asmx" ; // 查詢WebService服務地址 src.Url = qs.QueryUrl(srcIp, QS.ServiceType.FileSetMan); FileSetLink fsSrc = new FileSetLink(); //在源站点创建文件集 fsSrc.FileSetID = src.CreateFileSet(fset,false); fsSrc.IP = srcIp; /* * 此处查询当前活动的中转服务器 * * */ FileSetLink fsInter = new FileSetLink(); FSM.FileSetMan inter = new ShareMan.FSM.FileSetMan(); // 在中转服务器上创建文件集信息 fsInter.IP = qs.QueryActInterSrv(); inter.Url = qs.QueryUrl(fsInter.IP, QS.ServiceType.FileSetMan); fsInter.FileSetID = inter.CreateFileSet(fset,true); // 创建文件集进度信息 CreateProgress(baseInfo,srcIp,fsInter.IP,fsInter.FileSetID,"上传",context); // 查询中转服务器上创建的文件集信息,并保存,用于启动传输任务 fset = inter.QureyFileSet(fsInter.FileSetID); // 准备传输文件集 Trans fsrv = new Trans(); fsrv.Url = qs.QueryUrl(qs.QueryActInterSrv(), QS.ServiceType.FileService); Position pos = new Position(); pos.ip = srcIp; fsrv.Transform(Convert(fset),pos); fsrv.Start(); // 提交更改 context.FileSetLink.InsertOnSubmit(fsSrc); context.FileSetLink.InsertOnSubmit(fsInter); context.SubmitChanges(); // 创建文件链接信息 ItemLink iLink = new ItemLink(); iLink.ID = baseInfo.ID; iLink.SrcLink = fsSrc.ID; iLink.InterLink = fsInter.ID; context.ItemLink.InsertOnSubmit(iLink); context.SubmitChanges(); return baseInfo.ID; }
public void EndGame() { transFrame = 1f; transType = Trans.All; level = Level.Main; Game1.GameMode = Game1.GameModes.Menu; }
public void StopTrans(string srvIp) { Trans ts = new Trans(); QS.Queries qs = new QS.Queries(); ts.Url = qs.QueryUrl(srvIp, QS.ServiceType.FileService); // 停止中转服务器上的任务 ts.Stop(); }
/// <summary> /// 提交一个事务 /// </summary> public void CommitTrans() { Trans.Commit(); TransStats = 3; }
/// <summary> /// Rollback transaction /// </summary> public void Rollback() { Trans?.Rollback(); Dispose(); }
public static Quaternion InverseTransformRotation(Trans t, Quaternion rot) { //return rot * Quaternion.Inverse(t.Rotation); return(Quaternion.Inverse(t.Rotation) * rot); }
public StringInput() { InitializeComponent(); buttonOK.Text = Trans.T("B_OK"); }
public static Trans InverseTransformTrans(this Transform t, Trans t2) { t2.Matrix *= t.worldToLocalMatrix; return(t2); }
public void EndGame() { transFrame = 1f; transType = Trans.All; level = Level.Main; RuinExplorersMain.GameMode = RuinExplorersMain.GameModes.Menu; }
public static Trans InverseTransformTrans(this Matrix4x4 m, Trans t) { t.Matrix *= m.inverse; return(t); }
public static Trans InverseTransformTrans(this Trans t, Trans t2) { t2.Matrix *= t.Matrix.inverse; return(t2); }
public static Trans TransformTrans(this Transform t, Trans t2) { t2.Matrix *= t.localToWorldMatrix; return(t2); }
public static Trans TransformTrans(this Trans t, Trans t2) { t2.Matrix *= t.Matrix; return(t2); }
/// <summary> /// Apply a transform to a Trans. /// </summary> /// <param name="m"></param> /// <param name="t"></param> /// <returns></returns> public static Trans TransformTrans(this Matrix4x4 m, Trans t) { t.Matrix *= m; return(t); }
public DbDataReader ExecuteReader(DbCommand cmd, Trans t) { cmd.Connection.Close(); cmd.Connection = t.DbConnection; cmd.Transaction = t.DbTrans; DbDataReader reader = cmd.ExecuteReader(); DataTable dt = new DataTable(); return reader; }
private void Transition(Level goal, bool all = false) { TransGoal = goal; TransFrame = 0f; TransType = all ? Trans.All : Trans.Buttons; }
public static Ray InverseTransformRay(this Trans t, Ray r) { return(new Ray(t.InverseTransformPoint(r.origin), t.InverseTransformDirection(r.direction))); }
public static Quaternion TransformRotation(Trans t, Quaternion rot) { return(rot * t.Rotation); }
private void Transition(Level goal, bool all) { transGoal = goal; transFrame = 0f; if (all) transType = Trans.All; else transType = Trans.Buttons; }
private void btnPivot_Click(object sender, EventArgs e) { DataTable dt = (DataTable)dgvDocs.DataSource; // DataRow[] dr = dt.Select("Select Symbol, Sum(ProfitnLoss)"); var results = from Trans in dt.AsEnumerable() where Trans.Field <decimal>("SellProfitPercent") == 0.5m select Trans; // DataTable view = results.CopyToDataTable(); var dataRow = dt.AsEnumerable().Where(x => x.Field <decimal>("SellProfitPercent") == 0.5m) .Select(x => new { Name = x.Field <string>("Symbol"), profit = x.Field <decimal>("ProfitnLoss") }) .GroupBy(x => x.Name) .Select(x => new { Name = Name, Profit = x.Sum(y => y.profit) }); var rst = (from row in dt.AsEnumerable() group row by row.Field <string>("Symbol") into grp select new { Name = grp.Key, Sum = (from r in grp where r.Field <decimal>("SellProfitPercent") == 0.5m select r.Field <decimal>("ProfitnLoss")).Sum() }).ToList(); var totalPnlList = (from row in dt.AsEnumerable() group row by row.Field <decimal>("SellProfitPercent") into grp select new { Name = grp.Key, Sum = (from r in grp select r.Field <decimal>("ProfitnLoss")).Sum() }).ToList(); var pnlDayList = (from row in dt.AsEnumerable() group row by new { Date = row.Field <DateTime>("ModifiedOn"), SPP = row.Field <decimal>("SellProfitPercent"), MPL = row.Field <int>("MinPositionLevel") } into grp select new { Name = grp.Key, Sum = (from r in grp select r.Field <decimal>("ProfitnLoss")).Sum() }).ToList(); DataTable newItems = new DataTable(); newItems.Columns.Add("Name"); newItems.Columns.Add("Sum"); foreach (var item in pnlDayList) { DataRow newRow = newItems.NewRow(); newRow["Name"] = item.Name; newRow["Sum"] = item.Sum; newItems.Rows.Add(newRow); } frmStrategyPerformance frmPro = new frmStrategyPerformance(); frmPro.pnlDayDT = newItems; frmPro.Show(); }
public static Vector3 InvserScaleVector(this Trans t, Vector3 v) { var sc = t.Matrix.inverse.GetScale(); return(Matrix4x4.Scale(sc).MultiplyPoint(v)); }
private async Task WriteJsonArrayEndAsync(CancellationToken cancellationToken) { PopContext(); await Trans.WriteAsync(TJSONProtocolConstants.RightBracket, cancellationToken).ConfigureAwait(false); }
/// <summary> /// Called in a queue from MasterAudio to limit the number of times this calculation occurs per frame. /// </summary> /// <returns>true if is calculated "closest position on collider"</returns> public bool RecalcClosestColliderPosition(bool forceRecalc = false) { // follow at closest point var listenerPos = MasterAudio.ListenerTrans.position; var hasListenerMoved = _lastListenerPos != listenerPos; var closestPoint = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue); var minDist = float.MaxValue; var hasPointMoved = false; if (_actorColliders.Count > 0) { if (_actorColliders.Count == 1) { var colZero = _actorColliders[0]; if (colZero == null) { return(false); } var colPos = colZero.transform.position; if (!forceRecalc && _lastPositionByCollider[colZero] == colPos && !hasListenerMoved) { // same positions, no reason to calculate new position return(false); } hasPointMoved = true; closestPoint = colZero.ClosestPoint(listenerPos); _lastPositionByCollider[colZero] = colPos; } else { // ReSharper disable once ForCanBeConvertedToForeach for (var i = 0; i < _actorColliders.Count; i++) { var col = _actorColliders[i]; var colPos = col.transform.position; if (!forceRecalc && _lastPositionByCollider[col] == colPos && !hasListenerMoved) { continue; // has not moved, continue loop } hasPointMoved = true; var closestPointOnCollider = col.ClosestPoint(listenerPos); var dist = (listenerPos - closestPointOnCollider).sqrMagnitude; if (dist < minDist) { closestPoint = closestPointOnCollider; minDist = dist; } _lastPositionByCollider[col] = colPos; } } } else if (_actorColliders2D.Count > 0) { if (_actorColliders2D.Count == 1) { var colZero = _actorColliders2D[0]; var colPos = colZero.transform.position; if (!forceRecalc && _lastPositionByCollider2D[colZero] == colPos && !hasListenerMoved) { // same positions, no reason to calculate new position return(false); } hasPointMoved = true; closestPoint = colZero.bounds.ClosestPoint(listenerPos); _lastPositionByCollider2D[colZero] = colPos; } else { // ReSharper disable once ForCanBeConvertedToForeach for (var i = 0; i < _actorColliders2D.Count; i++) { var col = _actorColliders2D[i]; var colPos = col.transform.position; if (!forceRecalc && _lastPositionByCollider2D[col] == colPos && !hasListenerMoved) { continue; // has not moved, continue loop } hasPointMoved = true; var closestPointOn2DCollider = col.bounds.ClosestPoint(listenerPos); var dist = (listenerPos - closestPointOn2DCollider).sqrMagnitude; if (dist < minDist) { closestPoint = closestPointOn2DCollider; minDist = dist; } _lastPositionByCollider2D[col] = colPos; } } } else { return(false); // no colliders. Exit } if (!hasPointMoved) { return(false); // nothing changed, exit. } Trans.position = closestPoint; Trans.LookAt(MasterAudio.ListenerTrans); if (playingVariation != null && playingVariation.ActingVariation != null) { playingVariation.ActingVariation.transform.position = closestPoint; } _lastListenerPos = listenerPos; return(true); }
/// <summary> /// Read in a JSON string, unescaping as appropriate.. Skip Reading from the /// context if skipContext is true. /// </summary> private async Task <byte[]> ReadJsonStringAsync(bool skipContext, CancellationToken cancellationToken) { using (var buffer = new MemoryStream()) { var codeunits = new List <char>(); if (!skipContext) { await Context.ReadAsync(cancellationToken).ConfigureAwait(false); } await ReadJsonSyntaxCharAsync(TJSONProtocolConstants.Quote, cancellationToken).ConfigureAwait(false); while (true) { var ch = await Reader.ReadAsync(cancellationToken).ConfigureAwait(false); if (ch == TJSONProtocolConstants.Quote[0]) { break; } // escaped? if (ch != TJSONProtocolConstants.EscSequences[0]) { await buffer.WriteAsync(new[] { ch }, 0, 1, cancellationToken).ConfigureAwait(false); continue; } // distinguish between \uXXXX and \? ch = await Reader.ReadAsync(cancellationToken).ConfigureAwait(false); if (ch != TJSONProtocolConstants.EscSequences[1]) // control chars like \n { var off = Array.IndexOf(TJSONProtocolConstants.EscapeChars, (char)ch); if (off == -1) { throw new TProtocolException(TProtocolException.INVALID_DATA, "Expected control char"); } ch = TJSONProtocolConstants.EscapeCharValues[off]; await buffer.WriteAsync(new[] { ch }, 0, 1, cancellationToken).ConfigureAwait(false); continue; } // it's \uXXXX await Trans.ReadAllAsync(_tempBuffer, 0, 4, cancellationToken).ConfigureAwait(false); var wch = (short)((TJSONProtocolHelper.ToHexVal(_tempBuffer[0]) << 12) + (TJSONProtocolHelper.ToHexVal(_tempBuffer[1]) << 8) + (TJSONProtocolHelper.ToHexVal(_tempBuffer[2]) << 4) + TJSONProtocolHelper.ToHexVal(_tempBuffer[3])); if (char.IsHighSurrogate((char)wch)) { if (codeunits.Count > 0) { throw new TProtocolException(TProtocolException.INVALID_DATA, "Expected low surrogate char"); } codeunits.Add((char)wch); } else if (char.IsLowSurrogate((char)wch)) { if (codeunits.Count == 0) { throw new TProtocolException(TProtocolException.INVALID_DATA, "Expected high surrogate char"); } codeunits.Add((char)wch); var tmp = Utf8Encoding.GetBytes(codeunits.ToArray()); await buffer.WriteAsync(tmp, 0, tmp.Length, cancellationToken).ConfigureAwait(false); codeunits.Clear(); } else { var tmp = Utf8Encoding.GetBytes(new[] { (char)wch }); await buffer.WriteAsync(tmp, 0, tmp.Length, cancellationToken).ConfigureAwait(false); } } if (codeunits.Count > 0) { throw new TProtocolException(TProtocolException.INVALID_DATA, "Expected low surrogate char"); } return(buffer.ToArray()); } }
/// <summary> /// 终止回滚一个事务 /// </summary> public void RollbackTrans() { Trans.Rollback(); TransStats = 2; }
void Start() { trans = GetComponent <Trans>(); StartCoroutine(An()); }
public override void Show(bool b = true, bool useGroup = true, bool force = false) { if (IsShow == b && !force) { return; } float tempFade = 0.0f; tempFade = IsSameTime ? Duration : (b ? InTime : OutTime); IsShow = b; if (scaleTween != null) { scaleTween.Kill(); } if (IsScale) { scaleTween = Trans.DOScale(IsShow ? 1.0f : 0.001f, tempFade).SetEase(IsShow ? TweenScale.InEase : TweenScale.OutEase); } else { scaleTween = Trans.DOScale(IsShow ? 1.0f : 0.001f, 0).SetEase(TweenScale.InEase); } if (IsShow) { OnOpen(this, useGroup); scaleTween.OnComplete(OnFadeIn); scaleTween.SetDelay(Delay); } else { OnClose(useGroup); scaleTween.OnComplete(OnFadeOut); scaleTween.SetDelay(Delay); } if (IsShow) { SetDirtyRefresh(); //UI互斥,相同UI组只能有一个UI被打开 if (useGroup && Group > 0) { for (int i = 0; i < SubViews.Count; ++i) { if (SubViews[i] != this && SubViews[i].Group == Group && SubViews[i].ViewLevel == ViewLevel) { SubViews[i].Show(false, false); } } } } else { //关闭界面的时候自动刷新父级界面 if (ParentView.IsShow && !ParentView.IsRootView) { ParentView.SetDirtyRefresh(); } } OnShow(); }
// Use this for initialization void Start() { MotherObject = GetComponentInParent <Trans>(); //Find the transform component boundingCircle = new BoundingSphere(MotherObject.Position, BallRadius); }
public void DeleteFiles(long id, string srvIp) { Trans ts = new Trans(); QS.Queries qs = new QS.Queries(); ts.Url = qs.QueryUrl(srvIp, QS.ServiceType.FileService); // 停止中转服务器上的任务 ts.Delete(id.ToString()); }
public void RunSlice(string file, string profile) { if (procConvert != null) { MessageBox.Show(Trans.T("L_SKEIN_STILL_RUNNING") /*"Last slice job still running. Slicing of new job is canceled."*/, Trans.T("L_ERROR"), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string py = PyPy; if (py == null) { MessageBox.Show(Trans.T("L_PYPY_NOT_FOUND"), Trans.T("L_ERROR"), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string craft = findCraft(); if (craft == null) { MessageBox.Show(Trans.T("L_SKEINCRAFT_NOT_FOUND"), Trans.T("L_ERROR"), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string profdir = findSkeinforgeProfiles(); if (profdir == null) { MessageBox.Show(Trans.T("L_SKEINCRAFT_PROFILES_NOT_FOUND"), Trans.T("L_ERROR"), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } profileConfig = new SkeinConfig(Path.Combine(profdir, "skeinforge_profile.csv")); extrusionConfig = new SkeinConfig(Path.Combine(profdir, "extrusion.csv")); exportConfig = new SkeinConfig(Path.Combine(profdir, "extrusion" + Path.DirectorySeparatorChar + profile + Path.DirectorySeparatorChar + "export.csv")); multiplyConfig = new SkeinConfig(Path.Combine(profdir, "extrusion" + Path.DirectorySeparatorChar + profile + Path.DirectorySeparatorChar + "multiply.csv")); raftAndSupportConfig = new SkeinConfig(Path.Combine(profdir, "extrusion" + Path.DirectorySeparatorChar + profile + Path.DirectorySeparatorChar + "raft.csv")); // Set profile to extrusion /* cutting False * extrusion True * milling False * winding False */ profileConfig.setValue("cutting", "False"); profileConfig.setValue("milling", "False"); profileConfig.setValue("extrusion", "True"); profileConfig.setValue("winding", "False"); profileConfig.writeModified(); // Set used profile extrusionConfig.setValue("Profile Selection:", profile); extrusionConfig.writeModified(); // Set export to correct values exportConfig.setValue("Activate Export", "True"); exportConfig.setValue("Add Profile Extension", "False"); exportConfig.setValue("Add Profile Name to Filename", "False"); exportConfig.setValue("Add Timestamp Extension", "False"); exportConfig.setValue("Add Timestamp to Filename", "False"); exportConfig.setValue("Add Description to Filename", "False"); exportConfig.setValue("Add Descriptive Extension", "False"); exportConfig.writeModified(); multiplyConfig.setValue("Activate Multiply:", "False"); multiplyConfig.setValue("Activate Multiply: ", "False"); multiplyConfig.setValue("Activate Multiply", "False"); multiplyConfig.writeModified(); string target = StlToGCode(file); if (File.Exists(target)) { File.Delete(target); } // If we are in developer mode then don't add support or rafts or calibrate the height if (!Main.main.DeveloperMode) { // Modify Start Code, Raft, and Support settings to reflect the current user settings CalibrateHeightStartGcode(profdir); AddRaftConfiguration(raftAndSupportConfig); AddSupportConfiguration(raftAndSupportConfig); raftAndSupportConfig.writeModified(); // write the modified raft.csv } procConvert = new Process(); try { SlicingInfo.Start(name); SlicingInfo.SetAction(Trans.T("L_SLICING_STL_FILE...")); //"Slicing STL file ..."); slicefile = file; procConvert.EnableRaisingEvents = true; procConvert.Exited += new EventHandler(ConversionExited); procConvert.StartInfo.FileName = Main.IsMono ? py : wrapQuotes(py); procConvert.StartInfo.Arguments = wrapQuotes(craft) + " " + wrapQuotes(file); procConvert.StartInfo.UseShellExecute = false; procConvert.StartInfo.WorkingDirectory = textWorkingDirectory.Text; procConvert.StartInfo.RedirectStandardOutput = true; procConvert.OutputDataReceived += new DataReceivedEventHandler(OutputDataHandler); procConvert.StartInfo.RedirectStandardError = true; procConvert.ErrorDataReceived += new DataReceivedEventHandler(OutputDataHandler); procConvert.Start(); // Start the asynchronous read of the standard output stream. procConvert.BeginOutputReadLine(); procConvert.BeginErrorReadLine(); //Main.main.tab.SelectedTab = Main.main.tabPrint; } catch (Exception e) { Main.connection.log(e.ToString(), false, 2); RestoreConfigs(); } }
public void TransFileSet(string srcIp,string dstIp, FSM.FileSet fset) { Trans ts = new Trans(); QS.Queries qs = new QS.Queries(); ts.Url = qs.QueryUrl(dstIp, QS.ServiceType.FileService); Position pos = new Position(); pos.ip = srcIp; ts.Transform(Convert(fset),pos); ts.Start(); }
void Start() { MainCamera = GameObject.Find("Main Camera"); CenterObj = MainCamera; Menu = GameObject.Find("Menu Canvas"); Payment = GameObject.Find("Payment Canvas"); Msg = GameObject.Find("Msg Canvas"); Trans = GameObject.Find("Trans Canvas"); Search = GameObject.Find("Search Canvas"); Cart = GameObject.Find("Cart Canvas"); Info = GameObject.Find("Info Canvas"); Good = GameObject.Find("Good Canvas"); Voice = GameObject.Find("Voice Canvas"); NewOrder = GameObject.Find("Order Canvas"); Copy = GameObject.Find("Copy Canvas"); Model = GameObject.Find("Model Canvas"); House = GameObject.Find("House Canvas"); HouseView = GameObject.Find("House View"); Star = GameObject.Find("Star"); int langNum; if (!string.IsNullOrEmpty(GetString("lang"))) { langNum = int.Parse(GetString("lang")); } else { langNum = Application.systemLanguage.ToString() == "Chinese" ? 1 : Application.systemLanguage.ToString() == "English" ? 0 : 0; SetString("lang", langNum.ToString()); } Debug.Log(langNum); Language.ini(langNum);//语言初始化 Star.SetActive(false); HouseView.SetActive(false); House.SetActive(false); Model.SetActive(false); Copy.SetActive(false); NewOrder.SetActive(false); Voice.SetActive(false); Good.SetActive(false); Info.SetActive(false); Cart.SetActive(false); Search.SetActive(false); Trans.SetActive(false); Msg.SetActive(false); Payment.SetActive(false); Menu.SetActive(false); facePosition = new Vector3( Mathf.Sin((CenterObj.transform.rotation.eulerAngles.y * Mathf.PI) / 180) * faceRadius, Mathf.Sin((-CenterObj.transform.rotation.eulerAngles.x * Mathf.PI) / 180) * 3f > 1.5f ? Mathf.Sin((-CenterObj.transform.rotation.eulerAngles.x * Mathf.PI) / 180) * 3f : 1.5f, Mathf.Cos((CenterObj.transform.rotation.eulerAngles.y * Mathf.PI) / 180) * faceRadius); faceRotation = Quaternion.Euler( CenterObj.transform.rotation.eulerAngles.x < 0f ? CenterObj.transform.rotation.eulerAngles.x : 0f, CenterObj.transform.rotation.eulerAngles.y, 0f); #if UNITY_EDITOR device = 1; #endif #if UNITY_ANDROID device = 2; #endif #if UNITY_IPHONE device = 3; #endif #if UNITY_METRO device = 4; #endif Debug.Log("device: " + device); check(); //检查版本 SetString("id", "-1"); //设置初始化id为-1,即未登录 for (int i = 0; i < 10; i++) { star(); } inied = false; //以上是正式代码,以下是测试代码 }
public int ExecuteNonQuery(DbCommand cmd, Trans t) { cmd.Connection.Close(); cmd.Connection = t.DbConnection; cmd.Transaction = t.DbTrans; int ret = cmd.ExecuteNonQuery(); return ret; }
//Setting Position Vector3 setPos(Trans t) { return(new Vector3(t.x, t.y, t.z));; }
public object ExecuteScalar(DbCommand cmd, Trans t) { cmd.Connection.Close(); cmd.Connection = t.DbConnection; cmd.Transaction = t.DbTrans; object ret = cmd.ExecuteScalar(); return ret; }
//Setting Scale Vector3 setScale(Trans t) { return(new Vector3(t.xScale, t.yScale, t.zScale)); }
public void Die() { menuMode = MenuMode.Dead; RuinExplorersMain.GameMode = RuinExplorersMain.GameModes.Menu; transFrame = 1f; level = Level.Dead; transType = Trans.All; }
private void analyzer(string res) { if (readFilenames) { if (res.StartsWith("End file list")) { readFilenames = false; fillFiles(currentDirectory); return; } string[] parts = reduceSpace(res.ToLower()).Trim().Split(' '); allFiles.AddLast(new FileEntry(parts)); //files.Items.Add(new ListViewItem(parts)); return; } if (res.StartsWith("Begin file list")) { readFilenames = true; allFiles.Clear(); allDirs.Clear(); return; } // Printing done? if (res.IndexOf("Not SD printing") != -1 || res.IndexOf("Done printing file") != -1) { printing = false; toolStatus.Text = Trans.T("L_PRINT_FINISHED"); // "Print finished"; progress.Value = 200; } else if (res.IndexOf("SD printing byte ") != -1) // Print status update { string s = res.Substring(res.IndexOf("SD printing byte ") + 17); string[] s2 = s.Split('/'); if (s2.Length == 2) { long a, b; long.TryParse(s2[0], out a); long.TryParse(s2[1], out b); progress.Value = (int)(200 * a / b); } } else if (res.IndexOf("SD init fail") != -1 || res.IndexOf("volume.init failed") != -1 || res.IndexOf("openRoot failed") != -1) // mount failed { mounted = false; } else if (uploading && (res.Contains("M999") || res.IndexOf("error writing to file") != -1)) // write error { Main.conn.job.KillJob(); Main.conn.analyzer.uploading = false; uploading = false; toolStatus.Text = Trans.T("L_UPLOAD_FAILED"); // "Upload failed."; } else if (res.IndexOf("Done saving file") != -1) // save finished { double time = (double)(DateTime.Now.Ticks - startTime) * 0.0000001; uploading = false; progress.Value = 200; toolStatus.Text = Trans.T("L_UPLOAD_FINISHED"); // "Upload finished."; updateFilenames = true; Main.conn.log(Trans.T1("L_UPLOADING_TIME", Printjob.DoubleToTime(time)), false, 3); } else if (res.Contains("Invalid directory")) { if (uploading) { Main.conn.job.KillJob(); Main.conn.analyzer.uploading = false; uploading = false; toolStatus.Text = Trans.T("L_UPLOAD_FAILED"); // "Upload failed."; } } else if (res.IndexOf("File selected") != -1) { toolStatus.Text = Trans.T("L_SD_PRINTING..."); // "SD printing ..."; progress.Value = 0; printing = true; printPaused = false; startPrint = true; } else if (uploading && res.StartsWith("open failed, File")) { Main.conn.job.KillJob(); Main.conn.analyzer.uploading = false; toolStatus.Text = Trans.T("L_UPLOAD_FAILED"); // "Upload failed."; } else if (res.StartsWith("File deleted")) { waitDelete = 0; toolStatus.Text = Trans.T("L_FILE_DELETED"); // "File deleted"; updateFilenames = true; } else if (res.StartsWith("Deletion failed")) { waitDelete = 0; toolStatus.Text = Trans.T("L_DELETE_FAILED"); // "Delete failed"; } }
public void Pause() { menuMode = MenuMode.Pause; RuinExplorersMain.GameMode = RuinExplorersMain.GameModes.Menu; transFrame = 1f; level = Level.Main; transType = Trans.All; }
private void toolAddFile_Click(object sender, EventArgs e) { Printjob job = Main.conn.job; if (job.mode == 1) { updateButtons(); return; } SDCardUpload f = SDCardUpload.Execute(); if (f.exit) { toolStatus.Text = Trans.T("L_UPLOADING_FILE..."); // "Uploading file ..."; progress.Value = 0; job.BeginJob(); job.exclusive = true; job.PushData("M28 " + (currentDirectory.Length > 0?"/":"") + currentDirectory + f.textFilename.Text); if (f.checkAppendPrepend.Checked) { job.PushGCodeShortArray(Main.main.editor.getContentArray(1)); } if (f.radioCurrent.Checked) { job.PushGCodeShortArray(Main.main.editor.getContentArray(0)); } else { try { job.PushData(System.IO.File.ReadAllText(f.extFilename.Text)); } catch (Exception ex) { job.exclusive = false; job.BeginJob(); job.EndJob(); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (f.checkAppendPrepend.Checked) { job.PushGCodeShortArray(Main.main.editor.getContentArray(2)); } if (f.checkJobFinished.Checked) { PrinterConnection con = Main.conn; if (con.afterJobDisableExtruder) { job.PushData("M104 S0"); } if (con.afterJobDisablePrintbed) { job.PushData("M140 S0"); } if (con.afterJobGoDispose) { job.PushData("G90"); job.PushData("G1 X" + con.disposeX.ToString(GCode.format) + " Y" + con.disposeY.ToString(GCode.format) + " F" + con.travelFeedRate.ToString(GCode.format)); } } job.PushData("M29"); job.EndJob(); uploading = true; startTime = DateTime.Now.Ticks; } }
public void Pause() { MenuMode = MenuMode.Pause; Game1.GameMode = GameModes.Menu; TransFrame = 1f; Level = Level.Main; TransType = Trans.All; }
private void toolUnmount_Click(object sender, EventArgs e) { Main.conn.injectManualCommand("M22"); mounted = false; currentDirectory = ""; MessageBox.Show(Trans.T("L_REMOVE_SD_CARD") /*"You can remove the sd card."*/, Trans.T("L_INFORMATION"), MessageBoxButtons.OK, MessageBoxIcon.Information); }
/// <summary> /// Updates the avaible buttons to click. /// </summary> //public MethodInvoker UpdateJobButtons = delegate public void UpdateJobButtons() { switch (Main.main.current3Dview) { case RepetierHost.Main.ThreeDViewOptions.loadAFile: Main.main.positionToolSplitButton2.Enabled = false; Main.main.sliceToolSplitButton3.Enabled = false; Main.main.printStripSplitButton4.Enabled = false; Main.main.saveGCodeToolStripMenuItem.Enabled = false; Main.main.saveNewSTLMenuItem11.Enabled = false; if (Main.main.listSTLObjects.Items.Count > 0) { Main.main.STLEditorMenuOption.Enabled = true; } else { Main.main.STLEditorMenuOption.Enabled = false; } if (Main.main.livePrintingView.models.Count > 1) { Main.main.gCodeVisualizationMenuOption.Enabled = true; } else { Main.main.gCodeVisualizationMenuOption.Enabled = false; } Main.main.livePrintingMenuOption.Enabled = false; Main.main.emergencyStopStripButton6.Enabled = false; break; case RepetierHost.Main.ThreeDViewOptions.STLeditor: Main.main.positionToolSplitButton2.Enabled = true; Main.main.sliceToolSplitButton3.Enabled = true; Main.main.printStripSplitButton4.Enabled = false; Main.main.saveGCodeToolStripMenuItem.Enabled = false; Main.main.saveNewSTLMenuItem11.Enabled = true; Main.main.loadAFileMenuModeMenuOption.Enabled = false; Main.main.STLEditorMenuOption.Enabled = true; if (Main.main.editor.getContentArray(0).Count > 1) { Main.main.gCodeVisualizationMenuOption.Enabled = true; } else { Main.main.gCodeVisualizationMenuOption.Enabled = false; } Main.main.livePrintingMenuOption.Enabled = false; Main.main.emergencyStopStripButton6.Enabled = false; break; case RepetierHost.Main.ThreeDViewOptions.gcode: Main.main.positionToolSplitButton2.Enabled = false; Main.main.sliceToolSplitButton3.Enabled = false; Main.main.gCodeVisualizationMenuOption.Enabled = true; if (Main.connection.connected == true) { Main.main.printStripSplitButton4.Enabled = true; Main.main.printStripSplitButton4.Image = Main.main.imageList.Images[2]; Main.main.livePrintingMenuOption.Enabled = true; Main.main.emergencyStopStripButton6.Enabled = true; } else { Main.main.emergencyStopStripButton6.Enabled = false; } Main.main.saveGCodeToolStripMenuItem.Enabled = true; Main.main.loadAFileMenuModeMenuOption.Enabled = true; if (Main.main.listSTLObjects.Items.Count > 0) { Main.main.STLEditorMenuOption.Enabled = true; Main.main.saveNewSTLMenuItem11.Enabled = true; } break; case RepetierHost.Main.ThreeDViewOptions.livePrinting: Main.main.positionToolSplitButton2.Enabled = false; Main.main.sliceToolSplitButton3.Enabled = false; Main.main.printStripSplitButton4.Enabled = Main.connection.connected; Main.main.saveGCodeToolStripMenuItem.Enabled = true; Main.main.saveNewSTLMenuItem11.Enabled = false; Main.main.loadAFileMenuModeMenuOption.Enabled = true; if (Main.main.editor.getContentArray(0).Count > 1) { Main.main.gCodeVisualizationMenuOption.Enabled = true; } else { Main.main.gCodeVisualizationMenuOption.Enabled = false; } if (Main.main.listSTLObjects.Items.Count > 0) { Main.main.STLEditorMenuOption.Enabled = true; Main.main.saveNewSTLMenuItem11.Enabled = true; } Main.main.emergencyStopStripButton6.Enabled = true; break; } if (Main.connection.job.mode != Printjob.jobMode.printingJob) // if it is not printing. 1 = printing //if (Main.connection.job.mode != 1) // if it is not printing. 1 = printing { Main.main.killJobToolStripMenuItem.Enabled = false; //Main.main.printStripSplitButton4.Enabled = Main.conn.connected; Main.main.printStripSplitButton4.ToolTipText = Trans.T("M_RUN_JOB"); // "Run job"; Main.main.printStripSplitButton4.Text = Trans.T("M_RUN_JOB"); //"Run job"; Main.main.printStripSplitButton4.Image = Main.main.imageList.Images[2]; // image "Play" } else { Main.main.printStripSplitButton4.Enabled = true; Main.main.killJobToolStripMenuItem.Enabled = true; Main.main.printStripSplitButton4.Image = Main.main.imageList.Images[1]; // Image "pause" Main.main.printStripSplitButton4.ToolTipText = Trans.T("M_PAUSE_JOB"); //"Pause job"; Main.main.printStripSplitButton4.Text = Trans.T("M_PAUSE_JOB"); //"Pause job"; Main.main.printVisual.Clear(); } }//;
public static Vector3 ScaleVector(this Trans t, Vector3 v) { return(Matrix4x4.Scale(t.Scale).MultiplyPoint(v)); }