public Sign() { signId = -1; activeSign = false; signText = String.Empty; signPosition = new Point(0, 0); signType = SignType.Sign; }
public Sign(Int32 id, Boolean active, String text, Point pos) { signId = id; activeSign = active; signText = text; signPosition = pos; signType = SignType.Sign; }
SignInfo GetSignInfo(SignType type) { foreach (SignInfo sign in signs) { if (sign.type == type) return sign; } return null; }
public static Sign createSign(SignType t) { switch (t) { case SignType.error: return(new Sign("error")); case SignType.success: return(new Sign("success")); default: return(null); } }
internal static char ToChar(SignType v) { switch (v) { case SignType.Plus: return('+'); case SignType.Minus: return('-'); default: throw new NotImplementedException(); } }
public SignItem(IDataRecord record, DocSignatureDALC data) { _signId = (int)record[data.IDField]; _employee = (int)record["КодСотрудника"]; _employee4 = (int)record["КодСотрудникаЗА"]; _fio = (string)record["ФИО"]; _fio4 = (string)record["ФИОЗА"]; signText = record["ТекстПодписи"].ToString(); _date = (DateTime)record["Дата"]; if (record[data.DocumentSingatureTypeField].Equals(DBNull.Value)) { signType = SignType.noSign; } else { switch ((byte)record[data.DocumentSingatureTypeField]) { case 1: signType = SignType.finalSign; break; case 2: signType = SignType.cancelSign; break; case 3: signType = SignType.hzSing; break; case 100: signType = SignType.stampSign; break; case 101: signType = SignType.interanalSign; break; default: signType = SignType.firstSign; break; } } _canRemove = record["МожноУдалить"].Equals((byte)1); }
public static IPropertySetter GetPropertySetterBySign(SignType pSignType) { switch (pSignType) { case SignType.RGB: return(RGB()); //case SignType.Red: // return Red(); //case SignType.Amber: // return Amber(); default: return(RGB()); } }
/// <summary> /// 实例化RSAHelper /// </summary> /// <param name="signType">加密算法类型 RSA SHA1;RSA2 SHA256 密钥长度至少为2048</param> /// <param name="encoding">编码类型</param> /// <param name="privateKey">私钥</param> /// <param name="publicKey">公钥</param> public RSAHelper(SignType signType, Encoding encoding, string privateKey, string publicKey = null) { _encoding = encoding; if (!string.IsNullOrEmpty(privateKey)) { _privateKeyRsaProvider = CreateRsaProviderFromPrivateKey(privateKey); } if (!string.IsNullOrEmpty(publicKey)) { _publicKeyRsaProvider = CreateRsaProviderFromPublicKey(publicKey); } _hashAlgorithmName = signType == SignType.RSA ? HashAlgorithmName.SHA1 : HashAlgorithmName.SHA256; }
/// <summary> /// 签名流数据 /// </summary> /// <param name="data">待签名数据</param> /// <param name="type">签名算法</param> /// <returns>签名数据</returns> public static string Sign(Stream data, SignType type) { var result = SignStream(data, type); if (result == null) { return(null); } var ret = new StringBuilder(); foreach (var b in result) { ret.AppendFormat("{0:X2}", b); } return(ret.ToString()); }
/// <summary> /// 显示符号一段时间 /// </summary> /// <param name="type">符号类型</param> /// <param name="time">持续时间</param> /// <param name="color">色彩颜色</param> public void ShowForSecond(SignType type, float time, Color color) { switch (type) { case SignType.Exclamation: image.sprite = exclamationSprite; break; case SignType.Question: image.sprite = questionSprite; break; } image.color = color; image.gameObject.SetActive(true); StartCoroutine(WaitToInactive(time)); }
public void SetWinner(SignType value) { switch (value) { case SignType.Cross: Text.text = "Крестик победил"; break; case SignType.Ring: Text.text = "Нолик победил"; break; default: throw new ArgumentOutOfRangeException(nameof(value), value, null); } }
public void SetTurn(SignType gameStateCurrentType) { switch (gameStateCurrentType) { case SignType.Cross: TurnLabel.text = "Ходит крестик"; break; case SignType.Ring: TurnLabel.text = "Ходит нолик"; break; default: throw new ArgumentOutOfRangeException(nameof(gameStateCurrentType), gameStateCurrentType, null); } }
public AreaModel UpdateSign(AreaModel model, SignType type) { model.Type = type; switch (type) { case SignType.PLAYER_SIGN: SwitchSprite(model, model.PlayerSign); break; case SignType.COMPUTER_SIGN: SwitchSprite(model, model.ComputerSign); break; } return(model); }
public static bool LogSign(SignType signType, User user) { using (var db = new AltasoftDailyContext()) { var sign = db.SignLogs.Create(); sign.User = user != null ? db.Users.FirstOrDefault(x => x.UserID == user.UserID) : null; sign.Date = DateTime.Now; sign.InternalUsername = Environment.UserName; sign.SignType = signType; db.SignLogs.Add(sign); db.SaveChanges(); } return true; }
public void updateSignType(SignType newType) { type = newType; string modelpath = string.Empty; string texturepath = string.Empty; int yRotation = 0; switch (type) { case SignType.OneWayNorth: modelpath = "/oneWaySign_v3/oneWay_cube_01"; texturepath = "Textures/oneWaySign_text"; yRotation = 270; break; case SignType.OneWaySouth: modelpath = "/oneWaySign_v3/oneWay_cube_01"; texturepath = "Textures/oneWaySign_text"; yRotation = 90; break; case SignType.OneWayEast: modelpath = "/oneWaySign_v3/oneWay_cube_01"; texturepath = "Textures/oneWaySign_text"; yRotation = 360; break; case SignType.OneWayWest: modelpath = "/oneWaySign_v3/oneWay_cube_01"; texturepath = "Textures/oneWaySign_text"; yRotation = 180; break; case SignType.None: modelpath = "/defaultSignDupe/stopSign_cube_01"; texturepath = null; yRotation = 180; break; } this.transform.rotation = Quaternion.Euler(0, yRotation, 0); MeshFilter mf1 = (MeshFilter)GameObject.Find(modelpath).GetComponent("MeshFilter"); Mesh m1 = (Mesh)Mesh.Instantiate(mf1.mesh); MeshFilter mf2 = (MeshFilter)GameObject.Find("/" + this.gameObject.name + "/stopSign_cube_01").GetComponent("MeshFilter"); mf2.mesh = m1; Texture newTexture = (Texture)Resources.Load(texturepath); print(newTexture); //All signs MUST have different names in the hierarchy view, or else this will just apply to the first one in the list print(GameObject.Find("/" + this.gameObject.name + "/stopSign_cube_01").renderer.material); GameObject.Find("/" + this.gameObject.name + "/stopSign_cube_01").renderer.material.mainTexture = newTexture; }
public GameManagerModel() { Areas = new List<GameObject>(); GridPos = new List<Vector3>(); Area = null; IsRunning = true; PlayerTurnCompleted = false; ComputerTurnCompleted = false; VictorSign = SignType.DEFAULT; UIScript = null; WinningRowList = new List<WinningRowModel>(); }
/// <summary> /// 给图片打标记。目前根据SignType的不同可以打两种:感叹号、问号 /// </summary> static public void DrawSign(Image image, SignType type) { Image signImg = null; Debug.Assert(image != null); ///获取打标记的标记图片 switch (type) { case SignType.ExcalmatoryPoint: { if (_imgSignExcalmatory == null) { string strSignImg = System.IO.Path.Combine(PathService.SoftwarePath, @"Image\Expand\ExcalmatoryPoint.png"); _imgSignExcalmatory = Image.FromFile(strSignImg); // _imgSignExcalmatory = ResourceService.GetResourceImage("sd.img.ExcalmatoryPoint"); } signImg = _imgSignExcalmatory; break; } case SignType.QuestionPoint: { if (_imgSignQuestion == null) { string strSignImg = System.IO.Path.Combine(PathService.SoftwarePath, @"Image\Expand\QuestionPoint.png"); _imgSignQuestion = Image.FromFile(strSignImg); //_imgSignQuestion = ResourceService.GetResourceImage("sd.img.QuestionPoint"); } signImg = _imgSignQuestion; break; } default: Debug.Assert(false); break; } ///将标记图片Draw上去 Graphics g = Graphics.FromImage(image); g.DrawImage(signImg, image.Width - signImg.Width, image.Height - signImg.Height, signImg.Width, signImg.Height); g.Flush(); g.Dispose(); }
public void Write(int KDBTimeoutAsSeconds, SignType KDBOSignType, KDBOSaverType KDBOSaverType, KDBArchiveSaverType KDBArchiveSaverType, bool SaveKDBO, List <string> SerialNumbers, List <string> KdbNoList, List <string> VersionList, bool KdbArchivation, string DefaultVersion) { var client = new MongoClient("mongodb://localhost:27017"); var database = client.GetDatabase("kdbconfiguration"); var collection = database.GetCollection <BsonDocument>("kdbcollection"); var array = new BsonArray(); foreach (var item in SerialNumbers) { array.Add(item); } var array2 = new BsonArray(); foreach (var item2 in KdbNoList) { array2.Add(item2); } var array3 = new BsonArray(); foreach (var item3 in VersionList) { array3.Add(item3); } var document = new BsonDocument { { "KDBTimeoutAsSeconds", KDBTimeoutAsSeconds }, { "KDBOSignType", KDBOSignType }, { "KDBOSaverType", KDBOSaverType }, { "KDBArchiveSaverType", KDBArchiveSaverType }, { "SaveKDBO", SaveKDBO }, { "SerialNumbers", array }, { "KdbNoList", array2 }, { "VersionList", array3 }, { "KdbArchivation", KdbArchivation }, { "DefaultVersion", DefaultVersion } }; collection.InsertOneAsync(document); Console.Read(); }
public static Sign Create(float volume, Vector3 position, SignType type) { Vector3 pos = new Vector3(position.x, position.y + 10, position.z); GameObject newObject; switch (type) { case SignType.Hatarake: newObject = Instantiate(hatarake) as GameObject; break; case SignType.Coffee: newObject = Instantiate(coffee) as GameObject; break; case SignType.Death: newObject = Instantiate(death) as GameObject; break; case SignType.Facebook: newObject = Instantiate(facebook) as GameObject; break; case SignType.GoingToGlande: newObject = Instantiate(glande) as GameObject; break; case SignType.Work: newObject = Instantiate(work) as GameObject; break; default: newObject = Instantiate(hatarake) as GameObject; break; } Sign yourObject = newObject.GetComponent <Sign>(); yourObject.alpha = 255; yourObject.volume = volume; newObject.transform.position = pos; yourObject.type = type; //do additional initialization steps here return(yourObject); }
public void CastSign(SignType type) { SignInfo info = GetSignInfo(type); Sign castingSign = (Sign)(info.reference); if (type == SignType.Triangle) { StartCoroutine(((TriangleSign)castingSign).Cast(GetComponent <PlayerTrain>())); } else if (type == SignType.Rectangle) { StartCoroutine(((RectangleSign)castingSign).Cast(GetComponent <PlayerTrain>())); } else if (type == SignType.Barrier) { StartCoroutine(((BarrierSign)castingSign).Cast(GetComponent <PlayerTrain>())); } source.clip = castingSign.sound; source.Play(); if (ghostMode) { return; } info.cooldown = castingSign.cooldown; for (int wagonIndex = 0; wagonIndex < transform.childCount; wagonIndex++) { if (GetComponent <PlayerTrain>().GetWagon(wagonIndex) == null) { continue; } if (GetComponent <PlayerTrain>().GetWagon(wagonIndex).signObject != null) { if (GetComponent <PlayerTrain> ().GetWagon(wagonIndex).signType == type) { GetComponent <PlayerTrain> ().GetWagon(wagonIndex).signObject.GetComponent <Animator> ().Play("cooldown", 0); GetComponent <PlayerTrain> ().GetWagon(wagonIndex).signObject.GetComponent <Animator> ().speed = 1 / info.cooldown; } } } }
// cheking player win or not public bool CheckForWin(SignType sign) { ArrayList filledCells = FindCells(CellsType.filled); ArrayList neededArray = new ArrayList(); foreach (GameObject cell in filledCells) { if (sign == SignType.X_sign && cell.GetComponent <Cell>().filledWithX) { neededArray.Add(cell); } else if (sign == SignType.O_sign && !cell.GetComponent <Cell>().filledWithX) { neededArray.Add(cell); } } if (neededArray.Count < 3) { return(false); } foreach (GameObject xCell1 in neededArray) { foreach (GameObject xCell2 in neededArray) { if (xCell1 == xCell2) { continue; } foreach (GameObject xCell3 in neededArray) { if (VerticalCheck(xCell1, xCell2, xCell3) || HorizontalCheck(xCell1, xCell2, xCell3) || DiagonalCheck(xCell1, xCell2, xCell3)) { return(true); } } } } return(false); }
public override void Populate(Point location, Size size, SignType signType, Size signSize, int zoom) { if (SignSize != signSize) { Size nsize = GetOffsetSizeBySign(signSize); double wrate = 1d * signSize.Width / SignSize.Width; double hrate = 1d * signSize.Height / SignSize.Height; double rate = wrate <= hrate ? wrate : hrate; _startSignPoint.X = (int)Math.Round(_startSignPoint.X * rate); _startSignPoint.Y = (int)Math.Round(_startSignPoint.Y * rate); _endSignPoint.X = (int)Math.Round(_endSignPoint.X * rate); _endSignPoint.Y = (int)Math.Round(_endSignPoint.Y * rate); _startSignPoint = _startSignPoint + nsize; _endSignPoint = _endSignPoint + nsize; } base.Populate(location, size, signType, signSize, zoom); }
public UIModel ShowCanvas(UIModel model, SignType type) { model.Canvas.gameObject.SetActive(true); switch (type) { case SignType.PLAYER_SIGN: model.Title.text = "Player has won!"; break; case SignType.COMPUTER_SIGN: model.Title.text = "Computer has won!"; break; case SignType.DEFAULT: model.Title.text = "No more moves, it's a draw!"; break; } return(model); }
public GameManagerModel CheckSignType(GameManagerModel model, SignType type) { foreach (WinningRowModel row in model.WinningRowList) { List <GameObject> list = model.Areas.Where(x => x.GetComponent <AreaScript>().Model.Type == type && ( x.transform.position == row.FirstPos || x.transform.position == row.SecondPos || x.transform.position == row.ThirdPos ) ).ToList(); if (list.Count >= 3) { return(AssignSignTypeAsWinner(model, type)); } } return(model); }
/// <summary> /// Return the value sign /// -1, 0 or +1 in function of the sign type /// </summary> public static int Sign(double value, SignType type) { double Epsilon = 0.0;//1e-8; if (value < -Epsilon) { return(-1); } if (value > Epsilon) { return(+1); } if (type == SignType.ZeroIsNegative) { return(-1); } if (type == SignType.ZeroIsPositive) { return(+1); } return(0); }
public void CastSign(SignType type) { SignInfo info = GetSignInfo (type); Sign castingSign = (Sign)(info.reference); if (type == SignType.Triangle) { StartCoroutine (((TriangleSign)castingSign).Cast(GetComponent<PlayerTrain>())); } else if (type == SignType.Rectangle) { StartCoroutine (((RectangleSign)castingSign).Cast(GetComponent<PlayerTrain>())); } else if (type == SignType.Barrier) { StartCoroutine (((BarrierSign)castingSign).Cast(GetComponent<PlayerTrain>())); } source.clip = castingSign.sound; source.Play(); if (ghostMode) return; info.cooldown = castingSign.cooldown; for(int wagonIndex = 0; wagonIndex < transform.childCount; wagonIndex++) { if (GetComponent<PlayerTrain>().GetWagon(wagonIndex) == null) continue; if (GetComponent<PlayerTrain>().GetWagon(wagonIndex).signObject != null) { if (GetComponent<PlayerTrain> ().GetWagon (wagonIndex).signType == type) { GetComponent<PlayerTrain> ().GetWagon (wagonIndex).signObject.GetComponent<Animator> ().Play ("cooldown", 0); GetComponent<PlayerTrain> ().GetWagon (wagonIndex).signObject.GetComponent<Animator> ().speed = 1 / info.cooldown; } } } }
public static void SetOutChannel2(Graphics graphics, Image image, SignType outChannelType, RectangleF destBounds, RectangleF srcBounds) { ImageAttributes imageAttributes = new ImageAttributes(); ColorMatrix colorMatrix = matrixes[(int)outChannelType]; imageAttributes.ClearColorMatrix(ColorAdjustType.Bitmap); if (colorMatrix != null) { imageAttributes.SetColorMatrix( colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); } Rectangle rect = Rectangle.Round(srcBounds); graphics.DrawImage(image, Rectangle.Round(destBounds), rect.X, rect.Y, rect.Width, rect.Height, GraphicsUnit.Pixel, imageAttributes); }
/// <summary> /// 加签 /// </summary> /// <returns></returns> public static string RasSign(string content, string privateKey, SignType signType) { var singerType = ""; if (signType == SignType.Rsa2) { singerType = "SHA256WithRSA"; } if (signType == SignType.Rsa) { singerType = "SHA1withRSA"; } var signer = SignerUtilities.GetSigner(singerType); var privateKeyParam = (RsaPrivateCrtKeyParameters)PrivateKeyFactory.CreateKey(Convert.FromBase64String(privateKey)); signer.Init(true, privateKeyParam); var plainBytes = Encoding.UTF8.GetBytes(content); signer.BlockUpdate(plainBytes, 0, plainBytes.Length); var signBytes = signer.GenerateSignature(); return(Convert.ToBase64String(signBytes)); }
void OnSignClicked(object sender, EventArgs e) { Button bt = (Button)sender; if (sign) { return; } if (leftStr != "") { inputStr = (GetResult(leftStr, inputStr)).ToString(); lbOut.Text = inputStr; leftStr = ""; } switch (bt.Text) { case "+": sType = SignType.PLUS; break; case "-": sType = SignType.MINUS; break; case "*": sType = SignType.PROD; break; case "/": sType = SignType.DIV; break; } sign = true; }
public static void SetOutChannel(Graphics graphics, Image image, SignType outChannelType, RectangleF destBounds, RectangleF srcBounds) { int width = image.Width; int height = image.Height; Bitmap bitmap = new Bitmap(image); BitmapData bmData = bitmap.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb); int stride = bmData.Stride; unsafe { byte *p = (byte *)bmData.Scan0.ToPointer(); int nOffset = stride - width * 3; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { var color = ConvertColor(Color.FromArgb(p[2], p[1], p[0]), outChannelType); p[2] = color.R; p[1] = color.G; p[0] = color.B; p += 3; } p += nOffset; } } bitmap.UnlockBits(bmData); Rectangle rect = Rectangle.Round(srcBounds); graphics.DrawImage(bitmap, Rectangle.Round(destBounds), rect.X, rect.Y, rect.Width, rect.Height, GraphicsUnit.Pixel); bitmap.Dispose(); }
public static String GetSignTypeOperate(SignType type) { switch (type) { case SignType.GE: return(">="); case SignType.GT: return(">"); case SignType.EQ: return("="); case SignType.LT: return("<"); case SignType.LE: return("<="); case SignType.NE: return("!="); } return("="); }
//Called when round started public void PrepareRound() { //setup player symbol with description in tech. task if (roundResultType == RoundResultType.playerWin) { m_PlayerSign = SignType.X; } else if (roundResultType == RoundResultType.enemyWin) { m_PlayerSign = SignType.O; } else if (roundResultType == RoundResultType.deadHeat) { if (prevRoundResultType == RoundResultType.playerWin) { m_PlayerSign = SignType.O; } else if (prevRoundResultType == RoundResultType.enemyWin) { m_PlayerSign = SignType.X; } else { m_PlayerSign = SignType.X; } } //clear cells and views Debug.LogFormat("select player sign: {0}", m_PlayerSign); for (int i = 0; i < kCellCount; i++) { m_Cells[i].SetState(CellState.empty); application.SendEvent(this, new CellItemChangedEventData(m_Cells[i])); } }
public SubtextSign(SignType type, SignFacing facing, string subtext) : base(type, facing) { this.m_Subtext = subtext; }
public Sign(SignType type, SignFacing facing) : base((0xB95 + (2 * (int)type)) + (int)facing) { }
public LocalizedSign(SignType type, SignFacing facing, int labelNumber) : base(0xB95 + 2 * (int)type + (int)facing) { m_LabelNumber = labelNumber; }
public SubtextSign(SignType type, SignFacing facing, string subtext) : base(type, facing) =>
public MailAppConfig(string appId, string appKey, SignType signType = SignType.normal) { this._appId = appId; this._appKey = appKey; this._signType = signType; }
public LocalizedSign( SignType type, SignFacing facing, int labelNumber ) : base( ( 0xB95 + ( 2 * (int) type ) ) + (int) facing ) { m_LabelNumber = labelNumber; }
public bool CanCast(SignType type) { if (type == SignType.None) return false; return GetSignInfo(type).cooldown <= 0; }
public DirectedNodePropertyType() { this.orientationField = SignType.Item1; }
public Sign( SignType type, SignFacing facing ) : base(( 0xB95 + (2 * (int)type) ) + (int)facing) { }
public DisposablePacket(IConnection connection, SignType signType, SignAddress signAddress) { this.connection = connection; wrappedPacket = new Packet(signType, signAddress); }
public OrientableSurfaceType() { this.orientationField = SignType.Item1; }
public OrientableCurveType() { this.orientationField = SignType.Item1; }
public DirectedFacePropertyType() { this.orientationField = SignType.Item1; this.ownsField = false; }
public DirectedTopoSolidPropertyType() { this.orientationField = SignType.Item1; }