public UnmanagedString(string str, SType type = SType.Auto) { Data = str ?? throw new ArgumentNullException(nameof(str)); Type = type; alloc(); }
/// <summary> /// Checks if an object is shared. /// </summary> /// <param name="shared">if set to <c>true</c> it's a shared object.</param> /// <param name="sObject">The object.</param> void CheckShared(bool shared, SType sObject) { if (shared) { m_reader.AddSharedObj(sObject); } }
public void Initialize(MapModel model, HashSet <SType> LimitTypeEnable, HashSet <SType> LimitTypeDisable) { if (this.ShipTypeIcons != null) { this.Release(); } else { this.ShipTypeIcons = new List <GameObject>(); } HashSet <SType> hashSet = (LimitTypeEnable == null) ? LimitTypeDisable : LimitTypeEnable; int num = 0; List <SType> list = Enumerable.ToList <SType>(hashSet); list.Sort((SType a, SType b) => a - b); using (List <SType> .Enumerator enumerator = list.GetEnumerator()) { while (enumerator.MoveNext()) { SType current = enumerator.get_Current(); UISprite component = Util.Instantiate(this.prefab_ShipTypeIcon, base.get_gameObject(), false, false).GetComponent <UISprite>(); component.set_enabled(true); component.spriteName = "ship" + (int)current; component.MakePixelPerfect(); component.get_transform().localPositionX((float)num); num += component.width + this.Space; this.ShipTypeIcons.Add(component.get_gameObject()); } } this.Message.text = ((hashSet != LimitTypeEnable) ? "は[FF0000]出撃不可[-]です。" : "のみ[66ccff]出撃可能[-]です。"); this.Message.get_transform().localPositionX((float)num); }
public static List<Vector2> GetAttackPoints(SType type, Vector2 pos){ List<Vector2> points = new List<Vector2>(); switch(type){ case SType.ROOK: for(int i = (int)pos.x + 1; i < 8; i++){ points.Add (new Vector2(i, pos.y)); } for(int i = (int)pos.y + 1; i < 8; i++){ points.Add (new Vector2(pos.x, i )); } for(int i = (int)pos.x-1; i > -1; i--){ points.Add (new Vector2(i , pos.y)); } for(int i = (int) pos.y - 1; i > -1; i--){ points.Add (new Vector2(pos.x, i)); } break; case SType.BOMB: for(int i = (int)pos.x - 2; i <= pos.x + 2; i++){ if(i >= 0 && i < 8){ for(int j = (int)pos.y; j <= pos.y + 2; j++){ if(i > pos.x - 2 && i < pos.x + 2){ } // if(j >=0 && j < } } } break; } return points; }
public async Task <IActionResult> Edit(int id, [Bind("Id,Code,DescriptionRU,DescriptionKK,DescriptionEN")] SType sType) { if (id != sType.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(sType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!STypeExists(sType.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(sType)); }
public ConstValue(ConstValue constValue) { Type = new SType(constValue.Type); _valueString = constValue._valueString; _unityObject = constValue._unityObject; _value = constValue._value; }
private void InitializeClothes(SType shipType) { switch (shipType) { case SType.BattleCruiser: mTexture_Clothes.mainTexture = mTexture2d_BattleShipClothes; break; case SType.AircraftCarrier: mTexture_Clothes.mainTexture = mTexture2d_AircraftCarrierClothes; break; case SType.LightAircraftCarrier: mTexture_Clothes.mainTexture = mTexture2d_LightAircraftCarrierClothes; break; case SType.Destroyter: mTexture_Clothes.mainTexture = mTexture2d_DestroyterClothes; break; case SType.Submarine: case SType.SubmarineTender: mTexture_Clothes.mainTexture = mTexture2d_SubmarineClothes; break; default: mTexture_Clothes.mainTexture = mTexture2d_DefaultClothes; break; } }
protected override void OnInitialize(UIFurnitureModel uiFurnitureModel) { ShipModel flagShip = uiFurnitureModel.GetDeck().GetFlagShip(); SType shipType = (SType)flagShip.ShipType; InitializeClothes(shipType); }
public UnmanagedString(string str, SType type = SType.Auto) { managed = str; Type = type; alloc(); }
/// <summary> /// Adds a shared object. /// </summary> /// <param name="obj">The object.</param> internal void AddSharedObj(SType obj) { if (m_sharedMap == null) { throw new ParserException("sharedMap not initialized"); } if (m_sharedObj == null) { throw new ParserException("sharedObj not initialized"); } if (m_sharePosition >= m_sharedMap.Length) { throw new ParserException("sharePosition out of range"); } var sharedId = m_sharedMap[m_sharePosition++] - 1; if (sharedId >= m_sharedMap.Length) { throw new ParserException("shareid out of range"); } m_sharedObj[sharedId] = obj.Clone(); }
/// <summary> /// Updates the reserved slot in the shared map table with the object. /// </summary> /// <param name="id">The id.</param> /// <param name="obj">The object.</param> internal void UpdateSlot(int id, SType obj) { if (id > 0) { m_sharedObj[id - 1] = obj; } }
public static List<Vector2> GetMovePoints(SType type, Vector2 pos){ List<Vector2> points = new List<Vector2>(); switch(type){ case SType.ROOK: for(int i = (int)pos.x + 1; i < 8; i++){ points.Add (new Vector2(i, pos.y)); } for(int i = (int)pos.y + 1; i < 8; i++){ points.Add (new Vector2(pos.x, i )); } for(int i = (int)pos.x-1; i > -1; i--){ points.Add (new Vector2(i , pos.y)); } for(int i = (int) pos.y - 1; i > -1; i--){ points.Add (new Vector2(pos.x, i)); } break; case SType.BOMB: if(pos.x < 7) points.Add (new Vector2(pos.x + 1, pos.y)); if(pos.x > 0) points.Add (new Vector2(pos.x - 1, pos.y)); if(pos.y < 7) points.Add (new Vector2(pos.x, pos.y + 1)); if(pos.y > 0) points.Add (new Vector2(pos.x, pos.y - 1)); break; } return points; }
public Section(string _text, SType stype = SType.NOT_DEFINED) { if (SectionTab == null) { SectionTab = new Boot.initSection().SectionTab; } string[] sections = Lib.ToLat(_text).ToLower().Replace(" ", "").Split(';'); if (stype == SType.NOT_DEFINED) { type = SecType(sections[0]); body = SecBody(sections[0]); refSection = SecRef(sections[0]); return; } foreach (string str in sections) { if (SecType(str) != stype) { continue; } type = stype; body = SecBody(str); return; } type = SType.NOT_DEFINED; body = string.Empty; }
internal WordData(T0Comp owner, string name, string baseBlobName, int offset) : base(owner, name) { this.baseBlobName = baseBlobName; this.offset = offset; StackEffect = new SType(0, 1); }
private void Send_Request_ControlMessage(SType sType) { byte[] msg = CreateControlMessage(sType); byte[] tranId = BitConverter.GetBytes(this.GetNextTransactionId()); Array.Reverse(tranId); Array.Copy(tranId, 0, msg, 10, 4); SendBytes(msg); }
internal WordData(T0Comp owner, string name, ConstData blob, int offset) : base(owner, name) { this.blob = blob; this.offset = offset; StackEffect = new SType(0, 1); }
public SerializeStruct(SType t, string name, SerializeStruct father) { type = t; this.name = name; this.father = father; typeName = "WRONGTYPENAME!"; __id = 0; }
/// <summary> /// Dumps the structure of the file to a file. /// </summary> /// <param name="file">The file.</param> internal static void DumpStructure(FileInfo file) { Console.WriteLine("Dumping Structure..."); s_dumpStructure = true; Parse(file); SType.DumpTypes(file.Name); s_dumpStructure = false; }
public async Task <ActionResult> DeleteConfirmed(int id) { SType sType = await db.STypes.FindAsync(id); db.STypes.Remove(sType); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public void CoroutineCall(string methodName, ICoroutine coroutine) { SType cclass = type.function as SType; if (cclass.functions.ContainsKey(methodName) || cclass.members.ContainsKey(methodName)) { coroutine.StartNewCoroutine(type.function.CoroutineCall(content, inst, methodName, null, coroutine)); } }
public SMemberInfo(SMemberInfo sMemberInfo) { _declaringType = new SType(sMemberInfo._declaringType); _name = sMemberInfo._name; _memberType = sMemberInfo._memberType; Parameters = new List <ConstValue>(); sMemberInfo.Parameters.ForEach(p => Parameters.Add(new ConstValue(p))); _info = sMemberInfo._info; }
public void MemberCall(string methodName) { SType cclass = type.function as SType; if (cclass.functions.ContainsKey(methodName) || cclass.members.ContainsKey(methodName)) { type.function.MemberCall(content, inst, methodName, null); } }
public UnmanagedString(IntPtr ptr, SType type) { if (ptr == IntPtr.Zero) { throw new ArgumentException("Pointer must be non-zero for UnmanagedString."); } Type = type; Data = alloc(ptr); }
private static void sub(SType t, params string[] str) { List <string> lst = new List <string>(); foreach (string s in str) { lst.Add(Lib.ToLat(s).ToLower().Replace(" ", "").Replace(".", "").Replace("/", "")); } SectionTab.Add(t.ToString(), lst); }
private byte[] CreateControlMessage(SType sType) { return(new byte[] { 0x00, 0x00, 0x00, 0x0A, 0xFF, 0xFF, //device 0x00, 0x00, //stream , function 0x00, //pType (byte)sType, //sType 0x00, 0x00, 0x00, 0x00 //transaction }); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Code,Description")] SType sType) { if (ModelState.IsValid) { db.Entry(sType).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(sType)); }
//holds all methods for management of type buttons and active type #region TypeManagement public void TypeUpdate(SType type) //pass in the active spell type from the button { selectedType = type; foreach (SpellTypes t in allTypes) { if (selectedType == t.stype) { activeType = t; } } }
public async Task <IActionResult> Create([Bind("Id,Code,DescriptionRU,DescriptionKK,DescriptionEN")] SType sType) { if (ModelState.IsValid) { _context.Add(sType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(sType)); }
/// <summary> /// Parses the specified file. /// </summary> /// <param name="file">The file.</param> /// <returns></returns> internal static KeyValuePair <object, object> Parse(FileInfo file) { Console.WriteLine("Parsing..."); SType.Reset(); var cachedFile = new CachedFileReader(file); var parser = new CachedFileParser(cachedFile); parser.Parse(); return(!s_dumpStructure?parser.ToObjects() : new KeyValuePair <object, object>()); }
/* * Create a new instance, with the specified word name. */ internal WordBuilder(T0Comp TC, string name) { this.TC = TC; this.name = name; cfStack = new int[16]; cfPtr = -1; code = new List <Opcode>(); toResolve = new List <string>(); locals = new Dictionary <string, int>(); jumpToLast = true; StackEffect = SType.UNKNOWN; }
public async Task <ActionResult> Create([Bind(Include = "Id,Code,Description")] SType sType) { if (ModelState.IsValid) { db.STypes.Add(sType); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(sType)); }
///<summary> ///添加一个类型 /// </summary> public bool AddSType(SType _SType) { String Sql = "insert into SType(TypeName) values(@TypeName)"; SqlParameter[] Paras = new SqlParameter[] { new SqlParameter("@TypeName", _SType.TypeName) }; if (SqlHelper.ExecuteNonQuery(Sql, Paras, CommandType.Text) > 0) { return(true); } return(false); }
public string STypeToString(SType systemType) { return sTypeTo [systemType]; }
public Structure(ExtendendList<Cart> lstCards, SType Type) { this.lstCards = lstCards; this.Type = Type; }
public SCIPHER(SType type, bool encrypt) { EVP_CIPHER *cipher = null; // Statically allocated (MT), don't free EVP_CIPHER_CTX *handle = null; try { cipher = (EVP_CIPHER*) _ciphers[type](); } catch (KeyNotFoundException) {} if (cipher == null) goto Bailout; if ((handle = _CIPHER.EVP_CIPHER_CTX_new()) == null) goto Bailout; _CIPHER.EVP_CIPHER_CTX_init(handle); if (_CIPHER.EVP_CipherInit_ex(handle, cipher, IntPtr.Zero, null, null, encrypt ? 1 : 0) == 0) goto Bailout; _CIPHER.EVP_CIPHER_CTX_set_padding(handle, 0); this._handle = handle; this._type = type; this._encrypt = encrypt; return ; Bailout: if (handle != null) _CIPHER.EVP_CIPHER_CTX_free(handle); throw new EVPException(); }