private void FastExcelWriteGenericsDemo(FileInfo outputFile) { Console.WriteLine(); Console.WriteLine("DEMO WRITE 2"); Stopwatch stopwatch = new Stopwatch(); using (FastExcel.FastExcel fastExcel = new FastExcel.FastExcel(outputFile)) { List <GenericObject> objectList = new List <GenericObject>(); for (int rowNumber = 1; rowNumber < NumberOfRecords; rowNumber++) { GenericObject genericObject = new GenericObject(); genericObject.IntegerColumn1 = 1 * DateTime.Now.Millisecond; genericObject.IntegerColumn2 = 2 * DateTime.Now.Millisecond; genericObject.IntegerColumn3 = 3 * DateTime.Now.Millisecond; genericObject.IntegerColumn4 = 4 * DateTime.Now.Millisecond; genericObject.IntegerColumn5 = 45678854; genericObject.DoubleColumn6 = 87.01d; genericObject.StringColumn7 = "Test 3" + rowNumber; genericObject.ObjectColumn8 = DateTime.Now.ToLongTimeString(); objectList.Add(genericObject); } stopwatch.Start(); Console.WriteLine("Writing using IEnumerable<MyObject>..."); fastExcel.Write(objectList, "sheet3", true); } Console.WriteLine(string.Format("Writing IEnumerable<MyObject> took {0} seconds", stopwatch.Elapsed.TotalSeconds)); }
public void DeleteObjects <T>(List <T> lstObj) where T : class, new() { List <GenericObject> lstgenericObject = new List <GenericObject>(); foreach (T sam in lstObj) { ID autoID = new ID(); Type objType = typeof(T); var objAttribute = objType.GetCustomAttributes(typeof(RightNowCustomObjectAttribute), true).FirstOrDefault() as RightNowCustomObjectAttribute; if (objAttribute == null) { throw new InvalidOperationException("The type provided is not a RightNow custom object type. Please use the RightNowObjectAttribute to associate the proper metadata with the type"); } GenericObject genericObject = new GenericObject(); RNObjectType rnObjType = new RNObjectType() { Namespace = objAttribute.PackageName, TypeName = objAttribute.ObjectName }; genericObject.ObjectType = rnObjType; List <GenericField> genericFields = new List <GenericField>(); PropertyInfo[] properties = objType.GetProperties(); foreach (PropertyInfo property in properties) { RightNowCustomObjectFieldAttribute attribute = property.GetCustomAttributes(typeof(RightNowCustomObjectFieldAttribute), true).FirstOrDefault() as RightNowCustomObjectFieldAttribute; if (attribute != null && attribute.CanUpdate) { var propValue = property.GetValue(sam, null); //if (!string.IsNullOrWhiteSpace(propValue.ToString())) && !string.IsNullOrWhiteSpace(propValue.ToString()) if (propValue != null && !string.IsNullOrWhiteSpace(propValue.ToString())) { genericFields.Add(createGenericField(attribute, propValue)); } } else { if (attribute.Name == "ID") { var propValue = property.GetValue(sam, null); autoID.id = Convert.ToInt64(propValue); } } } genericObject.GenericFields = genericFields.ToArray(); autoID.idSpecified = true; genericObject.ID = autoID; lstgenericObject.Add(genericObject); } DestroyProcessingOptions options = new DestroyProcessingOptions(); options.SuppressExternalEvents = false; options.SuppressRules = false; RNObject[] rnobj = lstgenericObject.ToArray <RNObject>(); DestroyRequest destroyRequest = new DestroyRequest(getClientInfoHeader(), rnobj, options); DestroyResponse destroyResponse = getChannel().Destroy(destroyRequest); }
private async void OnMainWindow_Loaded(object sender, RoutedEventArgs e) { CtrlRenderPanel.RenderLoop.ClearColor = Color4.CornflowerBlue; // Build scene graph await CtrlRenderPanel.Scene.ManipulateSceneAsync((manipulator) => { // Create pallet geometry resource PalletType pType = new PalletType(); pType.ContentColor = Color4.GreenColor; var resPalletGeometry = manipulator.AddResource <GeometryResource>( () => new GeometryResource(pType)); // Create pallet object GenericObject palletObject = manipulator.AddGeneric(resPalletGeometry); palletObject.Color = Color4.GreenColor; palletObject.EnableShaderGeneratedBorder(); palletObject.BuildAnimationSequence() .RotateEulerAnglesTo(new Vector3(0f, EngineMath.RAD_180DEG, EngineMath.RAD_45DEG), TimeSpan.FromSeconds(2.0)) .WaitFinished() .RotateEulerAnglesTo(new Vector3(0f, EngineMath.RAD_360DEG, EngineMath.RAD_45DEG), TimeSpan.FromSeconds(2.0)) .WaitFinished() .RotateEulerAnglesTo(new Vector3(0f, 0f, 0f), TimeSpan.FromSeconds(2.0)) .WaitFinished() .CallAction(() => palletObject.RotationEuler = Vector3.Zero) .ApplyAndRewind(); }); // Configure camera Camera3DBase camera = CtrlRenderPanel.Camera; camera.Position = new Vector3(2f, 2f, 2f); camera.Target = new Vector3(0f, 0.5f, 0f); camera.UpdateCamera(); }
public EatableObject findNewTarget(GenericObject other = null) { List <EatableObject> objects = GameManager.getCurrentLevel().getObjects(); IEnumerable <EatableObject> others = null; Graph g = GameManager.getCurrentLevel().getGraphLiveObjects(); int nO = g.findNearestNode(roomNumber, Camera.main.ScreenToWorldPoint(colony.transform.position)); if (other) { others = from o in objects let distance = g.distance(nO, g.findNearestNode(o.getRoom().getNumber(), o.gameObject.transform.position)) where o.getId() != other.getId() orderby distance select(EatableObject) o; } else { others = from o in objects let distance = g.distance(nO, g.findNearestNode(o.getRoom().getNumber(), o.gameObject.transform.position)) orderby distance select(EatableObject) o; } if (others.Count() == 0) { return(null); } else { return(others.First()); } }
/// <summary> /// Is called when an object is finished. /// </summary> public override async Task EndObject() { await base.EndObject(); if (this.obj != null) { this.objects.Add(this.obj); this.obj = null; int c = this.objects.Count; if (c >= 100) { await Database.Insert(this.objects); this.objects.Clear(); this.nrObjectsInBulk += c; if (this.nrObjectsInBulk >= 1000) { await Database.EndBulk(); await Database.StartBulk(); this.nrObjectsInBulk = 0; } } } }
public void objectDestroyed(GenericObject obj) { if (targetModels.Contains(obj.getModel()) || targetModels == null) destroyed++; if (nTargets == destroyed) setStatus(Status.Completed); }
public void CreateBoneList(GenericObject ob, FMDL mdl) { string[] nodeArrStrings = new string[mdl.Skeleton.Node_Array.Length]; int CurNode = 0; foreach (int thing in mdl.Skeleton.Node_Array) { nodeArrStrings[CurNode++] = mdl.Skeleton.bones[thing].Text; } foreach (Vertex v in ob.vertices) { foreach (string bn in v.boneNames) { foreach (var defBn in nodeArrStrings.Select((Value, Index) => new { Value, Index })) { if (bn == defBn.Value) { v.boneIds.Add(defBn.Index); } } } } }
public void OnEndDrag(PointerEventData eventData) { if (isDraggable) { if (previousSelectedObject) { if (previousSelectedColony) { if (previousSelectedColony.applyBooster(model)) { GameManager.getLevelGUI().usedBooster(model); for (int i = 0; i < GameManager.getCurrentLevel().getCollectedBoosters().Count; i++) { Booster b = GameManager.getCurrentLevel().getCollectedBoosters()[i]; if (b.getModel().Equals(model)) { GameManager.getCurrentLevel().getCollectedBoosters().RemoveAt(i); break; } } } previousSelectedObject.deselect(ObjectSelection.Model.ColonyTarget); previousSelectedObject = null; previousSelectedColony = null; } } cursor.transform.position = startPosition; } }
private void KillEverything() { bool empty = true; try { IQuery query = client.Query(); IEnumerable allObjects = query.Execute(); foreach (Object item in allObjects) { GenericObject dbObject = (GenericObject)item; if (dbObject.GetGenericClass().GetName().ToLower().Contains("player")) { IReflectField screenNameField = dbObject.GetGenericClass().GetDeclaredField("<ScreenName>k__BackingField"); Console.WriteLine("Killing: " + screenNameField.Get(dbObject).ToString()); client.Delete(dbObject); empty = false; } } client.Commit(); } catch (Exception e) { Console.WriteLine(e.Message); } if (empty) { Console.WriteLine("The list of players is already empty."); } }
public void CreateIndexList(GenericObject ob, FMDL mdl = null) { BoneIndices = new List <ushort>(); List <string> boneNames = new List <string>(); foreach (Vertex v in ob.vertices) { foreach (string bn in v.boneNames) { if (!boneNames.Contains(bn)) { boneNames.Add(bn); } } } int index = 0; foreach (STBone bone in mdl.Skeleton.bones) { foreach (string bnam in boneNames) { if (bone.Text == bnam) { BoneIndices.Add((ushort)index); } } index++; } }
/// <summary> /// Builds the demo scene. /// </summary> /// <param name="manipulator">Current scene manipulator object.</param> /// <param name="sideLength">The side length of the pallet cube.</param> /// <param name="camera">The camera to be manipulated too.</param> private static void BuildPalletCubes(SceneManipulator manipulator, NamedOrGenericKey[] resPalletGeometrys, int sideLength) { // Build the scene Vector3 startPosition = new Vector3(-sideLength * SPACE_X / 2f, 0f, -sideLength * SPACE_Z / 2f); Random randomizer = new Random(Environment.TickCount); for (int loopX = 0; loopX < sideLength; loopX++) { for (int loopY = 0; loopY < sideLength; loopY++) { for (int loopZ = 0; loopZ < sideLength; loopZ++) { GenericObject palletObject = new GenericObject( resPalletGeometrys[randomizer.Next(0, resPalletGeometrys.Length)], new Vector3(loopX * SPACE_X, loopY * SPACE_Y, loopZ * SPACE_Z) + startPosition); palletObject.Color = POSSIBLE_COLORS[randomizer.Next(0, POSSIBLE_COLORS.Length)]; palletObject.EnableShaderGeneratedBorder(); manipulator.Add(palletObject); // Define animation palletObject.BuildAnimationSequence() .Delay(randomizer.Next(100, 1000)) .Apply(); palletObject.BuildAnimationSequence() .Scale3DTo(0.5f, TimeSpan.FromSeconds(2.0)) .WaitFinished() .Scale3DTo(1f, TimeSpan.FromSeconds(2.0)) .ApplyAndRewind(); } } } }
public List <Player> GetAllPlayers() { List <Player> players = new List <Player>(); try { IQuery query = client.Query(); IEnumerable allObjects = query.Execute(); foreach (Object item in allObjects) { GenericObject dbObject = (GenericObject)item; if (dbObject.GetGenericClass().GetName().ToLower().Contains("player")) { IReflectField screenNameField = dbObject.GetGenericClass().GetDeclaredField("<ScreenName>k__BackingField"); players.Add(new Player(screenNameField.Get(dbObject).ToString())); } } } catch (Exception e) { Console.WriteLine(e.Message); } return(players); }
/// <summary> /// Gets a string representing a value. /// </summary> /// <param name="Value">Value</param> /// <returns>Expression string.</returns> public string GetString(object Value) { GenericObject Obj = (GenericObject)Value; StringBuilder sb = new StringBuilder(); bool First = true; sb.Append('{'); if (!string.IsNullOrEmpty(Obj.CollectionName) && !Obj.TryGetFieldValue("CollectionName", out object _)) { this.Output("CollectionName", Obj.CollectionName, ref First, sb); } if (!string.IsNullOrEmpty(Obj.TypeName) && !Obj.TryGetFieldValue("TypeName", out object _)) { this.Output("TypeName", Obj.TypeName, ref First, sb); } if (Obj.ObjectId != Guid.Empty && !Obj.TryGetFieldValue("ObjectId", out object _)) { this.Output("ObjectId", Obj.ObjectId.ToString(), ref First, sb); } foreach (KeyValuePair <string, object> P in Obj.Properties) { this.Output(P.Key, P.Value, ref First, sb); } sb.Append('}'); return(sb.ToString()); }
public void DeleteObject <T>(long uniqueId) where T : class, new() { Type objType = typeof(T); var objAttribute = objType.GetCustomAttributes(typeof(RightNowCustomObjectAttribute), true).FirstOrDefault() as RightNowCustomObjectAttribute; if (objAttribute == null) { throw new InvalidOperationException("The type provided is not a RightNow custom object type. Please use the RightNowObjectAttribute to associate the proper metadata with the type"); } GenericObject genericObject = new GenericObject(); RNObjectType rnObjType = new RNObjectType() { Namespace = objAttribute.PackageName, TypeName = objAttribute.ObjectName }; genericObject.ObjectType = rnObjType; List <GenericField> genericFields = new List <GenericField>(); genericObject.GenericFields = genericFields.ToArray(); ID autoID = new ID(); autoID.id = uniqueId; autoID.idSpecified = true; genericObject.ID = autoID; DestroyProcessingOptions options = new DestroyProcessingOptions(); options.SuppressExternalEvents = false; options.SuppressRules = false; DestroyRequest destroyRequest = new DestroyRequest(getClientInfoHeader(), new RNObject[] { genericObject }, options); DestroyResponse destroyResponse = getChannel().Destroy(destroyRequest); }
/// <summary> /// Update PartsOrderInstruction object with number of vin completed currently /// </summary> /// <param name="numOfVIN"></param> /// <param name="partOdrInstrID"></param> public void UpdatePartsOrderInstruction(int numOfVIN, int partOdrInstrID) { try { int completedQuantity = GetCompletedQty(partOdrInstrID); GenericObject genObject = new GenericObject(); genObject.ObjectType = new RNObjectType { Namespace = "Other", TypeName = "PartOrderInstruction" }; genObject.ID = new ID { id = partOdrInstrID, idSpecified = true }; List <GenericField> customFields = new List <GenericField>(); customFields.Add(createGenericField("Completed_Quantity", createIntegerDataValue(numOfVIN + completedQuantity), DataTypeEnum.INTEGER)); genObject.GenericFields = customFields.ToArray(); ClientInfoHeader hdr = new ClientInfoHeader() { AppID = "Update PartsOrderInstruction" }; _rightNowClient.Update(hdr, new RNObject[] { genObject }, new UpdateProcessingOptions { SuppressExternalEvents = false, SuppressRules = false }); } catch (Exception ex) { ReportCommandAddIn.form.Hide(); MessageBox.Show("Exception in updating PartsOrderInstruction Record: " + ex.Message); } }
private static GenericObject DefineAnimation_2Anims_31Secs() { // Define animation parameters / objects GenericObject genObject = new GenericObject(NamedOrGenericKey.Empty); // Define animation sequence // Same as above, just with a wait-finished event here (dynamic wait step) genObject.BuildAnimationSequence() .Move3DTo(new Vector3(6f, 0f, 0f), new MovementSpeed(0.3f)) // 20,0 Secs .Scale3DTo(new Vector3(2f, 2f, 2f), TimeSpan.FromSeconds(2.0)) // 02,0 Secs .WaitFinished() .Move3DTo(new Vector3(9f, 0f, 0f), new MovementSpeed(0.3f)) // 10,0 Secs .RotateEulerAnglesBy(new Vector3(2f, 0f, 0f), TimeSpan.FromSeconds(12.0)) // 12,0 Secs .WaitFinished() .Apply(); genObject.BuildAnimationSequence() .Move3DTo(new Vector3(10f, 0f, 0f), new MovementSpeed(0.4f)) // 25,0 Secs .Scale3DTo(new Vector3(2f, 2f, 2f), TimeSpan.FromSeconds(30.0)) // 30,0 Secs .WaitFinished() .Move3DTo(new Vector3(11f, 0f, 0f), new MovementSpeed(0.4f)) // 2,5 Secs .RotateEulerAnglesBy(new Vector3(2f, 0f, 0f), TimeSpan.FromSeconds(1.0)) // 1,0 Secs .WaitFinished() .ApplyAsSecondary(); return(genObject); }
IEnumerator attackTarget() { bool continueAttack = true; while (true) { if (target) { List <GenericObject.Model> eatableTypes = new List <GenericObject.Model>(); eatableTypes.Add(GenericObject.Model.Soft); foreach (Booster b in boosters) { eatableTypes = eatableTypes.Concat(b.getExtraEatableMaterials()).ToList(); } if (eatableTypes.Contains(target.getModel())) { continueAttack = target.attack(termites); setAttackPossibility(true); } else { continueAttack = true; setAttackPossibility(false); } if (!continueAttack) { GenericObject oldTarget = target; target = findNewTarget(target); oldTarget.destroy(); } } yield return(new WaitForSeconds(Costants.COLONY_ATTACK_FREQUENCY)); } }
/// <summary> /// Is called when an object is started. /// </summary> /// <param name="ObjectId">ID of object.</param> /// <param name="TypeName">Type name of object.</param> public override async Task <string> StartObject(string ObjectId, string TypeName) { ObjectId = await base.StartObject(ObjectId, TypeName); this.obj = new GenericObject(this.collectionName, TypeName, Guid.Parse(ObjectId)); return(ObjectId); }
/// <summary> /// Batch Operation to create Incident_VIN records /// </summary> /// <param name="busIDs">List of Bus Ids</param> /// <param name="internalIncID">Internal Incident ID</param> /// <returns></returns> public BatchRequestItem createIncidentVIN(List <int> busIDs, int internalIncID) { try { List <RNObject> createObject = new List <RNObject>(); foreach (int busID in busIDs) { GenericObject genObj = new GenericObject { ObjectType = new RNObjectType { Namespace = "CO", TypeName = "Incident_VIN" } }; List <GenericField> gfs = new List <GenericField>(); gfs.Add(createGenericField("Bus", createNamedIDDataValue(busID), DataTypeEnum.NAMED_ID)); gfs.Add(createGenericField("Incident", createNamedIDDataValue(internalIncID), DataTypeEnum.NAMED_ID)); genObj.GenericFields = gfs.ToArray(); createObject.Add(genObj); } callBatchJob(getCreateMsg(createObject)); } catch (Exception ex) { WorkspaceAddIn.InfoLog("Exception in creating FSAR_VIN records: " + ex.Message); } return(null); }
public void Test_EventDriven_SimpleAnimation_8() { // Define animation parameters / objects GenericObject genObject = new GenericObject(NamedOrGenericKey.Empty); // Define animation sequence // Same as above, just with a wait-finished event here (dynamic wait step) genObject.BuildAnimationSequence() .Move3DTo(new Vector3(6f, 0f, 0f), new MovementSpeed(0.3f)) // 20,0 Secs .Scale3DTo(new Vector3(2f, 2f, 2f), TimeSpan.FromSeconds(2.0)) // 02,0 Secs .WaitFinished() .Move3DTo(new Vector3(9f, 0f, 0f), new MovementSpeed(0.3f)) // 10,0 Secs .RotateEulerAnglesBy(new Vector3(2f, 0f, 0f), TimeSpan.FromSeconds(12.0)) // 12,0 Secs .WaitFinished() .Apply(); genObject.BuildAnimationSequence() .Move3DTo(new Vector3(10f, 0f, 0f), new MovementSpeed(0.4f)) // 25,0 Secs .Scale3DTo(new Vector3(2f, 2f, 2f), TimeSpan.FromSeconds(30.0)) // 30,0 Secs .WaitFinished() .Move3DTo(new Vector3(11f, 0f, 0f), new MovementSpeed(0.4f)) // 2,5 Secs .RotateEulerAnglesBy(new Vector3(2f, 0f, 0f), TimeSpan.FromSeconds(1.0)) // 1,0 Secs .WaitFinished() .ApplyAsSecondary(); // Perform animation in an event-driven way EventDrivenPassInfo passInfo = genObject.AnimationHandler.CalculateEventDriven(); // Check results Assert.True(passInfo.CountSteps == 4); Assert.True(passInfo.Steps[0].UpdateTime == TimeSpan.FromSeconds(20.0)); Assert.True(passInfo.Steps[1].UpdateTime == TimeSpan.FromSeconds(10.0)); Assert.True(passInfo.Steps[2].UpdateTime == TimeSpan.FromSeconds(2.0)); Assert.True(passInfo.Steps[3].UpdateTime == TimeSpan.FromSeconds(0.5)); Assert.True(Math.Round(passInfo.TotalTime.TotalSeconds, 1) == 32.5); }
public void Test_EventDriven_SimpleAnimation_7() { // Define animation parameters / objects GenericObject genObject = new GenericObject(NamedOrGenericKey.Empty); // Define animation sequence // Same as above, just with a wait-finished event here (dynamic wait step) genObject.BuildAnimationSequence() .Move3DBy(new Vector3(5f, 0f, 0f), TimeSpan.FromMilliseconds(500.0)) .Scale3DTo(new Vector3(2f, 2f, 2f), TimeSpan.FromMilliseconds(1750.0)) .WaitFinished() .RotateEulerAnglesBy(new Vector3(2f, 0f, 0f), TimeSpan.FromMilliseconds(500.0)) .WaitFinished() .Apply(); genObject.BuildAnimationSequence() .Move3DBy(new Vector3(5f, 0f, 0f), TimeSpan.FromMilliseconds(400.0)) .Scale3DTo(new Vector3(2f, 2f, 2f), TimeSpan.FromMilliseconds(1850.0)) .WaitFinished() .RotateEulerAnglesBy(new Vector3(2f, 0f, 0f), TimeSpan.FromMilliseconds(300.0)) .WaitFinished() .ApplyAsSecondary(); // Perform animation in an event-driven way EventDrivenPassInfo passInfo = genObject.AnimationHandler.CalculateEventDriven(); // Check results Assert.True(passInfo.CountSteps == 4); Assert.True(passInfo.Steps[0].UpdateTime == TimeSpan.FromMilliseconds(1750.0)); Assert.True(passInfo.Steps[1].UpdateTime == TimeSpan.FromMilliseconds(100.0)); Assert.True(passInfo.Steps[2].UpdateTime == TimeSpan.FromMilliseconds(300.0)); Assert.True(passInfo.Steps[3].UpdateTime == TimeSpan.FromMilliseconds(100.0)); }
public void setTarget(GenericObject target) { if (this.target) { this.target.setAttacker(null); } this.target = target; roomNumber = target.getRoom().getNumber(); /*if (!this.target.getModel().Equals(GenericObject.Model.Live)) * GameManager.getCurrentLevel().alertObjectsQueue.Enqueue(this.target);*/ Colony col = this.target.getAttacker(); if (col) { addTermites(col.getTermites()); foreach (Booster b in col.getBoosters()) { applyBooster(b.getModel()); } Destroy(col.gameObject); } this.target.setAttacker(this); }
/// <summary> /// To Create Parts Order Record /// </summary> /// <param name="partsID">Parent Parts ID</param> /// <returns></returns> public int CreatePartsOrder(int partsID) { try { GenericObject partsOrderObject = new GenericObject(); partsOrderObject.ObjectType = new RNObjectType { Namespace = "CO", TypeName = "PartsOrder" }; List <GenericField> genericFields = new List <GenericField>(); genericFields.Add(createGenericField("Parts", createNamedIDDataValue(partsID), DataTypeEnum.NAMED_ID)); partsOrderObject.GenericFields = genericFields.ToArray(); ClientInfoHeader hdr = new ClientInfoHeader() { AppID = "Create Parts Order" }; RNObject[] resultObj = _rightNowClient.Create(hdr, new RNObject[] { partsOrderObject }, new CreateProcessingOptions { SuppressExternalEvents = false, SuppressRules = false }); if (resultObj != null) { return(Convert.ToInt32(resultObj[0].ID.id)); } } catch (Exception ex) { ReportCommandAddIn.form.Hide(); MessageBox.Show("Exception in creating Parts Order Record: " + ex.Message); } return(0); }
/// <summary> /// Delete Incident VIN Records /// </summary> /// <param name="incVinID"></param> /// <returns></returns> public void DeleteIncidentVIN(List <int> deleteVins) { try { List <RNObject> deleteObject = new List <RNObject>(); for (int i = 0; i < deleteVins.Count; i++) { GenericObject genObj = new GenericObject { ObjectType = new RNObjectType { Namespace = "CO", TypeName = "Incident_VIN" } }; genObj.ID = new ID { id = deleteVins[i], idSpecified = true }; deleteObject.Add(genObj); } //BatchResponseItem[] batchRes = rspc.Batch(clientInfoHeader, requestItems); callBatchJob(getDestroyMsg(deleteObject)); } catch (Exception ex) { MessageBox.Show("Exception in Deleting Incident_VIN record: " + ex.Message); } return; }
private NxCell GetFieldCellFromIndexAsync(int index) { var request = JObject.FromObject(new { qPath = "/qListObjectDef", qPages = new List <NxPage> { new NxPage() { qTop = 0, qLeft = 0, qWidth = 1, qHeight = Cardinal, } } }); return(GenericObject.GetListObjectDataAsync <JArray>(request) .ContinueWith <NxCell>((res2) => { var genObjData = res2.Result; var dataPages = genObjData.ToObject <List <NxDataPage> >(); var firstPage = dataPages.FirstOrDefault() ?? null; if (firstPage != null) { var matrix = firstPage.qMatrix.ToList(); if (index < matrix.Count) { return matrix[index].FirstOrDefault() ?? null; } } return null; }).Result); }
/// <summary> /// To Destroy Parts Order Record if EBS integration fails /// </summary> /// <returns></returns> public void DestroyPartsOrder(List <OELINEREC> lineRecords) { try { List <RNObject> rnObjs = new List <RNObject>(); //Loop over each partsIDToBeOrder that has parts ID that's order recently foreach (OELINEREC lineRecord in lineRecords) { GenericObject genObject = new GenericObject(); genObject.ObjectType = new RNObjectType { Namespace = "CO", TypeName = "PartsOrder" }; genObject.ID = new ID { id = lineRecord.ORDERED_ID, idSpecified = true }; rnObjs.Add(genObject); } callBatchJob(getDestroyMsg(rnObjs)); } catch (Exception ex) { ReportCommandAddIn.form.Hide(); MessageBox.Show("Exception in creating Parts Order Record: " + ex.Message); } return; }
public void OnEndDrag(PointerEventData eventData) { /* Color color = gameObject.transform.parent.transform.Find("NotAttackImage").GetComponent<Image>().color; * if (color.a > 0) * gameObject.transform.parent.transform.Find("NotAttackImage").GetComponent<Image>().color = new Color(1, 1, 1, 1f); * gameObject.GetComponent<Image>().color = new Color(1, 1, 1, 1f);*/ if (previousSelected) { setTarget(previousSelected); previousSelected.deselect(ObjectSelection.Model.ColonyTarget); previousSelected = null; } else { if (!isToBePlaced) { if (!target) { target = findNewTarget(); } } if (target) { colony.transform.position = Camera.main.WorldToScreenPoint(target.gameObject.transform.position); } else { GameManager.gameEnd(); } } startDrag = false; }
public void OnDrag(PointerEventData eventData) { colony.transform.position = Input.mousePosition; RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, Mathf.Infinity, Costants.RAYCAST_MASK); if (hit.collider != null) { GenericObject obj = hit.collider.gameObject.transform.parent.GetComponent <EatableObject>(); if (obj) { if (previousSelected) { previousSelected.deselect(ObjectSelection.Model.ColonyTarget); } previousSelected = obj; obj.select(ObjectSelection.Model.ColonyTarget); } else if (previousSelected) { previousSelected.deselect(ObjectSelection.Model.ColonyTarget); previousSelected = null; } } else if (previousSelected) { previousSelected.deselect(ObjectSelection.Model.ColonyTarget); previousSelected = null; } }
/** * Fonction d'initialisation remplissant une zone cultivable avec toutes sortes d'objets ou de plantes */ public void randomFill() { float spawn = 0.0f; int type = 0; MapObject temp; for (int x = 0; x < width; ++x) { for (int y = 0; y < height; ++y) { if (map[x, y].m_object == null) { spawn = Random.Range(0.0f, 100.0f); if (spawn <= 5.0f) { type = (int)Random.Range(0, 2); temp = new GenericObject(); ((GenericObject)temp).defineType((GenericObjectTypes)type); map[x, y].addObject(temp); } if (spawn > 10.0f && spawn <= 15.0f) { type = (int)Random.Range(0, (int)PlantList.plant_number); temp = new Plant((PlantList)type); map[x, y].addObject(temp); } } } } }
/// <summary> /// Called when the sample has to startup. /// </summary> /// <param name="targetRenderLoop">The target render loop.</param> public override async Task OnStartupAsync(RenderLoop targetRenderLoop) { targetRenderLoop.EnsureNotNull(nameof(targetRenderLoop)); // Build dummy scene Scene scene = targetRenderLoop.Scene; Camera3DBase camera = targetRenderLoop.Camera as Camera3DBase; await targetRenderLoop.Scene.ManipulateSceneAsync((manipulator) => { // Create floor SampleSceneBuilder.BuildStandardFloor( manipulator, Scene.DEFAULT_LAYER_NAME); TextGeometryOptions textOptions = TextGeometryOptions.Default; textOptions.FontSize = 50; textOptions.MakeVolumetricText = true; textOptions.SurfaceVertexColor = Color.Blue; textOptions.VolumetricSideSurfaceVertexColor = Color4.CornflowerBlue; GenericObject textObject = manipulator.Add3DText($"Seeing# {Environment.NewLine} Text3D Sample", textOptions); textObject.YPos = textOptions.VolumetricTextDepth; }); // Configure camera camera.Position = new Vector3(0.7f, 8.5f, -15f); camera.RelativeTarget = new Vector3(0.44f, -0.62f, 0.64f); camera.UpdateCamera(); }
public async Task DBFiles_BTree_Test_03_LoadUntyped() { Simple Obj = CreateSimple(this.MaxStringLength); Guid ObjectId = await this.file.SaveNewObject(Obj); AssertEx.NotSame(Guid.Empty, ObjectId); GenericObject GenObj = (GenericObject)await this.file.LoadObject(ObjectId); AssertEx.Same(GenObj.CollectionName, "Default"); AssertEx.Same(Obj.Boolean1, GenObj["Boolean1"]); AssertEx.Same(Obj.Boolean2, GenObj["Boolean2"]); AssertEx.Same(Obj.Byte, GenObj["Byte"]); AssertEx.Same(Obj.Short, GenObj["Short"]); AssertEx.Same(Obj.Int, GenObj["Int"]); AssertEx.Same(Obj.Long, GenObj["Long"]); AssertEx.Same(Obj.SByte, GenObj["SByte"]); AssertEx.Same(Obj.UShort, GenObj["UShort"]); AssertEx.Same(Obj.UInt, GenObj["UInt"]); AssertEx.Same(Obj.ULong, GenObj["ULong"]); AssertEx.Same(Obj.Char, GenObj["Char"]); AssertEx.Same(Obj.Decimal, GenObj["Decimal"]); AssertEx.Same(Obj.Double, GenObj["Double"]); AssertEx.Same(Obj.Single, GenObj["Single"]); AssertEx.Same(Obj.String, GenObj["String"]); AssertEx.Same(Obj.DateTime, GenObj["DateTime"]); AssertEx.Same(Obj.DateTimeOffset, GenObj["DateTimeOffset"]); AssertEx.Same(Obj.TimeSpan, GenObj["TimeSpan"]); AssertEx.Same(Obj.Guid, GenObj["Guid"]); AssertEx.Same(Obj.NormalEnum.ToString(), GenObj["NormalEnum"]); AssertEx.Same((int)Obj.FlagsEnum, GenObj["FlagsEnum"]); AssertEx.Same(Obj.ObjectId, GenObj.ObjectId); await AssertConsistent(this.file, this.provider, 1, Obj, true); }
public void removeObject(GenericObject obj) { int i = 0; for (i = 0; i < objects.Count; i++) if (objects[i].getId() == obj.getId()) break; objects.RemoveAt(i); }
public GenericObject getOtherObject(GenericObject obj) { IEnumerable<GenericObject> others = from o in objects let distance = Vector2.Distance(obj.gameObject.transform.position, o.gameObject.transform.position) where o.getId() != obj.getId() orderby distance select (GenericObject)o; if (others.Count() == 0) return null; else return others.First(); }
public ObjectPlaceholder(int nRoom, int z_index, Vector3 coord, string pathName, string name, GenericObject.Model model, float sCoeff = 0.05f, bool isOnSomething = false, bool isHanging = false, bool isHFlipped = false) { this.roomNumber = nRoom; this.z_index = z_index; this.coordinates = coord; this.pathName = pathName; this.name = name; this.model = model; this.isHanging = isHanging; this.isOnSomething = isOnSomething; this.strengthCoefficient = sCoeff; this.isHorizontallyFlipped = isHFlipped; }
public void OnDrag(PointerEventData eventData) { if (isDraggable) if (contains) { cursor.transform.position = Input.mousePosition; RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, Mathf.Infinity, Costants.RAYCAST_MASK); if (hit.collider != null) { GenericObject obj = hit.collider.gameObject.transform.parent.GetComponent<EatableObject>(); if ((obj) && (obj.getAttacker())) { if (previousSelectedObject) previousSelectedObject.deselect(ObjectSelection.Model.BoosterApplication); previousSelectedObject = obj; previousSelectedColony = obj.getAttacker(); obj.select(ObjectSelection.Model.ColonyTarget); } else if (previousSelectedObject) { previousSelectedObject.deselect(ObjectSelection.Model.BoosterApplication); previousSelectedObject = null; previousSelectedColony = null; } } else if (previousSelectedObject) { previousSelectedObject.deselect(ObjectSelection.Model.BoosterApplication); previousSelectedObject = null; previousSelectedColony = null; } } }
public EatableObject findNewTarget(GenericObject other = null) { List<EatableObject> objects = GameManager.getCurrentLevel().getObjects(); IEnumerable<EatableObject> others = null; Graph g = GameManager.getCurrentLevel().getGraphLiveObjects(); int nO = g.findNearestNode(roomNumber, Camera.main.ScreenToWorldPoint(colony.transform.position)); if (other) others = from o in objects let distance = g.distance(nO, g.findNearestNode(o.getRoom().getNumber(), o.gameObject.transform.position)) where o.getId() != other.getId() orderby distance select (EatableObject)o; else others = from o in objects let distance = g.distance(nO, g.findNearestNode(o.getRoom().getNumber(), o.gameObject.transform.position)) orderby distance select (EatableObject)o; if (others.Count() == 0) return null; else return others.First(); }
private void addObjectToRoom(GenericObject obj, int roomNumber) { rooms[roomNumber].addObject(obj); obj.setRoom(rooms[roomNumber]); }
public void addObject(GenericObject gameObject) { objects.Add(gameObject); }
// Create new contact via SOAP API - Created when an EBS Contact without association is selected public long CreateContact(String firstName, String lastName, String phone, String emailAdd, String contactPartyId, string orgId) { string logMessage; string logNote; //Create a Contact Accelerator.EBS.SharedServices.RightNowServiceReference.Contact newContact = new Accelerator.EBS.SharedServices.RightNowServiceReference.Contact(); //Build a PersonName object for the Contact and add the PersonName to the new Contact object PersonName personName = new PersonName(); if (firstName != null && firstName != "") personName.First = firstName; if (lastName != null && lastName != "") personName.Last = lastName; newContact.Name = personName; //Build an Email object and add the Email to the new Contact object if (emailAdd != null && emailAdd != "") { newContact.Emails = new Email[1]; newContact.Emails[0] = new Email(); newContact.Emails[0].Address = emailAdd; newContact.Emails[0].action = ActionEnum.add; newContact.Emails[0].actionSpecified = true; newContact.Emails[0].AddressType = new NamedID(); newContact.Emails[0].AddressType.ID = new ID(); newContact.Emails[0].AddressType.ID.id = 0; newContact.Emails[0].AddressType.ID.idSpecified = true; } //Build a Phone object and add the Phone to the new Contact object if (phone != null && phone != "") { newContact.Phones = new Phone[1]; newContact.Phones[0] = new Phone(); newContact.Phones[0].Number = phone; newContact.Phones[0].action = ActionEnum.add; newContact.Phones[0].actionSpecified = true; newContact.Phones[0].PhoneType = new NamedID(); newContact.Phones[0].PhoneType.ID = new ID(); newContact.Phones[0].PhoneType.ID.id = 0; newContact.Phones[0].PhoneType.ID.idSpecified = true; } //Set EBS Contact Party ID (custom field) to the new Contact if (contactPartyId != null && contactPartyId != "") { GenericField cfContactPartyIdField = new GenericField(); cfContactPartyIdField.name = "ebs_contact_party_id"; cfContactPartyIdField.dataType = DataTypeEnum.INTEGER; cfContactPartyIdField.dataTypeSpecified = true; cfContactPartyIdField.DataValue = new DataValue(); cfContactPartyIdField.DataValue.Items = new object[1]; cfContactPartyIdField.DataValue.ItemsElementName = new ItemsChoiceType[1]; cfContactPartyIdField.DataValue.Items[0] = Convert.ToInt32(contactPartyId); cfContactPartyIdField.DataValue.ItemsElementName[0] = ItemsChoiceType.IntegerValue; GenericField cfContactOrgIdField = new GenericField(); cfContactOrgIdField.name = "ebs_contact_org_id"; cfContactOrgIdField.dataType = DataTypeEnum.INTEGER; cfContactOrgIdField.dataTypeSpecified = true; cfContactOrgIdField.DataValue = new DataValue(); cfContactOrgIdField.DataValue.Items = new object[1]; cfContactOrgIdField.DataValue.ItemsElementName = new ItemsChoiceType[1]; cfContactOrgIdField.DataValue.Items[0] = Convert.ToInt32(orgId); cfContactOrgIdField.DataValue.ItemsElementName[0] = ItemsChoiceType.IntegerValue; GenericObject customFieldsc = new GenericObject(); customFieldsc.GenericFields = new GenericField[2]; customFieldsc.GenericFields[0] = cfContactPartyIdField; customFieldsc.GenericFields[1] = cfContactOrgIdField; customFieldsc.ObjectType = new RNObjectType(); customFieldsc.ObjectType.TypeName = "ContactCustomFieldsc"; GenericField cField = new GenericField(); cField.name = "Accelerator"; cField.dataType = DataTypeEnum.OBJECT; cField.dataTypeSpecified = true; cField.DataValue = new DataValue(); cField.DataValue.Items = new object[1]; cField.DataValue.Items[0] = customFieldsc; cField.DataValue.ItemsElementName = new ItemsChoiceType[1]; cField.DataValue.ItemsElementName[0] = ItemsChoiceType.ObjectValue; newContact.CustomFields = new GenericObject(); newContact.CustomFields.GenericFields = new GenericField[1]; newContact.CustomFields.GenericFields[0] = cField; newContact.CustomFields.ObjectType = new RNObjectType(); newContact.CustomFields.ObjectType.TypeName = "ContactCustomFields"; } //Build the RNObject[] RNObject[] newObjects = new RNObject[] { newContact }; RNObject[] results = null; try { results = _rnSrv.createObject(newObjects); } catch (Exception ex) { if (_log != null) { logMessage = "Error in creating contact via CWSS. Contact " + firstName + " " + lastName + ": " + ex.Message; logNote = ""; _log.ErrorLog(_logIncidentId, _logContactId, logMessage, logNote); } MessageBox.Show("Cannot create contact: " + firstName + " " + lastName + ". Please check log for detail. ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return 0; } logMessage = "New Contact is created successfully. Contact ID = " + results[0].ID.id; logNote = ""; _log.DebugLog(_logIncidentId, _logContactId, logMessage, logNote); return results[0].ID.id; }
public void setObj(GenericObject obj) { this.obj = obj; }
public void GetSelectedObject(GenericObject selection, out ObjectTypeEnum objectType, out NameValueMap additionalData, out ComponentOccurrence containingOccurrence, ref Object selectedObject) { InternalGetSelectedObject( selection, out objectType, out additionalData, out containingOccurrence, ref selectedObject); }
private void InternalGetSelectedObject(GenericObject selection, out ObjectTypeEnum objectType, out NameValueMap additionalData, out ComponentOccurrence containingOccurrence, ref Object selectedObject) { PartDocumentInstance.GetSelectedObject( selection, out objectType, out additionalData, out containingOccurrence, ref selectedObject); }
public void OnEndDrag(PointerEventData eventData) { if (isDraggable) { if (previousSelectedObject) if (previousSelectedColony) { if (previousSelectedColony.applyBooster(model)) { GameManager.getLevelGUI().usedBooster(model); for (int i = 0; i < GameManager.getCurrentLevel().getCollectedBoosters().Count; i++) { Booster b = GameManager.getCurrentLevel().getCollectedBoosters()[i]; if (b.getModel().Equals(model)) { GameManager.getCurrentLevel().getCollectedBoosters().RemoveAt(i); break; } } } previousSelectedObject.deselect(ObjectSelection.Model.ColonyTarget); previousSelectedObject = null; previousSelectedColony = null; } cursor.transform.position = startPosition; } }
public void setTarget(GenericObject target) { if (this.target) this.target.setAttacker(null); this.target = target; roomNumber = target.getRoom().getNumber(); /*if (!this.target.getModel().Equals(GenericObject.Model.Live)) GameManager.getCurrentLevel().alertObjectsQueue.Enqueue(this.target);*/ Colony col = this.target.getAttacker(); if (col) { addTermites(col.getTermites()); foreach (Booster b in col.getBoosters()) applyBooster(b.getModel()); Destroy(col.gameObject); } this.target.setAttacker(this); }
protected IEnumerator attackColony(int atkType) { while (true) { if (GameManager.getCurrentLevel().alertObjectsQueue.Count > 0 && !isAttacking) { isAttacking = true; switch (atkType) { case 1: Debug.Log("Spray attack"); break; case 2: Debug.Log("Gas attack"); break; case 3: Debug.Log("Bomb attack"); break; case 4: Debug.Log("Gun attack"); break; case 5: Debug.Log("frog eating"); break; case 6: Debug.Log("it's a spell"); break; default: Debug.Log("Bug in LiveObject, not an attack"); break; } StopCoroutine(movementCoroutine);//pointer to movementCoroutine goes null setMovementCoroutine(); targetObject = (GenericObject)GameManager.getCurrentLevel().alertObjectsQueue.Dequeue(); int target = GameManager.getCurrentLevel().getGraphLiveObjects().findNearestNode(targetObject.getRoom().number, targetObject.gameObject.transform.position); List<Graph.Node> path = GameManager.getCurrentLevel().getGraphLiveObjects().getPath(actualNodeNumber, target); path.RemoveAt(path.Count - 1); movementPath.Clear(); foreach (Graph.Node n in path) movementPath.Enqueue(n); StartCoroutine(movementCoroutine); } yield return new WaitForSeconds(Costants.COLONY_ATTACK_FREQUENCY); } }
/// <summary> /// Serializa um objeto no formato JSON e envia para o servidor. /// </summary> /// <param name="objeto">Instância do objeto a ser serializado.</param> public void SendObject(object objeto) { // Criá-se uma instância do objeto genérico. GenericObject genericObj = new GenericObject() { Type = objeto.GetType().Name.ToString(), Data = objeto }; // Serializa o objeto no formato JSON. string json = JsonConvert.SerializeObject(genericObj); // Envia a string gerada. SendMessage(json.ToLower()); }
IEnumerator attackTarget() { bool continueAttack = true; while (true) { if (target) { List<GenericObject.Model> eatableTypes = new List<GenericObject.Model>(); eatableTypes.Add(GenericObject.Model.Soft); foreach (Booster b in boosters) eatableTypes = eatableTypes.Concat(b.getExtraEatableMaterials()).ToList(); if (eatableTypes.Contains(target.getModel())) { continueAttack = target.attack(termites); setAttackPossibility(true); } else { continueAttack = true; setAttackPossibility(false); } if (!continueAttack) { GenericObject oldTarget = target; target = findNewTarget(target); oldTarget.destroy(); } } yield return new WaitForSeconds(Costants.COLONY_ATTACK_FREQUENCY); } }
// Update Custom Attribute via SOAP API // After create/update incident, the custom attribute may need to update. protected void UpdateIncCustomAttr(int incidentID, string key, string value) { //Create an Incident object Accelerator.Siebel.SharedServices.RightNowServiceReference.Incident updateIncident = new Accelerator.Siebel.SharedServices.RightNowServiceReference.Incident(); //Create and set the Id property ID incID = new ID(); //Set the Id on the Incident Object incID.id = incidentID; incID.idSpecified = true; updateIncident.ID = incID; if (value != null && value != "") { GenericField customField = new GenericField(); // Check update which custom attribute switch (key) { case "siebel_sr_id": customField.name = "siebel_sr_id"; customField.dataType = DataTypeEnum.STRING; customField.dataTypeSpecified = true; customField.DataValue = new DataValue(); customField.DataValue.Items = new object[1]; customField.DataValue.ItemsElementName = new ItemsChoiceType[1]; customField.DataValue.Items[0] = value; customField.DataValue.ItemsElementName[0] = ItemsChoiceType.StringValue; break; case "siebel_sr_num": customField.name = "siebel_sr_num"; customField.dataType = DataTypeEnum.STRING; customField.dataTypeSpecified = true; customField.DataValue = new DataValue(); customField.DataValue.Items = new object[1]; customField.DataValue.ItemsElementName = new ItemsChoiceType[1]; customField.DataValue.Items[0] = value; customField.DataValue.ItemsElementName[0] = ItemsChoiceType.StringValue; break; case "siebel_max_thread_id": customField.name = "siebel_max_thread_id"; customField.dataType = DataTypeEnum.INTEGER; customField.dataTypeSpecified = true; customField.DataValue = new DataValue(); customField.DataValue.Items = new object[1]; customField.DataValue.ItemsElementName = new ItemsChoiceType[1]; customField.DataValue.Items[0] = Convert.ToInt32(value); customField.DataValue.ItemsElementName[0] = ItemsChoiceType.IntegerValue; break; default: return; } GenericObject customFieldsc = new GenericObject(); customFieldsc.GenericFields = new GenericField[1]; customFieldsc.GenericFields[0] = customField; customFieldsc.ObjectType = new RNObjectType(); customFieldsc.ObjectType.TypeName = "IncidentCustomFieldsc"; GenericField cField = new GenericField(); cField.name = "Accelerator"; cField.dataType = DataTypeEnum.OBJECT; cField.dataTypeSpecified = true; cField.DataValue = new DataValue(); cField.DataValue.Items = new object[1]; cField.DataValue.Items[0] = customFieldsc; cField.DataValue.ItemsElementName = new ItemsChoiceType[1]; cField.DataValue.ItemsElementName[0] = ItemsChoiceType.ObjectValue; updateIncident.CustomFields = new GenericObject(); updateIncident.CustomFields.GenericFields = new GenericField[1]; updateIncident.CustomFields.GenericFields[0] = cField; updateIncident.CustomFields.ObjectType = new RNObjectType(); updateIncident.CustomFields.ObjectType.TypeName = "IncidentCustomFields"; } else { return; } //Create the RNObject array RNObject[] objects = new RNObject[] { updateIncident }; try { _rnSrv.updateObject(objects); } catch (Exception ex) { if (_log != null) { string logMessage = "Error in updating incident custom field via Cloud Service SOAP. Try to update incident(ID = " + incidentID + ") custom attribute " + key + " to value" + value + "; Error Message: "+ ex.Message; _log.ErrorLog(incidentId:_logIncidentId, logMessage: logMessage); } MessageBox.Show("There has been an error communicating with Cloud Service SOAP. Please check log for detail.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void objectDeselected() { selectedObject.deselect(ObjectSelection.Model.InfoDisplay); objectInformationPanel.SetActive(false); selectedObject = null; }
public void OnDrag(PointerEventData eventData) { colony.transform.position = Input.mousePosition; RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, Mathf.Infinity, Costants.RAYCAST_MASK); if (hit.collider != null) { GenericObject obj = hit.collider.gameObject.transform.parent.GetComponent<EatableObject>(); if (obj) { if (previousSelected) previousSelected.deselect(ObjectSelection.Model.ColonyTarget); previousSelected = obj; obj.select(ObjectSelection.Model.ColonyTarget); } else if (previousSelected) { previousSelected.deselect(ObjectSelection.Model.ColonyTarget); previousSelected = null; } } else if (previousSelected) { previousSelected.deselect(ObjectSelection.Model.ColonyTarget); previousSelected = null; } }
public static void objectDestroyed(GenericObject obj) { if (activeChallenge != null) if ((activeChallenge.getModel() == GenericChallenge.Model.Destruction) || (activeChallenge.getModel() == GenericChallenge.Model.TimeDestruction)) ((DestructionChallenge)activeChallenge).objectDestroyed(obj); }
private void FastExcelWriteGenericsDemo(FileInfo outputFile) { Console.WriteLine(); Console.WriteLine("DEMO WRITE 2"); Stopwatch stopwatch = new Stopwatch(); using (FastExcel.FastExcel fastExcel = new FastExcel.FastExcel(outputFile)) { List<GenericObject> objectList = new List<GenericObject>(); for (int rowNumber = 1; rowNumber < NumberOfRecords; rowNumber++) { GenericObject genericObject = new GenericObject(); genericObject.IntegerColumn1 = 1 * DateTime.Now.Millisecond; genericObject.IntegerColumn2 = 2 * DateTime.Now.Millisecond; genericObject.IntegerColumn3 = 3 * DateTime.Now.Millisecond; genericObject.IntegerColumn4 = 4 * DateTime.Now.Millisecond; genericObject.IntegerColumn5 = 45678854; genericObject.DoubleColumn6 = 87.01d; genericObject.StringColumn7 = "Test 3" + rowNumber; genericObject.ObjectColumn8 = DateTime.Now.ToLongTimeString(); objectList.Add(genericObject); } stopwatch.Start(); Console.WriteLine("Writing using IEnumerable<MyObject>..."); fastExcel.Write(objectList, "sheet3", true); } Console.WriteLine(string.Format("Writing IEnumerable<MyObject> took {0} seconds", stopwatch.Elapsed.TotalSeconds)); }
public void objectSelected(GenericObject selectedObject) { if (selectedColony) colonyDeselected(); if (this.selectedObject) this.selectedObject.deselect(ObjectSelection.Model.InfoDisplay); this.selectedObject = selectedObject; selectedObject.select(ObjectSelection.Model.InfoDisplay); objectInformationPanel.transform.Find("Title").gameObject.GetComponent<Text>().text = selectedObject.getCategory() + ": " + selectedObject.getName(); objectInformationPanel.transform.Find("Description").gameObject.GetComponent<Text>().text = selectedObject.getDescription(); if (selectedObject.getAttacker()) { objectInformationPanel.transform.Find("SelectAttackertButton").gameObject.GetComponent<Button>().interactable = true; objectInformationPanel.transform.Find("SelectAttackertButton/Text").gameObject.GetComponent<Text>().text = "ATTACKER"; } else { objectInformationPanel.transform.Find("SelectAttackertButton").gameObject.GetComponent<Button>().interactable = false; objectInformationPanel.transform.Find("SelectAttackertButton/Text").gameObject.GetComponent<Text>().text = "NO ATTACKER"; } int integrity = selectedObject.getIntegrity(); if (integrity < 0) integrity = 0; objectInformationPanel.transform.Find("Integrity").gameObject.GetComponent<Text>().text = "INTEGRITY: " + integrity + "%"; objectInformationPanel.SetActive(true); noInformationPanel.SetActive(false); }
public void OnEndDrag(PointerEventData eventData) { /* Color color = gameObject.transform.parent.transform.Find("NotAttackImage").GetComponent<Image>().color; if (color.a > 0) gameObject.transform.parent.transform.Find("NotAttackImage").GetComponent<Image>().color = new Color(1, 1, 1, 1f); gameObject.GetComponent<Image>().color = new Color(1, 1, 1, 1f);*/ if (previousSelected) { setTarget(previousSelected); previousSelected.deselect(ObjectSelection.Model.ColonyTarget); previousSelected = null; } else { if (!isToBePlaced) if (!target) target = findNewTarget(); if (target) colony.transform.position = Camera.main.WorldToScreenPoint(target.gameObject.transform.position); else GameManager.gameEnd(); } startDrag = false; }