//* -----------------------------------------------------------------------* /// <summary>コンストラクタ。</summary> /// /// <param name="hWnd">ウィンドウハンドル</param> /// <param name="buttons">十字キーを除くボタンの数。</param> /// <param name="keyLoopStart">連続入力となるまでのフレーム時間間隔。</param> /// <param name="keyLoopInterval">押しっぱなしで連続入力となるフレーム時間間隔。</param> /// <param name="connected">接続されているXBOX360コントローラ一覧</param> public CInput(IntPtr hWnd, byte buttons, ushort keyLoopStart, ushort keyLoopInterval, PlayerIndex[] connected) { CLogger.add("入力処理・XBOX360コントローラの初期化をしています..."); int nButtons = buttons; int nFullButtons = nButtons + 4; CONNECTED = CMisc.getUnique <PlayerIndex>(connected); if (!isUseXBOX360GamePad) { CLogger.add("XBOX360コントローラを使用しません。"); } #if WINDOWS try { legacyManager = new CLegacyInputManager(hWnd); } catch (FileNotFoundException e) { CLogger.add( "Managed DirectXの初期化に失敗しました。\r\n" + "最新版のDirectX(update June 2008)がインストールされているか再確認してください。"); CLogger.add(e.ToString()); } assignLegacy = new int[nButtons]; if (legacy == null) { CLogger.add("レガシ ゲームパッドを使用しません。"); } #endif assignXBOX360 = new Buttons[nButtons]; assignKeyboard = new Keys[nFullButtons]; BUTTON_STATE = new SButtonState[nFullButtons]; for (int i = 0; i < nFullButtons; i++) { BUTTON_STATE[i] = new SButtonState(keyLoopStart, keyLoopInterval); } MICROTHREAD_MANAGER.add(threadStateReflesh()); CLogger.add("入力処理・XBOX360コントローラの初期化完了。"); }
//* -----------------------------------------------------------------------* /// <summary>使用されているリソースを解放します。</summary> /// /// <param name="disposing"> /// マネージ リソースに加えて、アンマネージ リソースも同時に解放するかどうか。 /// </param> protected override void Dispose(bool disposing) { scene.Dispose(); CMisc.safeDispose(ref sprite); instance = null; base.Dispose(disposing); }
//* ────________________________________* //* methods ───────────────────────────────-* //* -----------------------------------------------------------------------* /// <summary>1フレーム分の描画処理を実行します。</summary> /// /// <param name="entity">この状態を適用されているオブジェクト。</param> /// <param name="privateMembers"> /// オブジェクトと状態クラスのみがアクセス可能なフィールド。 /// </param> /// <param name="gameTime">前フレームが開始してからの経過時間。</param> public override void draw(CFont entity, object privateMembers, GameTime gameTime) { if (entity.sprite != null && entity.font != null) { Vector2 pos = entity.pos; pos.X -= getOriginX(entity); entity.sprite.add(entity.font, entity.text, CMisc.Cursor2VGA(pos), new Color( (byte)entity.colorRed, (byte)entity.colorGreen, (byte)entity.colorBlue, (byte)entity.colorAlpha), 0.0f, Vector2.Zero, entity.scale, SpriteEffects.None, entity.layer); } base.draw(entity, privateMembers, gameTime); }
public void Load() { loading = true; this.www = null; if (CMisc.isLegalNumber(name) && Global.publishConfig.isDebugOpen) { //CGameHintUI.Show(ErrorCodes.GetTextFormat(ErrorCodes.INVALID_LOAD_PATH, name)); return; } if (!string.IsNullOrEmpty(name) && name != "empty") { this.www = new WWW(CDirectory.MakeFullWWWPath(name)); } }
public T CreateInstance <T>(string filename, IRenderObject parent, bool unload, params object[] args) where T : IRenderObject { IRenderResource resource; filename = filename.ToLower(); if (CMisc.isLegalNumber(filename)) { LOG.LogError(Localization.Format("INVALID_LOAD_PATH", filename)); } if (parent != null && parent.GetOwner() != null) { if (parent.GetOwner().unload_asset) { unload = parent.GetOwner().unload_asset; } } if (idle.TryGetValue(filename, out resource)) { idle.Remove(filename); if (resource.complete) { complete.Add(filename, resource); } else { loading.Add(filename, resource); } //LOG.Debug( "***** get resource {0} from idle, linger {1}s", filename, Time.realtimeSinceStartup - resource.idle_time ); } else if (!loading.TryGetValue(filename, out resource)) { if (!complete.TryGetValue(filename, out resource)) { resource = new IRenderResource(filename, this); resource.unload_asset = unload; loading.Add(resource.name, resource); Cookie cookie = GetCookie(filename); ++cookie.create; } } if (resource == null) { return(null); } return(resource.CreateInstance <T>(parent, args)); }
static void Main(string[] args) { TestCore t = new TestCore(); byte[] ab = null; if (ab.IsNullOrEmpty()) { Console.WriteLine("NULL"); } string s; Console.WriteLine($"Option value: {CMisc.SearchInArgs(args, "?", out int index, 1)}; Index: {index}"); Console.WriteLine($"Option value: {CMisc.SearchInArgs(args, "?", out index, 2)}; Index: {index}"); Console.WriteLine($"Option value: {CMisc.SearchInArgs(args, "?", out index, 3)}; Index: {index}"); Console.WriteLine($"Option value: {CMisc.SearchInArgs(args, "?", out index, 4)}; Index: {index}"); t.Start(args); }
/// <summary> /// Get the content of a TLV value part /// </summary> /// <param name="buffer">Buffer to extract the TLV from. /// This buffer must contain ONLY TLV fields as it will rely on the available siez to stop searching TLVs. /// If the buffer contains something else than TLV fields, the function won't notice it.</param> /// <param name="start">Start position inside the buffer to retrieve the TLV</param> /// <param name="offset">Offset after the TLV</param> public static CTLV ExtractTLV(byte[] buffer, int start, out int offset) { CTLV tlv = null; offset = start; if (buffer.Length - offset > CTLV.TLV_SIZE_T + CTLV.TLV_SIZE_L + 1) { byte[] rawdata; int mystart = start; CEncoderAN encoderAN = new CEncoderAN(); // enough room for T+L+V (1 byte at least) //get T string T = (encoderAN.Decode(buffer, offset, CTLV.TLV_SIZE_T, CTLV.TLV_SIZE_T, out offset, out rawdata)).ToString(); // get L short L = (short)CMisc.StrToLong(encoderAN.ToString(encoderAN.Decode(buffer, offset, CTLV.TLV_SIZE_L, CTLV.TLV_SIZE_L, out offset, out rawdata))); if (0 != tlv.L) { if (buffer.Length - offset >= L) { byte[] V = new byte[L]; // get V Buffer.BlockCopy(buffer, offset, V, 0, L); offset += tlv.L; tlv = new CTLV(T, L, FieldType.NONE); tlv.SetV(V); return(tlv); } else { throw new CInvalidDataSizeException("TAG " + T, L, buffer.Length - offset); } } else { throw new CInvalidValueException("TAG " + T, L.ToString()); } } else { throw new CInvalidDataSizeException("TLV", CTLV.TLV_SIZE_T + CTLV.TLV_SIZE_L + 1, buffer.Length - offset); } }
public void Create() { this.complete = true; if (this.www != null) { try { if (this.www.bytesDownloaded > 0 && string.IsNullOrEmpty(www.error)) { if (this.name.EndsWith(".txt") && !string.IsNullOrEmpty(this.www.text)) { this.text = new StringBuilder(this.www.text); } // this.movie = this.www.movie; this.asset_bundle = this.www.assetBundle; } } catch (Exception e) { LOG.Debug(name); LOG.Debug(e.ToString()); } this.www.Dispose(); this.www = null; } if (CMisc.isLegalNumber(name)) { return; } OnCreate(this.asset_bundle); for (int i = 0; i < insts.Count; ++i) { insts[i].Create(); } if (this.unload_asset && this.asset_bundle != null) { this.asset_bundle.Unload(false); //LOG.Debug( "=> unload asset {0} after create", name ); } }
public NexoPartner(TcpClient tcp, MessageHeaderType mh) { SaleID = new NexoSaleID(CMisc.AsString(mh.SaleID)); POIID = new NexoPOIID(CMisc.AsString(mh.POIID)); EndPoint = new NexoEndPoint(tcp); _sessions = new NexoListOfSessions("SESSIONS"); _messages = new NexoDictionaryOfMessages(); #if NET35 Sessions = _sessions; Messages = _messages; #else Sessions = new ReadOnlyCollection <NexoSession>(_sessions); Messages = new ReadOnlyDictionary <string, NexoMessage>(_messages); #endif Timestamp = DateTime.Now; Key = GetKey(this); Description = GetDescription(); }
private static MessageCategoryEnumeration MessageHeaderToCategory(MessageHeaderType mh) { return((MessageCategoryEnumeration)CMisc.StringToEnumValue(typeof(MessageCategoryEnumeration), mh.MessageCategory)); }
private static MessageClassEnumeration MessageHeaderToClass(MessageHeaderType mh) { return((MessageClassEnumeration)CMisc.StringToEnumValue(typeof(MessageClassEnumeration), mh.MessageClass)); }
private static MessageTypeEnumeration MessageHeaderToType(MessageHeaderType mh) { return((MessageTypeEnumeration)CMisc.StringToEnumValue(typeof(MessageTypeEnumeration), mh.MessageType)); }
private void SetButtons() { pbReadCheck.Enabled = pbWriteCheck.Enabled = Elc.Opened; pbSendIPDU.Enabled = (0 != CMisc.StrToLong(F4.Text)) && (0 == F43_POS1.Text.Length || F43_POS1.MaskCompleted) && (0 == F43_POS6.Text.Length || F43_POS6.MaskCompleted); }