private void DisplayAtomMethodBySphere(IList alist, IList typelist) // used to be public { Vector3 vl = new Vector3(); MoleculeModel.atomsnumber = alist.Count; for (int i = 0; i < alist.Count; i++) { GameObject o; float [] a = alist[i] as float[]; AtomModel aModel = (AtomModel)typelist[i]; vl.x = a[0]; vl.y = a[1]; vl.z = a[2]; BallUpdateSphere comp1; // o=(GameObject)MonoBehaviour.Instantiate(Resources.Load(aModel.type),vl,new Quaternion(0f,0f,0f,0f)); o = GameObject.CreatePrimitive(PrimitiveType.Sphere); o.transform.position = vl; MoleculeModel.atoms.Add(o); o.transform.parent = AtomCubeParent.transform; comp1 = o.AddComponent <BallUpdateSphere>(); comp1.rayon = aModel.radius * 2; comp1.number = i; comp1.enabled = true; comp1.atomcolor = aModel.baseColor; // Why is this suddenly necessary??? o.transform.renderer.material.SetColor("_Color", aModel.baseColor); // Debug.Log(o.transform.renderer.material.GetColor("_Color").ToString()); comp1.SetRayonFactor(aModel.scale / 100); o.tag = aModel.type; } }
private AtomModel CreateAtomRoot(Database db, Table table) { var atomRoot = new AtomModel(); if (db.DefaultSchema != table.Schema) { atomRoot.AdditionalInfo.Schema = table.Schema; } atomRoot.Name = table.Name; atomRoot.Members = new OrderedAtomMembers(); atomRoot.AdditionalInfo = new AtomAdditionalInfo(); var memberList = table.Columns.Cast <Column>() .Select(c => GetMember(db, table, c)) .ToList(); memberList = PostProcessRawMemberList(atomRoot, memberList); memberList.ForEach(atomRoot.Members.Add); AssignCompoundKeys(db, table, atomRoot, memberList); return(atomRoot); }
void Start() { DebugStreamer.message = "Hello world!"; LocCamera = GameObject.Find("Camera"); DebugStreamer.message = "Find Camera"; LocCamera.GetComponent <Skybox>().enabled = false; scenecontroller = GameObject.Find("LoadBox"); scenecontroller.AddComponent <ReadDX>(); gUIDisplay = new GUIDisplay(); DebugStreamer.message = "new GUIDisplay()"; //Init // DebugStreamer.message = "Find LoadBox"; // originalRotation = transform.localRotation; //requestPDB.mySkin=mySkin; timeleft = updateInterval; // AtomModel.InitHiRERNA(); AtomModel.InitAtomic(); SendMessage("InitScene", requestPDB, SendMessageOptions.DontRequireReceiver); }
private void HelpLookup() { var atom = new AtomModel { Name = "LookupType", Lookup = new LookupDefinition { Values = new List <LookupValue> { new LookupValue { Name = "Item1", Description = "Item1 description" }, new LookupValue { Name = "Item2", Description = "Item2 description" } } } }; Write("Lookup atom", atom); }
// Update is called once per frame void Update() { if (_timeScale != _currentTimeScale) { Time.timeScale = _timeScale; _currentTimeScale = _timeScale; } if (_isActive && Time.time - lastTime > spawnEvery) { for (int i = 0; i < gameModel.User.Atoms.Count; i++) { AtomModel atom = gameModel.User.Atoms[i]; if (atom.Stock == atom.MaxStock) { upgradeMessage.AtomicNumber = atom.AtomicNumber; Messenger.Dispatch(AtomMessage.ATOM_STOCK_UPGRADE, upgradeMessage); } } message.SC = gameModel.User.SC; Messenger.Dispatch(SolarMessage.CREATE_SOLAR, message); lastTime = Time.time; } }
private List <AtomMemberInfo> HandleExplicitTemporal(AtomModel atomModel, List <AtomMemberInfo> memberList) { var byName = memberList.ToDictionary(i => i.Name); var createdOnUtcMember = Constants.CreatedOnDateTimePotentialNames.FirstOrDefault(byName.ContainsKey); var lastModifiedOnUtcMember = Constants.LastModifiedOnOnDateTimePotentialNames.FirstOrDefault(byName.ContainsKey); if (createdOnUtcMember != null && lastModifiedOnUtcMember != null) { atomModel.AdditionalInfo.Temporal.HasTemporal = true; if (byName[createdOnUtcMember].Queryable) { atomModel.AdditionalInfo.Temporal.CreatedOnSort = byName[createdOnUtcMember].SortDirection ?? AtomMemberSortDirection.Asc; } else if (byName[lastModifiedOnUtcMember].Queryable) { atomModel.AdditionalInfo.Temporal.LastModifiedSort = byName[lastModifiedOnUtcMember].SortDirection ?? AtomMemberSortDirection.Asc; } return(memberList.Where(i => !(i.Name.Equals(createdOnUtcMember) || i.Name.Equals(lastModifiedOnUtcMember))) .ToList()); } return(memberList); }
private HashSet <AtomModel> DepthFirstSearch(AtomModel atom, AtomModel target, HashSet <string> allreadyChecked) { if (atom == target) { return(new HashSet <AtomModel> { atom }); } // WTF allreadyChecked isn't used? // this looks like it could be a perf issue at sompoint, // should build up a set of checked deps... foreach (var dep in atom.GetDependencies() .Where(d => !allreadyChecked.Contains(d)) .Select(d => _allAtoms[d])) { var result = DepthFirstSearch(dep, target, allreadyChecked); if (result != null) { result.Add(atom); return(result); } } return(null); }
private void CreateAtom(AtomModel atomModel) { GameObject go = Instantiate(atomPrefab, atomsContainer); AtomComponent atomComp = go.GetComponent <AtomComponent>(); atomComp.UpdateModel(atomModel); _atoms.Add(atomModel.AtomicNumber, atomComp); }
private CreateTableResult AddTable(SqlResult result, AtomModel atom) { Log.Information("Creating table: {TableName}", atom.Name); var table = CreateTable(atom); result.AddOutput("Tables", atom.AdditionalInfo.Schema + "." + atom.Name, table.TableSql); return(table); }
public void UpdateModel(AtomModel model) { _model = model; _atomMessage = new AtomMessage(_model.AtomicNumber, 1); _model.rMaxStockNextLevel.Subscribe(newValue => UIStockLabel.text = "+" + newValue.ToString()).AddTo(this); _model.rMaxStockUpgradePrice.Subscribe(newValue => UISCLabel.text = newValue.ToString()).AddTo(this); gameModel.User.rSC.Subscribe(SC => UIButton.interactable = SC >= _model.MaxStockUpgradePrice).AddTo(this); }
public LookupContext(AtomModel lookup) { _lookup = lookup; IdMember = _lookup.Members.First(i => i.IsPrimary); NameMember = _lookup.Members.First(i => i.Name.EndsWith("Name")); DescriptionMember = _lookup.Members.First(i => i.Name.EndsWith("Description")); CreatedOnMember = _lookup.Members.FirstOrDefault(m => m.HasFlag(MemberFlags.CreatedDateTimeTracking)); LastModifiedMember = _lookup.Members.FirstOrDefault(m => m.HasFlag(MemberFlags.LastModifiedDateTimetracking)); SoftDeleteMember = _lookup.Members.FirstOrDefault(m => m.HasFlag(MemberFlags.SoftDeleteTracking)); }
public static ProjectedAtomRoot FromAtom(AtomModel atomModel) { return(new ProjectedAtomRoot { BasedOn = atomModel, Name = atomModel.Name, Members = atomModel.Members.Select(AliasedAtomMemberInfo.FromAtomMemberInfo) .ToList() }); }
public static void UpdateColorsFromModel() { BallUpdate[] balls = GameObject.FindObjectsOfType(typeof(BallUpdate)) as BallUpdate[]; foreach (BallUpdate ball in balls) { ball.atomcolor = AtomModel.GetAtomColor(ball.tag); } resetColors = true; }
void Awake() { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); timeleft = updateInterval; // AtomModel.InitHiRERNA(); AtomModel.InitAtomic(); SendMessage("InitScene", new object[] { hlResMat, requestPDB }, SendMessageOptions.DontRequireReceiver); // ScenePreload_5L1B scene = new ScenePreload_5L1B(); // scene.InitScene(requestPDB); }
public void UpdateModel(AtomModel model) { _model = model; StoreComponent.Name = _model.Symbol; StoreComponent.Property = "x" + _model.AtomicWeight.ToString("F2"); UpgradeComponent.UpdateModel(_model); _model.rStock.Subscribe(stock => StoreComponent.Stock = stock).AddTo(this); _model.rMaxStock.Subscribe(maxStock => StoreComponent.MaxStock = maxStock).AddTo(this); }
private List <AtomMemberInfo> PostProcessRawMemberList(AtomModel atomModel, List <AtomMemberInfo> memberList) { if (_config.Config.InferrHiddenKey) { memberList = InferHiddenKeys(atomModel, memberList); } memberList = HandleExplicitTemporal(atomModel, memberList).ToList(); memberList = HandleExplicitIsDeleted(atomModel, memberList); return(memberList); }
internal void UpdateModel(AtomModel model) { _model = model; _startTime = Time.time; _originalMaxStock = _model.MaxStock; _atomMessage = new AtomMessage(_model.AtomicNumber, 1); AddReactor(timePercent); AddReactor ( _model.rHarvestRate .Subscribe(rate => { _model.Stock = (int)(((float)_model.Stock / _model.MaxStock) * (_originalMaxStock * _model.HarvestRate)); _model.MaxStock = (int)(_originalMaxStock * _model.HarvestRate); _harvestTime = _model.AtomicWeight / _model.HarvestRate; _startTime = -(timePercent.Value * _harvestTime) + Time.time; }) ); AddReactor ( Observable.EveryUpdate() .Subscribe(_ => timePercent.Value = (Time.time - _startTime) / _harvestTime) ); AddReactor ( timePercent.Subscribe(percent => UISlider.value = UISlider.maxValue * percent) ); AddReactor ( _model.rStock.Where(_ => _model.Stock <= 0).Subscribe(_ => DestroyReactors()) ); AddReactor ( timePercent .Where(value => value >= 1f) .Subscribe(_ => { _startTime = Time.time; _model.Stock -= 1; Messenger.Dispatch(AtomMessage.ATOM_HARVEST, _atomMessage); }) ); }
public bool UpgradeAtomStock(int atomicNumber) { AtomModel atomModel = _user.Atoms[atomicNumber]; if (!SpendAtoms(atomModel.MaxStockUpgradePrice)) { Debug.Log("NOT ENOUGH ATOMIC MASS TO UPGRADE!"); return(false); } atomModel.MaxStock += atomModel.MaxStockNextLevel; return(true); }
private List <AtomMemberInfo> HandleExplicitIsDeleted(AtomModel atomModel, List <AtomMemberInfo> memberList) { var byName = memberList.ToDictionary(i => i.Name); if (byName.ContainsKey(Constants.Members.IsDeleted)) { atomModel.AdditionalInfo.UseSoftDeletes = true; return(memberList.Where(i => !i.Name.Equals(Constants.Members.IsDeleted, StringComparison.OrdinalIgnoreCase)) .ToList()); } return(memberList); }
public bool SpendAtoms(float PriceSC) { //if( _config.autoPlay ) // return true; if (_user.SC < PriceSC) { return(false); } List <bool> depleted = new List <bool>(_user.Atoms.Count); depleted.Add(true); for (int index = 1; index < _user.Atoms.Count; index++) { depleted.Add(false); } float remainingSC = PriceSC; while (remainingSC > 1f) { if (depleted.TrueForAll(value => value)) { Debug.LogError("Depleted Atoms, but remainingSC still above 1AM! " + remainingSC); remainingSC = 0; } for (int index = 1; index < _user.Atoms.Count; index++) { AtomModel atom = _user.Atoms[index]; if (atom.Stock > 0) { float reducedSC = remainingSC - atom.AtomicWeight; if (reducedSC >= 0) { UpdateAtomStock(atom.AtomicNumber, -1); } remainingSC = reducedSC; } else { depleted[atom.AtomicNumber] = true; } } } return(true); }
private static IEnumerable <ReferenceMember> ResolveMembers(AtomModel atom, IEnumerable <Reference> resolvedReferences) { foreach (var resolvedReference in resolvedReferences) { var forwardReferenceMember = atom.Members.SingleOrDefault(m => m.HasReference && m.Reference?.Name == resolvedReference.Name); var backwardReferenceMember = resolvedReference.ReferenceTarget.Members.SingleOrDefault( m => m.HasReference && m.Reference?.Name == atom.Name); yield return(new ReferenceMember { Target = resolvedReference, ThroughMember = forwardReferenceMember ?? backwardReferenceMember }); } }
private void AssignCompoundKeys(Database db, Table table, AtomModel atomModel, List <AtomMemberInfo> memberList) { var memberLookup = memberList.ToDictionary(i => i.Name); var compoundIndexes = table.Indexes.Cast <Index>() .Where( i => i.IndexedColumns.Cast <IndexedColumn>() .Count() > 1) .ToList(); bool?hasItems = !compoundIndexes?.Any(); if (hasItems.GetValueOrDefault()) { foreach (var compoundIndex in compoundIndexes) { if (compoundIndex.IndexKeyType == IndexKeyType.DriPrimaryKey) { // skip compound primary keys since they will already be created with individual key constraints continue; } var group = compoundIndex.Name; foreach (IndexedColumn column in compoundIndex.IndexedColumns) { var member = memberLookup[column.Name]; if (member.Groups == null) { member.Groups = new List <string>(); } member.Groups.Add(group); } atomModel.Groups.Add( group, new AtomGroupDefinition { Name = group, Unique = compoundIndex.IsUnique }); } } }
private List <AtomMemberInfo> InferHiddenKeys(AtomModel atomModel, List <AtomMemberInfo> memberList) { var alts = memberList.Where(i => i.Name.Equals(atomModel.Name + "guid", StringComparison.OrdinalIgnoreCase)) .ToList(); if (alts.Count == 1) { var primaryKey = memberList.Where(i => i.IsPrimary); atomModel.AdditionalInfo.HideId = true; alts[0].IsAltKey = true; return(memberList.Except(primaryKey) .ToList()); } return(memberList); }
public void UpdateModel(AtomModel model) { _model = model; PlanetAtomStore.ID = _model.AtomicNumber.ToString(); PlanetAtomStore.Name = _model.Symbol; PlanetAtomStore.MaxStock = _model.MaxStock; PlanetAtomStore.Stock = _model.Stock; PlanetAtomUpgradeComponent upgradeComp = gameObject.GetComponent <PlanetAtomUpgradeComponent>(); upgradeComp.UpdateModel(_model); HarvesterComponent harvester = gameObject.GetComponent <HarvesterComponent>(); harvester.UpdateModel(_model); _model.rStock.Subscribe(stock => { PlanetAtomStore.Stock = stock; PlanetAtomStore.Property = stock + "(" + (stock * _model.AtomicWeight).ToString("F0") + "AM)"; }).AddTo(this); _model.rMaxStock.Subscribe(maxStock => PlanetAtomStore.MaxStock = maxStock).AddTo(this); }
public void UpdateModel(AtomModel model) { _model = model; UIUpgradeButton.OnClickAsObservable() .Subscribe(_ => Messenger.Dispatch(HarvesterMessage.HARVESTER_UPGRADE, new HarvesterMessage(_model))) .AddTo(this); gameModel.User.rHC .Subscribe(HC => UIUpgradeButton.interactable = HC >= _model.HarvestRateUpgradePrice) .AddTo(this); _model.rHarvestRate .Subscribe(HR => UIStockLabel.text = _model.HarvestRate.ToString("F1") + "AM/s") .AddTo(this); _model.rHarvestRateUpgradePrice .Subscribe(price => UIPriceLabel.text = _model.HarvestRateUpgradePrice.ToString()) .AddTo(this); }
/* * private void CreateAtomArray(int size) { * Debug.Log("AtomArray"); * Debug.Log(size); * hyperballs = new GameObject[size]; * GameObject first = GameObject.CreatePrimitive(PrimitiveType.Cube); * first.transform.parent = AtomCubeParent.transform; * hyperballs[0] = first; * for(int i=1; i<size; i++) * hyperballs[i] = (GameObject) GameObject.Instantiate(first); * } */ //iAtom : Atom index in atomLocationalist private void CreateAtomHB(int iAtom, IList coordinates, IList atomModels) { GameObject Atom; Atom = GameObject.CreatePrimitive(PrimitiveType.Cube); float[] fLocation = coordinates[iAtom] as float[]; Vector3 location = new Vector3(fLocation[0], fLocation[1], fLocation[2]); AtomModel atomModel = atomModels[iAtom] as AtomModel; Atom.transform.Translate(location); Atom.transform.parent = AtomCubeParent.transform; MoleculeModel.atoms.Add(Atom); if (atomtype == UIData.AtomType.hyperball) { //Test platform to choose the good shader RuntimePlatform platform = Application.platform; switch (platform) { case RuntimePlatform.WindowsPlayer: case RuntimePlatform.WindowsWebPlayer: case RuntimePlatform.WindowsEditor: Atom.renderer.material.shader = Shader.Find("FvNano/Ball HyperBalls OpenGL"); break; default: Atom.renderer.material.shader = Shader.Find("FvNano/Ball HyperBalls OpenGL"); // Atom.renderer.material.shader=Shader.Find("Custom/BallImprovedZ"); break; } Atom.AddComponent("BallUpdateHB"); if (UI.GUIDisplay.file_extension == "xgmml") { Atom.GetComponent <BallUpdateHB>().z = (float)(fLocation[2]); } } else { Atom.AddComponent("BallUpdateCube"); BallUpdateCube comp1 = Atom.GetComponent <BallUpdateCube>(); comp1.SetRayonFactor(atomModel.scale / 100); } BallUpdate comp = Atom.GetComponent <BallUpdate>(); // Debug.Log ("%%%%%%%%%%%%%%%%%%%%% Creating Atom"); // Debug.Log (iAtom); comp.rayon = atomModel.radius; comp.atomcolor = atomModel.baseColor; comp.number = iAtom; // Debug.Log (comp.number); comp.oldrayonFactor = atomModel.scale / 100; // Why division by 100 ??? if (UI.GUIDisplay.file_extension == "xgmml") { comp.rayon = ((MoleculeModel.CSRadiusList[iAtom]) as float[])[0]; comp.atomcolor = HexToColor((MoleculeModel.CSColorList[iAtom] as string[])[0]); } Atom.renderer.material.SetColor("_Color", comp.atomcolor); // Projector proj = Atom.AddComponent<Projector>(); Atom.AddComponent <Projector>(); comp.enabled = true; comp.isSplineNode = UIData.secondarystruct; Atom.tag = atomModel.type; if (atomtype == UIData.AtomType.particleball) { Atom.renderer.enabled = false; } BoxCollider collider = Atom.collider as BoxCollider; float newSize = comp.rayon * 60 / 100; collider.size = new Vector3(newSize, newSize, newSize); }
protected QuerySproc(AtomModel atom) : base(atom) { }
public void loadPDB(string id) { UnitySocket.Send(CommandID.GETPDB); UnitySocket.Send(0); UnitySocket.Send(id); int num0 = UnitySocket.ReceiveInt(); int num1 = UnitySocket.ReceiveInt(); //print(num); Debug.Log(num0 + "|" + num1); for (int k = 0; k < num0 + num1; k++) { UnitySocket.Send(CommandID.GETPDB); UnitySocket.Send(k + 1); if (k < num0) { string sonAtoms = UnitySocket.ReceiveString(60000); Atoms += sonAtoms.Trim(); // Debug.Log("sonAtoms is: "+sonAtoms); } else { string sonClubs = UnitySocket.ReceiveString(68000); Clubs += sonClubs.Trim(); } } string [] sArray = Atoms.Split('$'); Debug.Log("length:" + sArray.Length); for (int i = 0; i < sArray.Length - 1; i++) { if (sArray[i] == "") { continue; } string [] ssArray = sArray[i].Split('#'); // Debug.Log(i+"|"+sArray[i]+"////"); float[] vect = new float[3]; float.TryParse(ssArray[0], out vect[0]); float.TryParse(ssArray[1], out vect[1]); float.TryParse(ssArray[2], out vect[2]); // for(int kk=0;kk<vect.Length;kk++) // { // Debug.Log(i+"|"+vect[kk]+"////"); // } typelist.Add(AtomModel.GetModel(ssArray[3])); alist.Add(vect); } Debug.Log(Clubs); Vector3 minPoint = Vector3.zero; Vector3 maxPoint = Vector3.zero; MoleculeModel.atomsLocationlist = alist; MoleculeModel.atomsTypelist = typelist; //MoleculeModel.bondList=ControlMolecule.CreateBondsList(alist,typelist); //Debug.Log("======================= Bond List" + MoleculeModel.bondList.ToString()); MoleculeModel.bondEPList = ControlMolecule.CreateBondsEPList(alist, typelist); MoleculeModel.bondEPSugarList = ControlMolecule.CreateBondsEPList(MoleculeModel.atomsSugarLocationlist, MoleculeModel.atomsSugarTypelist); // float [] a0=alist[0] as float[]; // MoleculeModel.cameraLocation.x=MoleculeModel.target.x=a0[0]; // MoleculeModel.cameraLocation.y=MoleculeModel.target.y=a0[1]; // MoleculeModel.target.z=a0[2]; // MoleculeModel.cameraLocation.z=a0[2]-150; // for (int i = 0; i < alist.Count; i++) { float[] position = alist[i] as float[]; minPoint = Vector3.Min(minPoint, new Vector3(position[0], position[1], position[2])); maxPoint = Vector3.Max(maxPoint, new Vector3(position[0], position[1], position[2])); } Vector3 centerPoint = minPoint + ((maxPoint - minPoint) / 2); //MoleculeModel.target = centerPoint; MoleculeModel.Offset = -centerPoint; for (int i = 0; i < alist.Count; i++) { float[] position = alist[i] as float[]; float[] vect = new float[3]; vect[0] = position[0] + MoleculeModel.Offset.x; vect[1] = position[1] + MoleculeModel.Offset.y; vect[2] = position[2] + MoleculeModel.Offset.z; alist[i] = vect; } // Debug.Log("MoleculeModel.target "+MoleculeModel.target); MoleculeModel.cameraLocation.x = MoleculeModel.target.x; MoleculeModel.cameraLocation.y = MoleculeModel.target.y; // MoleculeModel.cameraLocation.z=MoleculeModel.target.z-((maxPoint - minPoint) ).z; MoleculeModel.cameraLocation.z = MoleculeModel.target.z - ((maxPoint - minPoint)).z; //MoleculeModel.bondList=ControlMolecule.CreateBondsList(alist,typelist); MoleculeModel.bondEPList = ControlMolecule.CreateBondsEPList(alist, typelist); MoleculeModel.bondEPSugarList = ControlMolecule.CreateBondsEPList(MoleculeModel.atomsSugarLocationlist, MoleculeModel.atomsSugarTypelist); MoleculeModel.atomsnumber = alist.Count; MoleculeModel.bondsnumber = MoleculeModel.bondEPList.Count; string [] sClubArray = Clubs.Split('$'); for (int i = 0; i < sClubArray.Length - 1; i++) { string [] ssClubArray = sClubArray[i].Split('#'); float[] vect = new float[3]; vect[0] = float.Parse(ssClubArray[0]); vect[1] = float.Parse(ssClubArray[1]); vect[2] = float.Parse(ssClubArray[2]); clubLocationalist.Add(vect); float[] vectRotation = new float[3]; vectRotation[0] = float.Parse(ssClubArray[3]); vectRotation[1] = float.Parse(ssClubArray[4]); vectRotation[2] = 0f; clubRotationList.Add(vectRotation); } Debug.Log(clubRotationList.Count); }
public HarvesterMessage(AtomModel model) { Model = model; }
public ResolvedReference(AtomModel atom, IEnumerable <Reference> resolvedReferences) { _atom = atom; _resolvedReferences = resolvedReferences; ReferencingMembers = ResolveMembers(atom, resolvedReferences).ToList(); }