private void UserInterfaceEventsSink_OnResetRibbonInterface(NameValueMap context) { try { // Add the button to the Modify panel on Model tab in Part Ribbon UserInterfaceManager userInterfaceMgr = m_inventorApplication.UserInterfaceManager; // Get Part Ribbon Ribbons ribbons = userInterfaceMgr.Ribbons; Ribbon partRibbon = ribbons["Part"]; // Get Modify Panel RibbonTab modelRibbonTab = partRibbon.RibbonTabs["id_TabBlockDesign"]; RibbonPanel modifyRibbonPanel = modelRibbonTab.RibbonPanels["id_Panel_Block"]; // Add the button to the Panel modifyRibbonPanel.CommandControls.AddButton(m_blockFormCmd.ButtonDefinition, false, true, "", false); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString()); } }
IEnumerator InitScene(object[] stuff) { //http://www.shaman.ibpc.fr/umolweb/Scenes/1KX2/1KX2.pdb // StartCoroutine(requestPDB.LoadPDBWWW("http://www.shaman.ibpc.fr/umolweb/Scenes/1KX2/1KX2.pdb")); // StartCoroutine(requestPDB.LoadPDBWWW("http://imyjimmy.com/pdb-files/5l1b.pdb")); //5l1b //1l2y Material mat = (Material)stuff[0]; RequestPDB requestPDB = (RequestPDB)stuff[1]; //5l1b_short // StartCoroutine(requestPDB.LoadPDBWWW("file:///C://Users/imyjimmy-vr/Documents/vr-projects/gria2-viewer/Assets/StreamingAssets/Gria2Data/5l1b_short.pdb")); //5l1b //1l2y StartCoroutine(requestPDB.LoadPDBWWW("file:///C://Users/imyjimmy-vr/Documents/vr-projects/gria2-viewer/Assets/StreamingAssets/CACNB2Data/5v2p.pdb")); //5l1b //1l2y while (!RequestPDB.isDone) { pdb_progress = requestPDB.progress; // Debug.Log(pdb_progress); yield return(new WaitForEndOfFrame()); } pdb_progress = 1.0f; //requestPDB.LoadPDBResource("1KX2"); // UIData.atomtype = UIData.AtomType.hyperball; // UIData.bondtype = UIData.BondType.hyperstick; UIData.atomtype = UIData.AtomType.noatom; UIData.bondtype = UIData.BondType.nobond; UIData.secondarystruct = true; //trying it out hlResMat = mat; ribbons = new Ribbons(); List <string> residueNames = Molecule.Model.MoleculeModel.atomsResnamelist; ribbons.CreateRibbons(); // toggle_NA_HIDE = !toggle_NA_HIDE; //GUIMoleculeController.toggle_NA_HIDE LoadBox = GameObject.Find("LoadBox"); GameObject[] objs = GameObject.FindGameObjectsWithTag("RibbonObj"); GUIMoleculeController.showOpenMenu = false; GUIMoleculeController.showAtomMenu = false; GUIMoleculeController.globalRadius = 0.3f; GUIMoleculeController.shrink = 0.00001f; //100.00f; //0.000001f; GUIMoleculeController.linkScale = 0.4f; foreach (GameObject o in objs) { o.transform.parent = LoadBox.transform; o.transform.localScale = LoadBox.transform.localScale; o.transform.localPosition = LoadBox.transform.localPosition; } SendMessage("Display", SendMessageOptions.DontRequireReceiver); }
public bool WithMedal(string medalCode) { if (Achievements != null) { if (Achievements.ContainsKey(medalCode)) { return(true); } } if (Ribbons != null) { if (Ribbons.ContainsKey(medalCode)) { return(true); } } return(false); }
public void Update() { if (ribbons == null) { ribbons = scene.ribbons; } if (postprocessing == null) { postprocessing = ribbons.postprocessing; } if (split == null) { split = postprocessing.split; } if (!SplitRegisteredEvents) { SplitRegisteredEvents = split.RegisterEvents(); } // Debug.Log("splitting script: " + split); }
protected override void Load(BinaryReader reader) { // header (unencrypted) Personality = reader.ReadUInt32(); // 0000 ushort zero = reader.ReadUInt16(); // 0004 ushort checksum = reader.ReadUInt16(); // 0006 // read out the main payload, apply xor decryption byte[][] blocks = new byte[4][]; for (int x = 0; x < 4; x++) // 0008 { blocks[x] = reader.ReadBytes(32); } DecryptBlocks(blocks, checksum); ShuffleBlocks(blocks, Personality, true); IsBadEgg = ComputeChecksum(blocks) != checksum; int ribbons1, ribbons2, ribbons3; { byte[] block = blocks[0]; SpeciesID = BitConverter.ToUInt16(block, 0); HeldItemID = BitConverter.ToUInt16(block, 2); TrainerID = BitConverter.ToUInt32(block, 4); Experience = BitConverter.ToInt32(block, 8); Happiness = block[12]; AbilityID = block[13]; Markings = (Markings)block[14]; Language = (Languages)block[15]; EVs = new ByteStatValues(block[16], block[17], block[18], block[19], block[20], block[21]); ContestStats = new ConditionValues(block[22], block[23], block[24], block[25], block[26], block[27]); ribbons2 = BitConverter.ToInt32(block, 28); } { byte[] block = blocks[1]; Moves[0] = new MoveSlot(m_pokedex, BitConverter.ToUInt16(block, 0), block[12], block[8]); Moves[1] = new MoveSlot(m_pokedex, BitConverter.ToUInt16(block, 2), block[13], block[9]); Moves[2] = new MoveSlot(m_pokedex, BitConverter.ToUInt16(block, 4), block[14], block[10]); Moves[3] = new MoveSlot(m_pokedex, BitConverter.ToUInt16(block, 6), block[15], block[11]); int ivs = BitConverter.ToInt32(block, 16); IVs = new IvStatValues(ivs & 0x3fffffff); IsEgg = (ivs & 0x40000000) != 0; HasNickname = (ivs & 0x80000000) != 0; ribbons1 = BitConverter.ToInt32(block, 20); byte forme = block[24]; FatefulEncounter = (forme & 0x01) != 0; m_female = (forme & 0x02) != 0; m_genderless = (forme & 0x04) != 0; FormID = (byte)(forme >> 3); ShinyLeaves = (ShinyLeaves)block[25]; Unknown1 = BitConverter.ToUInt16(block, 26); EggLocationID_Plat = BitConverter.ToUInt16(block, 28); LocationID_Plat = BitConverter.ToUInt16(block, 30); } { byte[] block = blocks[2]; NicknameEncoded = new EncodedString4(block, 0, 22); Unknown2 = block[22]; Version = (Versions)block[23]; ribbons3 = BitConverter.ToInt32(block, 24); Unknown3 = BitConverter.ToUInt32(block, 28); } { byte[] block = blocks[3]; TrainerNameEncoded = new EncodedString4(block, 0, 16); // todo: store as DateTime EggDate = new byte[3]; Array.Copy(block, 16, EggDate, 0, 3); Date = new byte[3]; Array.Copy(block, 19, Date, 0, 3); EggLocationID = BitConverter.ToUInt16(block, 22); LocationID = BitConverter.ToUInt16(block, 24); byte pokerusStatus = block[26]; PokerusDaysLeft = (byte)(pokerusStatus & 0x0f); PokerusStrain = (byte)(pokerusStatus >> 4); PokeBallID = block[27]; byte encounter_level = block[28]; EncounterLevel = (byte)(encounter_level & 0x7f); bool trainerFemale = (encounter_level & 0x80) != 0; TrainerGender = trainerFemale ? TrainerGenders.Female : TrainerGenders.Male; EncounterType = block[29]; PokeBallID_Hgss = block[30]; Unknown4 = block[31]; } byte[] ribbons = new byte[12]; Array.Copy(BitConverter.GetBytes(ribbons1), 0, ribbons, 0, 4); Array.Copy(BitConverter.GetBytes(ribbons2), 0, ribbons, 4, 4); Array.Copy(BitConverter.GetBytes(ribbons3), 0, ribbons, 8, 4); Ribbons.Clear(); UnknownRibbons.Clear(); IDictionary <int, Ribbon> allRibbons = m_pokedex.Ribbons(Generations.Generation4); for (int x = 0; x < 96; x++) { if (PokemonPartyBase.HasRibbon(ribbons, x)) { if (allRibbons.ContainsKey(x)) { Ribbons.Add(allRibbons[x]); } else { UnknownRibbons.Add(x); } } } }
/* * private string GetClosest(Vector3 pos) { * float minDist = float.MaxValue; * float dist; * string type = ""; * for(int i=0; i<locations.Count; i++) { * dist = Vector3.SqrMagnitude(pos - locations[i]); * if (dist < minDist) { * minDist = dist; * type = types[i]; * } * } * return type; * } * * private void ColorVerticesWithLists(Mesh mesh) { * int nbVertices = mesh.vertices.Length; * Vector3[] vertices = mesh.vertices; * Color32[] meshColors = new Color32[nbVertices]; * string type; * * for(int i=0; i<nbVertices; i++) { * type = GetClosest(vertices[i]); * meshColors[i] = AtomModel.GetAtomColor(type); * } * mesh.colors32 = meshColors; * } */ private void ColorVertices(Mesh mesh) { int nbVertices = mesh.vertices.Length; float valtype; List <float> BFactorList = MoleculeModel.BFactorList; Vector3[] vertices = mesh.vertices; Color32[] meshColors = new Color32[nbVertices]; if (slowColoring) { List <float[]> atomLocs = MoleculeModel.atomsLocationlist; atomLocations = new List <Vector3>(); for (int i = 0; i < atomLocs.Count; i++) { atomLocations.Add(new Vector3(atomLocs[i][0], atomLocs[i][1], atomLocs[i][2])); } atomColors = MoleculeModel.atomsColorList; } string type; for (int i = 0; i < nbVertices; i++) { //if(UI.UIData.atomtype == UI.UIData.AtomType.particleball){ type = atomTree.GetClosestAtomType(vertices[i]); if (UI.UIData.surfColChain) { Ribbons.InitCol(); meshColors[i] = Ribbons.GetColorChain(type); } else if (UI.UIData.surfColHydroKD) { HydrophobicScales.InitKyteDoo(); meshColors[i] = HydrophobicScales.GetColorHydro(type); } else if (UI.UIData.surfColHydroEng) { HydrophobicScales.InitEngleman(); meshColors[i] = HydrophobicScales.GetColorHydro(type); } else if (UI.UIData.surfColHydroEis) { HydrophobicScales.InitEisenberg(); meshColors[i] = HydrophobicScales.GetColorHydro(type); } else if (UI.UIData.surfColPChim) { HydrophobicScales.InitPhysChim(); meshColors[i] = HydrophobicScales.GetColorHydro(type); } else if (UI.UIData.surfColHydroWO) { HydrophobicScales.InitWhiteOct(); meshColors[i] = HydrophobicScales.GetColorHydro(type); } else if (UI.UIData.surfColBF) { valtype = float.Parse(type); if (valmax == 0) { valmin = BFactorRep.GetMin(BFactorList); valmax = BFactorRep.GetMax(BFactorList); } valtype = (valtype - valmin) / (valmax - valmin); bftype = BFactorRep.GetBFStyle(valtype); meshColors[i] = AtomModel.GetModel(bftype).baseColor; } else { meshColors[i] = MoleculeModel.GetAtomColor(type); } //This part of the code wasn't working //Anyway i dunno why we want to use another way to color surfaces when not in particles mode //} /*else * if(slowColoring){ * meshColors[i] = GetClosestAtomColor(vertices[i]); * }else{ * type = atomTree.GetClosestAtomType(vertices[i]); * meshColors[i] = MoleculeModel.GetAtomColor(type); * //meshColors[i] = atomTree.GetClosestAtomColor(vertices[i]); * }*/ } mesh.colors32 = meshColors; }