internal SnapshotData(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, string managedBy, SnapshotSku sku, ExtendedLocation extendedLocation, DateTimeOffset?timeCreated, OperatingSystemTypes?osType, HyperVGeneration?hyperVGeneration, DiskPurchasePlan purchasePlan, SupportedCapabilities supportedCapabilities, CreationData creationData, int?diskSizeGB, long?diskSizeBytes, DiskState?diskState, string uniqueId, EncryptionSettingsCollection encryptionSettingsCollection, string provisioningState, bool?incremental, Encryption encryption, NetworkAccessPolicy?networkAccessPolicy, string diskAccessId, DiskSecurityProfile securityProfile, bool?supportsHibernation, PublicNetworkAccess?publicNetworkAccess, float?completionPercent) : base(id, name, type, systemData, tags, location) { ManagedBy = managedBy; Sku = sku; ExtendedLocation = extendedLocation; TimeCreated = timeCreated; OSType = osType; HyperVGeneration = hyperVGeneration; PurchasePlan = purchasePlan; SupportedCapabilities = supportedCapabilities; CreationData = creationData; DiskSizeGB = diskSizeGB; DiskSizeBytes = diskSizeBytes; DiskState = diskState; UniqueId = uniqueId; EncryptionSettingsCollection = encryptionSettingsCollection; ProvisioningState = provisioningState; Incremental = incremental; Encryption = encryption; NetworkAccessPolicy = networkAccessPolicy; DiskAccessId = diskAccessId; SecurityProfile = securityProfile; SupportsHibernation = supportsHibernation; PublicNetworkAccess = publicNetworkAccess; CompletionPercent = completionPercent; }
// Add a creation to CreationMgr (multi-player) public static CreationData NewCreation(int object_id, ulong res_hash, float rand_seed) { CreationData creation_data = new CreationData(); creation_data.m_ObjectID = object_id; creation_data.m_HashCode = res_hash; creation_data.m_RandomSeed = rand_seed; if (creation_data.LoadRes()) { creation_data.GenCreationAttr(); creation_data.BuildPrefab(); creation_data.Register(); CreationMgr.AddCreation(creation_data); //creation_data.m_Hp = creation_data.m_Attribute.m_Durability; //creation_data.m_Fuel = creation_data.m_Attribute.m_MaxFuel; Debug.Log("new creation succeed !"); creation_data.UpdateUseTime(); return(creation_data); } else { Debug.LogError("creation generate failed."); } return(null); }
public virtual void CopyTo(PeSword target, CreationData data) { target.m_RemoveEndAction = m_RemoveEndAction; target.m_HandChangeAttr = m_HandChangeAttr; target.showOnVehicle = showOnVehicle; target.m_AttackMode = new AttackMode[m_AttackMode.Length]; System.Array.Copy(m_AttackMode, target.m_AttackMode, m_AttackMode.Length); target.m_AttackSkill = new PeSword.AttackSkill[m_AttackSkill.Length]; System.Array.Copy(m_AttackSkill, target.m_AttackSkill, m_AttackSkill.Length); target.m_StaminaCost = new float[m_StaminaCost.Length]; for (int i = 0; i < m_StaminaCost.Length; i++) { target.m_StaminaCost[i] = m_StaminaCost[i] * Mathf.Clamp( data.m_Attribute.m_Weight / PEVCConfig.instance.swordStandardWeight, PEVCConfig.instance.minStaminaCostRatioOfWeight, PEVCConfig.instance.maxStaminaCostRatioOfWeight); } PETwoHandWeapon twohand = target as PETwoHandWeapon; if (twohand != null) { twohand.m_LHandPutOnBone = m_LHandPutOnBone; twohand.m_LHandPutOffBone = m_LHandPutOffBone; // twohand.m_LHandWeapon = m_LHandWeapon; } }
string Recharge(string param) { if (param == "") { return("Parameter excepted"); } string[] ps = param.Split(','); int id = Convert.ToInt32(ps[0]) + 100000000; CreationData crd = CreationMgr.GetCreation(id); if (crd != null) { float fuel = crd.m_Attribute.m_MaxFuel; if (ps.Length != 1) { fuel *= Mathf.Clamp01(Convert.ToSingle(ps[1]) * 0.01f); } var itemObject = ItemAsset.ItemMgr.Instance.Get(id); var energyCmpt = itemObject.GetCmpt <ItemAsset.Energy>(); energyCmpt.floatValue.current = fuel; //Pathea.SkAliveEntity skAliveEntity = (DragArticleAgent.GetById(id) as DragArticleAgent).itemScript.GetComponent<Pathea.SkAliveEntity>(); //skAliveEntity.SetAttribute(Pathea.AttribType.Energy, fuel, false); } return("ok"); }
string Repair(string param) { if (param == "") { return("Parameter excepted"); } string[] ps = param.Split(','); int id = Convert.ToInt32(ps[0]) + 100000000; CreationData crd = CreationMgr.GetCreation(id); if (crd != null) { float hp = crd.m_Attribute.m_Durability; if (ps.Length != 1) { hp *= Mathf.Clamp01(Convert.ToSingle(ps[1]) * 0.01f); } var itemObject = ItemAsset.ItemMgr.Instance.Get(id); var lifeCmpt = itemObject.GetCmpt <ItemAsset.LifeLimit>(); lifeCmpt.floatValue.current = hp; //Pathea.SkAliveEntity skAliveEntity = (DragArticleAgent.GetById(id) as DragArticleAgent).itemScript.GetComponent<Pathea.SkAliveEntity>(); //skAliveEntity.SetAttribute(Pathea.AttribType.Hp, hp, false); } return("ok"); }
static GameObject InstantiateAITurret(int itemInstanceId, bool init, CreationData crd, Action <Transform> initTransform) { GameObject product = InstantiateCreationModel(crd, initTransform); if (product == null) { return(null); } if (init) { // AI控制器 var controller = product.AddComponent <AITurretController>(); controller.InitController(itemInstanceId); var creation = product.GetComponent <CreationController>(); creation.collidable = creation.visible = false; } else { // 拖动 product.AddComponent <ItemDraggingCreation>(); } return(product); }
// Import content from a byte buffer public static void Import(byte[] buffer) { if (buffer == null) { return; } if (buffer.Length < 8) { return; } Init(); MemoryStream ms = new MemoryStream(buffer); BinaryReader r = new BinaryReader(ms); int version = r.ReadInt32(); if (VERSION != version) { Debug.LogWarning("The version of CreationMgr is newer than the record."); } switch (version) { case 0x2001: { int count = r.ReadInt32(); for (int i = 0; i < count; i++) { CreationData creation_data = new CreationData(); creation_data.m_ObjectID = r.ReadInt32(); creation_data.m_HashCode = r.ReadUInt64(); creation_data.m_RandomSeed = r.ReadSingle(); //creation_data.m_Hp = r.ReadSingle(); //creation_data.m_Fuel = r.ReadSingle(); // if ( creation_data.m_Hp < 0 ) // { // Debug.LogWarning("Creation " + creation_data.m_ObjectID.ToString() + // " had been crashed, will not load any more.."); // continue; // } if (creation_data.LoadRes()) { creation_data.GenCreationAttr(); creation_data.BuildPrefab(); creation_data.Register(); m_Creations.Add(creation_data.m_ObjectID, creation_data); } else { creation_data.Destroy(); creation_data = null; } } break; } default: break; } r.Close(); ms.Close(); }
// Remove a creation from CreationMgr public static void RemoveCreation(int id) { if (m_Creations == null) { Debug.LogError("CreationMgr haven't initialized!"); return; } if (m_Creations.ContainsKey(id)) { CreationData crd = m_Creations[id]; if (crd != null) { crd.Destroy(); } // for(int i = 0; i < crd.m_SkillList.Count; i++) // { // SkillAsset.EffSkill.s_tblEffSkills.Remove(crd.m_SkillList[i]); // } m_Creations.Remove(id); } else { Debug.LogError("You want to remove a creation instance, but it doesn't exist!"); } }
internal DiskData(ResourceIdentifier id, string name, ResourceType type, IDictionary <string, string> tags, AzureLocation location, string managedBy, IReadOnlyList <string> managedByExtended, DiskSku sku, IList <string> zones, ExtendedLocation extendedLocation, DateTimeOffset?timeCreated, OperatingSystemTypes?osType, HyperVGeneration?hyperVGeneration, PurchasePlanAutoGenerated purchasePlan, CreationData creationData, int?diskSizeGB, long?diskSizeBytes, string uniqueId, EncryptionSettingsCollection encryptionSettingsCollection, string provisioningState, long?diskIopsReadWrite, long?diskMBpsReadWrite, long?diskIopsReadOnly, long?diskMBpsReadOnly, DiskState?diskState, Encryption encryption, int?maxShares, IReadOnlyList <ShareInfoElement> shareInfo, NetworkAccessPolicy?networkAccessPolicy, string diskAccessId, string tier, bool?burstingEnabled, PropertyUpdatesInProgress propertyUpdatesInProgress, bool?supportsHibernation, DiskSecurityProfile securityProfile) : base(id, name, type, tags, location) { ManagedBy = managedBy; ManagedByExtended = managedByExtended; Sku = sku; Zones = zones; ExtendedLocation = extendedLocation; TimeCreated = timeCreated; OsType = osType; HyperVGeneration = hyperVGeneration; PurchasePlan = purchasePlan; CreationData = creationData; DiskSizeGB = diskSizeGB; DiskSizeBytes = diskSizeBytes; UniqueId = uniqueId; EncryptionSettingsCollection = encryptionSettingsCollection; ProvisioningState = provisioningState; DiskIopsReadWrite = diskIopsReadWrite; DiskMBpsReadWrite = diskMBpsReadWrite; DiskIopsReadOnly = diskIopsReadOnly; DiskMBpsReadOnly = diskMBpsReadOnly; DiskState = diskState; Encryption = encryption; MaxShares = maxShares; ShareInfo = shareInfo; NetworkAccessPolicy = networkAccessPolicy; DiskAccessId = diskAccessId; Tier = tier; BurstingEnabled = burstingEnabled; PropertyUpdatesInProgress = propertyUpdatesInProgress; SupportsHibernation = supportsHibernation; SecurityProfile = securityProfile; }
public void CopyTo(PEAxe target, CreationData data) { target.m_RemoveEndAction = m_RemoveEndAction; target.m_HandChangeAttr = m_HandChangeAttr; target.showOnVehicle = showOnVehicle; target.m_FellSkillID = m_FellSkillID; target.m_StaminaCost = m_StaminaCost; }
private static ItemProto GenItemData(VCIsoHeadData headData, int objId) { CreationAttr attribute = GetCreationAttr(headData.Remarks); // 0.9 id修改 转换检测 attribute.CheckCostId(); ItemProto item = CreationData.StaticGenItemData(objId, headData, attribute); return(item); }
private void UpdateErrorLabel() { if (Time.frameCount % 60 == 0) { if (VCEditor.s_Scene != null) { VCIsoData isodata = VCEditor.s_Scene.m_IsoData; attr.m_Errors.Clear(); attr.m_Warnings.Clear(); CreationData.CalcCreationType(isodata, attr); string errortext = ""; if (isodata.m_Voxels.Count + isodata.m_Components.Count == 0) { errortext = ""; } else { if (attr.m_Errors.Count + attr.m_Warnings.Count > 0) { errortext += "You must fix the issue(s) before you can export".ToLocalizationString(); } else { errortext = "This ISO is ready to export".ToLocalizationString() + " !"; if (firstvalid) { firstvalid = false; m_ExportTip.Show(); } } if (attr.m_Errors.Count > 0) { errortext += "\r\n[FF0000]\r\n"; foreach (string e in attr.m_Errors) { errortext += (" - " + e + "\r\n"); } errortext += "[-]"; } if (attr.m_Warnings.Count > 0) { errortext += "\r\n[FFFF00]\r\n"; foreach (string w in attr.m_Warnings) { errortext += (" - " + w + "\r\n"); } errortext += "[-]"; } } m_ErrorLabel.text = errortext; } } }
public static void CopyCretion(int instanceID) { CreationData new_creation = new CreationData(); new_creation.m_ObjectID = CreationMgr.QueryNewId(); new_creation.m_RandomSeed = UnityEngine.Random.value; CreationData cd = CreationMgr.GetCreation(instanceID); if (null == cd) { return; } new_creation.m_Resource = cd.m_Resource; new_creation.ReadRes(); // Attr new_creation.GenCreationAttr(); if (new_creation.m_Attribute.m_Type == ECreation.Null) { Debug.LogWarning("Creation is not a valid type !"); new_creation.Destroy(); return; } // SaveRes if (new_creation.SaveRes()) { new_creation.BuildPrefab(); new_creation.Register(); CreationMgr.AddCreation(new_creation); ItemAsset.ItemObject item; int send_retval = new_creation.SendToPlayer(out item); Debug.Log("Make creation succeed !"); if (send_retval == 0) { return; // Error } else if (send_retval == -1) { return; // Item Package Full } else { return; // Succeed } } else { Debug.LogWarning("Save creation resource file failed !"); new_creation.Destroy(); return; } }
public void SetAsRenderTarget() { var data = _getCreationData(); if (_target == null || !data.Equals(_oldCreationData)) { _oldCreationData = data; if (_target != null) _target.Dispose(); _target = new RenderTarget2D(_graphicsDevice, data.Width, data.Height, false, SurfaceFormat.Color, DepthFormat.Depth24); } _graphicsDevice.SetRenderTarget(_target); _graphicsDevice.DepthStencilState = data.DepthStencilState; _graphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1, 0); }
void ExportCreation() { if (VCEditor.s_Scene == null || VCEditor.s_Scene.m_IsoData == null) { Debug.Log("VCEditor IsoData is null!"); return; } new_creation = new CreationData(); new_creation.m_ObjectID = CreationMgr.QueryNewId(); new_creation.m_RandomSeed = UnityEngine.Random.value; new_creation.m_Resource = VCEditor.s_Scene.m_IsoData.Export(); new_creation.ReadRes(); new_creation.GenCreationAttr(); // 计算属性 if (new_creation.SaveRes()) { new_creation.BuildPrefab(); new_creation.Register(); CreationMgr.AddCreation(new_creation); } else { Debug.Log("Save creation resource file failed !"); new_creation.Destroy(); return; } GameObject obj = CreationMgr.InstantiateCreation(new_creation.m_ObjectID, 0, true, null); if (obj != null) { if (new_creation.m_Attribute.m_Type == ECreation.Vehicle) { obj.transform.localPosition = ExportPosVehicle.position; } if (new_creation.m_Attribute.m_Type == ECreation.Aircraft) { obj.transform.localPosition = ExportPosAircraft.position; } if (new_creation.m_Attribute.m_Type == ECreation.Boat) { obj.transform.localPosition = ExportPosBoat.position; } ZXCameraCtrl ZXCamera = mMainCamera.GetComponent <ZXCameraCtrl>(); ZXCamera.Following = obj.transform; } creation_obj = obj; }
public void Init( Transform partRoot, Transform meshRoot, Transform decalRoot, Transform effectRoot, CreationData creationData) { _partRoot = partRoot; _meshRoot = meshRoot; _decalRoot = decalRoot; _effectRoot = effectRoot; _creationData = creationData; _creationID = _creationData == null ? -1 : _creationData.m_ObjectID; _category = creationData.m_IsoData.m_HeadInfo.Category; // bounds CalcVoxelsBounds(); ExtendPartsBounds(); _bounds.Expand(0.05f); // 为机器人矫正 Pivot 并添加碰撞球 if (_category == EVCCategory.cgRobot) { var root = transform.GetChild(0); root.SetParent(null, true); transform.position = boundsCenterInWorld; root.SetParent(transform, true); _bounds.center = Vector3.zero; float max = _bounds.size.x; if (_bounds.size.y > max) { max = _bounds.size.y; } if (_bounds.size.z > max) { max = _bounds.size.z; } _robotRadius = Mathf.Clamp(max * 0.5f - 0.08f, 0.1f, 0.3f); gameObject.AddComponent <SphereCollider>().radius = _robotRadius; } // 添加中心物体 _centerObject = new GameObject("Center Object").transform; _centerObject.SetParent(transform, false); _centerObject.localPosition = _bounds.center; _centerObject.gameObject.layer = VCConfig.s_ProductLayer; }
public static void RPC_S2C_RequestUGCData(uLink.BitStream stream, uLink.NetworkMessageInfo info) { int[] objIDs = stream.Read <int[]>(); foreach (int id in objIDs) { CreationData data = CreationMgr.GetCreation(id); if (null == data) { CreationOriginData cData = CreationList.Find(iter => iter.ObjectID == id); if (cData != null) { CreationMgr.NewCreation(cData.ObjectID, cData.HashCode, (float)cData.Seed); } else { MessageBox_N.ShowOkBox(PELocalization.GetString(8000500)); LogManager.Error("Creation item create failed. ID:" + id); GameClientNetwork.Disconnect(); } return; } ItemProto item = ItemProto.GetItemData(id); if (null != item) { byte[] itemData = ItemProto.GetBuffer(item); NetworkManager.SyncServer(EPacketType.PT_Common_UGCItem, id, itemData); var components = from component in data.m_IsoData.m_Components where VCUtils.IsSeat(component.m_Type) select(int) component.m_Type; float hp = data.m_Attribute.m_Durability; float energy = data.m_Attribute.m_MaxFuel; if (components.Count() >= 1) { NetworkManager.SyncServer(EPacketType.PT_Common_UGCData, id, hp, energy, data.m_Attribute.m_Cost.Keys.ToArray(), data.m_Attribute.m_Cost.Values.ToArray(), true, components.ToArray()); } else { NetworkManager.SyncServer(EPacketType.PT_Common_UGCData, id, hp, energy, data.m_Attribute.m_Cost.Keys.ToArray(), data.m_Attribute.m_Cost.Values.ToArray(), false); } } } }
static GameObject InstantiateArmor(int itemInstanceId, bool init, CreationData crd, Action <Transform> initTransform) { GameObject product = InstantiateCreationModel(crd, initTransform); if (product == null) { return(null); } if (init) { } return(product); }
private void Validate(Snapshot snapshotExpected, Snapshot snapshotActual, bool diskHydrated = false, bool incremental = false) { // snapshot resource Assert.AreEqual(string.Format("{0}/{1}", ApiConstants.ResourceProviderNamespace, "snapshots"), snapshotActual.Type); Assert.NotNull(snapshotActual.Name); Assert.AreEqual(DiskRPLocation, snapshotActual.Location); // snapshot properties Assert.AreEqual(snapshotExpected.Sku.Name, snapshotActual.Sku.Name); Assert.True(snapshotActual.ManagedBy == null); Assert.NotNull(snapshotActual.ProvisioningState); Assert.AreEqual(incremental, snapshotActual.Incremental); Assert.NotNull(snapshotActual.CreationData.SourceUniqueId); if (snapshotExpected.OsType != null) //these properties are not mandatory for the client { Assert.AreEqual(snapshotExpected.OsType, snapshotActual.OsType); } if (snapshotExpected.DiskSizeGB != null) { // Disk resizing Assert.AreEqual(snapshotExpected.DiskSizeGB, snapshotActual.DiskSizeGB); } // Creation data CreationData creationDataExp = snapshotExpected.CreationData; CreationData creationDataAct = snapshotActual.CreationData; Assert.AreEqual(creationDataExp.CreateOption, creationDataAct.CreateOption); Assert.AreEqual(creationDataExp.SourceUri, creationDataAct.SourceUri); Assert.AreEqual(creationDataExp.SourceResourceId, creationDataAct.SourceResourceId); Assert.AreEqual(creationDataExp.StorageAccountId, creationDataAct.StorageAccountId); // Image reference ImageDiskReference imgRefExp = creationDataExp.GalleryImageReference ?? creationDataExp.ImageReference; ImageDiskReference imgRefAct = creationDataAct.GalleryImageReference ?? creationDataAct.ImageReference; if (imgRefExp != null) { Assert.AreEqual(imgRefExp.Id, imgRefAct.Id); Assert.AreEqual(imgRefExp.Lun, imgRefAct.Lun); } else { Assert.Null(imgRefAct); } }
/// <summary> /// Checks whether or not a new position is needed /// </summary> /// <param name="other"></param> /// <param name="positionsOccupied"></param> /// <returns>true if new position is a must</returns> bool ShouldRespawn(CreationData other, ref List <CreationData> positionsOccupied) { bool shouldRespawn = false; for (int i = 0; i < positionsOccupied.Count; i++) { float diameter = other.size.magnitude + positionsOccupied[i].size.magnitude; if (Vector2.Distance(other.position, positionsOccupied[i].position) < diameter) { shouldRespawn = true; break; } } return(shouldRespawn); }
public void CopyTo(PEBow target, CreationData data) { target.m_AttackMode = m_AttackMode; target.m_CostItemID = m_CostItemID; target.m_SkillID = m_SkillID; target.m_ReloadAnim = m_ReloadAnim; target.m_ArrowBagTrans = m_ArrowBagTrans; target.m_LineBone = m_LineBone; target.m_ArrowModel = m_ArrowModel; target.m_RemoveEndAction = m_RemoveEndAction; target.m_HandChangeAttr = m_HandChangeAttr; target.m_AimAttr = m_AimAttr; target.showOnVehicle = showOnVehicle; }
public override void Awake() { base.Awake(); var cc = GetComponent <CreationController>(); if (cc != null) { m_CreationData = cc.creationData; if (m_CreationData != null) { m_IsoData = m_CreationData.m_IsoData; m_SceneSetting = m_IsoData.m_HeadInfo.FindSceneSetting(); m_Attribute = m_CreationData.m_Attribute; m_MassCenter = m_Attribute.m_CenterOfMass; } } }
public void CreatCharacter() { if (Name.text == "") { PopUpNotification.Push("Name can not be empty.", PopUpNotification.Type.Confirm); } else if (!ClassRegistered) { PopUpNotification.Push("Please select a class.", PopUpNotification.Type.Confirm); } else { PopUpNotification.Push("Waiting for server...", PopUpNotification.Type.Pending); CreationData CreationData = new CreationData(CacheManager.CachedPlayerSlotIndex, new RGB(R.value, G.value, B.value), Name.text, RegisteredClass); Client.Send(Protocols.CreateCharacter, CreationData); } }
private PSDisk CreateDiskConfig(long fixedSizeLength) { // Sku DiskSku vSku = null; // CreationData CreationData vCreationData = null; if (this.IsParameterBound(c => c.DiskSku)) { if (vSku == null) { vSku = new DiskSku(); } vSku.Name = this.DiskSku; } vCreationData = new CreationData(); vCreationData.CreateOption = "upload"; vCreationData.UploadSizeBytes = fixedSizeLength; var vDisk = new PSDisk { Zones = this.IsParameterBound(c => c.DiskZone) ? this.DiskZone : null, OsType = this.IsParameterBound(c => c.DiskOsType) ? this.DiskOsType : OperatingSystemTypes.Windows, HyperVGeneration = this.IsParameterBound(c => c.DiskHyperVGeneration) ? this.DiskHyperVGeneration : null, DiskSizeGB = null, DiskIOPSReadWrite = null, DiskMBpsReadWrite = null, DiskIOPSReadOnly = null, DiskMBpsReadOnly = null, MaxShares = null, Location = this.IsParameterBound(c => c.Location) ? this.Location : null, Tags = null, Sku = vSku, CreationData = vCreationData, EncryptionSettingsCollection = null, Encryption = null, NetworkAccessPolicy = null, DiskAccessId = null, DataAccessAuthMode = this.IsParameterBound(c => c.DataAccessAuthMode) ? this.DataAccessAuthMode : null }; return(vDisk); }
// Add a creation to CreationMgr public static void AddCreation(CreationData creation_data) { if (m_Creations == null) { Debug.LogError("CreationMgr haven't initialized!"); return; } if (m_Creations.ContainsKey(creation_data.m_ObjectID)) { Debug.LogWarning("You want to add a creation instance, but it already exist, the old creation_data has been replaced!"); m_Creations[creation_data.m_ObjectID] = creation_data; } else { m_Creations.Add(creation_data.m_ObjectID, creation_data); } }
void Mission953(int nMissionID, int itemId) { if (nMissionID != MissionManager.m_SpecialMissionID93) { return; } ItemAsset.ItemObject itemObj = ItemAsset.ItemMgr.Instance.Get(itemId); if (itemObj == null) { return; } int itemid = 0; if (itemObj.protoId > 100000000) { itemid = StroyManager.Instance.ItemClassIdtoProtoId(itemObj.protoData.itemClassId); } else { itemid = itemObj.protoId; } if (nMissionID == MissionManager.m_SpecialMissionID93 && MissionManager.Instance.m_PlayerMission.IsSpecialID(itemid) == ECreation.SimpleObject) { CreationData creationData = CreationMgr.GetCreation(itemObj.instanceId); if (creationData != null) { int costNum = 0; foreach (var cost in creationData.m_Attribute.m_Cost.Values) { costNum += cost; } if (costNum <= 300) { StroyManager.Instance.GetMissionOrPlotById(10954); } else { StroyManager.Instance.GetMissionOrPlotById(10955); } } } }
void InitCreationID(int creationId) { if (m_Computer != null) { m_Computer.Destroy(); } CreationData crd = CreationMgr.GetCreation(creationId); if (crd != null) { m_CreationID = creationId; m_CreationData = crd; m_MeshMgr = GetComponent <VCMeshMgr>(); m_Computer = new VCMCComputer(); m_Computer.Init(new IntVector3(crd.m_IsoData.m_HeadInfo.xSize, crd.m_IsoData.m_HeadInfo.ySize, crd.m_IsoData.m_HeadInfo.zSize), m_MeshMgr, false); // [VCCase] - Create box collider if (crd.m_Attribute.m_Type == ECreation.Vehicle || crd.m_Attribute.m_Type == ECreation.Aircraft || crd.m_Attribute.m_Type == ECreation.Boat || crd.m_Attribute.m_Type == ECreation.SimpleObject || crd.m_Attribute.m_Type == ECreation.AITurret) { m_Computer.m_CreateBoxCollider = true; } } else { m_CreationID = 0; m_CreationData = null; m_Computer = null; m_MeshMgr = null; } }
internal SnapshotData(ResourceIdentifier id, string name, ResourceType type, IDictionary <string, string> tags, Location location, string managedBy, SnapshotSku sku, ExtendedLocation extendedLocation, DateTimeOffset?timeCreated, OperatingSystemTypes?osType, HyperVGeneration?hyperVGeneration, PurchasePlanAutoGenerated purchasePlan, CreationData creationData, int?diskSizeGB, long?diskSizeBytes, DiskState?diskState, string uniqueId, EncryptionSettingsCollection encryptionSettingsCollection, string provisioningState, bool?incremental, Encryption encryption, NetworkAccessPolicy?networkAccessPolicy, string diskAccessId, bool?supportsHibernation) : base(id, name, type, tags, location) { ManagedBy = managedBy; Sku = sku; ExtendedLocation = extendedLocation; TimeCreated = timeCreated; OsType = osType; HyperVGeneration = hyperVGeneration; PurchasePlan = purchasePlan; CreationData = creationData; DiskSizeGB = diskSizeGB; DiskSizeBytes = diskSizeBytes; DiskState = diskState; UniqueId = uniqueId; EncryptionSettingsCollection = encryptionSettingsCollection; ProvisioningState = provisioningState; Incremental = incremental; Encryption = encryption; NetworkAccessPolicy = networkAccessPolicy; DiskAccessId = diskAccessId; SupportsHibernation = supportsHibernation; }
void InitCreationIDClone(int creationId, VFCreationDataSource dataSource, VCMeshMgr mesh_mgr) { if (m_Computer != null) { m_Computer.Destroy(); } CreationData crd = CreationMgr.GetCreation(creationId); if (crd != null) { m_CreationID = creationId; m_CreationData = crd; m_MeshMgr = mesh_mgr; m_MeshMgr.m_LeftSidePos = !mesh_mgr.m_LeftSidePos; m_Computer = new VCMCComputer(); m_Computer.InitClone(dataSource, m_MeshMgr, false); if (crd.m_Attribute.m_Type == ECreation.Vehicle || crd.m_Attribute.m_Type == ECreation.Aircraft || crd.m_Attribute.m_Type == ECreation.Boat || crd.m_Attribute.m_Type == ECreation.SimpleObject || crd.m_Attribute.m_Type == ECreation.AITurret) { m_Computer.m_CreateBoxCollider = true; } } else { m_CreationID = 0; m_CreationData = null; m_Computer = null; m_MeshMgr = null; } }
/// <summary> /// Gets an available position within the region /// </summary> /// <param name="groundSize"></param> /// <param name="othersize"></param> /// <returns></returns> Vector2 GetAvailabePosition(Vector2 othersize, ref List <CreationData> positionsOccupied) { CreationData data = new CreationData(GetRandomPosition(othersize), othersize); int guard = 0; while (ShouldRespawn(data, ref positionsOccupied)) { data.position = GetRandomPosition(othersize); //safety guard. if (guard == 1000) { data.position = new Vector2(-1, -1); break; } else { guard++; } } return(data.position); }
private void Run() { // Sku SnapshotSku vSku = null; // CreationData CreationData vCreationData = null; // EncryptionSettingsCollection EncryptionSettingsCollection vEncryptionSettingsCollection = null; if (this.IsParameterBound(c => c.SkuName)) { if (vSku == null) { vSku = new SnapshotSku(); } vSku.Name = this.SkuName; } if (this.IsParameterBound(c => c.CreateOption)) { if (vCreationData == null) { vCreationData = new CreationData(); } vCreationData.CreateOption = this.CreateOption; } if (this.IsParameterBound(c => c.StorageAccountId)) { if (vCreationData == null) { vCreationData = new CreationData(); } vCreationData.StorageAccountId = this.StorageAccountId; } if (this.IsParameterBound(c => c.ImageReference)) { if (vCreationData == null) { vCreationData = new CreationData(); } vCreationData.ImageReference = this.ImageReference; } if (this.IsParameterBound(c => c.SourceUri)) { if (vCreationData == null) { vCreationData = new CreationData(); } vCreationData.SourceUri = this.SourceUri; } if (this.IsParameterBound(c => c.SourceResourceId)) { if (vCreationData == null) { vCreationData = new CreationData(); } vCreationData.SourceResourceId = this.SourceResourceId; } if (this.IsParameterBound(c => c.EncryptionSettingsEnabled)) { if (vEncryptionSettingsCollection == null) { vEncryptionSettingsCollection = new EncryptionSettingsCollection(); } vEncryptionSettingsCollection.Enabled = (bool)this.EncryptionSettingsEnabled; } if (this.IsParameterBound(c => c.DiskEncryptionKey)) { if (vEncryptionSettingsCollection == null) { vEncryptionSettingsCollection = new EncryptionSettingsCollection(); } if (vEncryptionSettingsCollection.EncryptionSettings == null) { vEncryptionSettingsCollection.EncryptionSettings = new List <EncryptionSettingsElement>(); } if (vEncryptionSettingsCollection.EncryptionSettings.Count == 0) { vEncryptionSettingsCollection.EncryptionSettings.Add(new EncryptionSettingsElement()); } vEncryptionSettingsCollection.EncryptionSettings[0].DiskEncryptionKey = this.DiskEncryptionKey; } if (this.IsParameterBound(c => c.KeyEncryptionKey)) { if (vEncryptionSettingsCollection == null) { vEncryptionSettingsCollection = new EncryptionSettingsCollection(); } if (vEncryptionSettingsCollection.EncryptionSettings == null) { vEncryptionSettingsCollection.EncryptionSettings = new List <EncryptionSettingsElement>(); } if (vEncryptionSettingsCollection.EncryptionSettings.Count == 0) { vEncryptionSettingsCollection.EncryptionSettings.Add(new EncryptionSettingsElement()); } vEncryptionSettingsCollection.EncryptionSettings[0].KeyEncryptionKey = this.KeyEncryptionKey; } var vSnapshot = new PSSnapshot { OsType = this.IsParameterBound(c => c.OsType) ? this.OsType : (OperatingSystemTypes?)null, HyperVGeneration = this.IsParameterBound(c => c.HyperVGeneration) ? this.HyperVGeneration : null, DiskSizeGB = this.IsParameterBound(c => c.DiskSizeGB) ? this.DiskSizeGB : (int?)null, Location = this.IsParameterBound(c => c.Location) ? this.Location : null, Tags = this.IsParameterBound(c => c.Tag) ? this.Tag.Cast <DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value) : null, Sku = vSku, CreationData = vCreationData, EncryptionSettingsCollection = vEncryptionSettingsCollection, }; WriteObject(vSnapshot); }