void InstantiateDialForObject(ObjectInput obj) { int tagValue = obj.tagValue; GameObject instance; if (DistanceEffectsController.Instance.objectsGrouped[tagValue] == true) { instance = Instantiate(dialFullPrefab, obj.position, Quaternion.identity); } else { instance = Instantiate(dialPrefab, obj.position, Quaternion.identity); Transform pointerTransform = instance.transform.GetChild(0); pointerTransform.localRotation = Quaternion.Euler(0, 0, Mathf.Rad2Deg * obj.orientation); Transform indicatorTransform = instance.transform.GetChild(1); indicatorTransform.localRotation = Quaternion.Euler(0, 0, Mathf.Rad2Deg * halfPI * (int)(obj.orientation / halfPI)); } ParticleSystem[] particles = instance.GetComponentsInChildren <ParticleSystem>(); Color color = dialColors[tagValue]; color.a = 0.36f; foreach (ParticleSystem p in particles) { ParticleSystem.MainModule main = p.main; main.startColor = color; } dialInstances.Add(tagValue, instance); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: static ChronoLocalDateTime<?> readExternal(java.io.ObjectInput in) throws java.io.IOException, ClassNotFoundException //JAVA TO C# CONVERTER TODO TASK: Java wildcard generics are not converted to .NET: internal static ChronoLocalDateTime <?> ReadExternal(ObjectInput @in) { ChronoLocalDate date = (ChronoLocalDate)@in.ReadObject(); LocalTime time = (LocalTime)@in.ReadObject(); return(date.atTime(time)); }
public void readExternal(ObjectInput objectInput) { // Read binary words sizes. prefixSizeInBytes = objectInput.readInt(); descIndexSizeInBytes = objectInput.readInt(); // Read possible lengths. int sizeOfLengths = objectInput.readInt(); possibleLengths.clear(); for (int i = 0; i < sizeOfLengths; i++) { possibleLengths.add(objectInput.readInt()); } // Read description pool size. int descriptionPoolSize = objectInput.readInt(); // Read description pool. if (descriptionPool == null || descriptionPool.Length < descriptionPoolSize) { descriptionPool = new String[descriptionPoolSize]; } for (int i = 0; i < descriptionPoolSize; i++) { String description = objectInput.readUTF(); descriptionPool[i] = description; } readEntries(objectInput); }
/// <summary> /// Update the volume sliders when any finger currently controlling /// some object's volume are moved /// </summary> void UpdateVolume(List <FingerInput> updatedFingers) { foreach (FingerInput finger in updatedFingers) { int objectTag; if (fingersUsed.TryGetValue(finger.id, out objectTag)) { int objectId; if (SurfaceInputs.Instance.objectInstances.TryGetValue(objectTag, out objectId)) { ObjectInput obj = SurfaceInputs.Instance.surfaceObjects[objectId]; Vector2 diff = finger.position - obj.position; float distance = diff.magnitude; float angle = Vector2.SignedAngle(Vector2.right, diff); // deg: -180 to +180 if ((angle > 90 || angle < -90) && distance > 0.7 && distance < 2.5) { float fill = AngleToFraction(angle); SetVolumeSliderFill(volumeSliderInstances[obj.tagValue], fill); if (audioEventListener != null) { audioEventListener.trackVolumes[obj.tagValue] = fill; fillRenderers[obj.tagValue].color = Color.Lerp(Color.white, sliderColors[obj.tagValue], fill); } } } } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void readExternal(java.io.ObjectInput in) throws java.io.IOException public override void ReadExternal(ObjectInput @in) { // NOTE: This was changed from reading only a byte in 2.2, which doesn't work _len = @in.readInt(); _buf = new sbyte[_len]; @in.read(_buf, 0, _len); }
public override void readExternal(ObjectInput objectInput) { // Read binary words sizes. prefixSizeInBytes = objectInput.readInt(); descIndexSizeInBytes = objectInput.readInt(); // Read possible lengths. int sizeOfLengths = objectInput.readInt(); possibleLengths.clear(); for (int i = 0; i < sizeOfLengths; i++) { possibleLengths.add(objectInput.readInt()); } // Read description pool size. int descriptionPoolSize = objectInput.readInt(); // Read description pool. if (descriptionPool == null || descriptionPool.Length < descriptionPoolSize) { descriptionPool = new String[descriptionPoolSize]; } for (int i = 0; i < descriptionPoolSize; i++) { String description = objectInput.readUTF(); descriptionPool[i] = description; } readEntries(objectInput); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public static StoreId from(java.io.ObjectInput in) throws java.io.IOException public static StoreId From(ObjectInput @in) { StoreId storeId = new StoreId(); storeId.ReadExternal(@in); return(storeId); }
/// <summary> /// Constructs and returns a new <code>ObjID</code> instance by /// unmarshalling a binary representation from an /// <code>ObjectInput</code> instance. /// /// <para>Specifically, this method first invokes the given stream's /// <seealso cref="ObjectInput#readLong()"/> method to read an object number, /// then it invokes <seealso cref="UID#read(DataInput)"/> with the /// stream to read an address space identifier, and then it /// creates and returns a new <code>ObjID</code> instance that /// contains the object number and address space identifier that /// were read from the stream. /// /// </para> /// </summary> /// <param name="in"> the <code>ObjectInput</code> instance to read /// <code>ObjID</code> from /// </param> /// <returns> unmarshalled <code>ObjID</code> instance /// </returns> /// <exception cref="IOException"> if an I/O error occurs while performing /// this operation </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static ObjID read(java.io.ObjectInput in) throws java.io.IOException public static ObjID Read(ObjectInput @in) { long num = @in.ReadLong(); UID space = UID.Read(@in); return(new ObjID(num, space)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private static Object readInternal(byte type, java.io.ObjectInput in) throws java.io.IOException, ClassNotFoundException private static Object ReadInternal(sbyte type, ObjectInput @in) { switch (type) { case CHRONO_TYPE: return(AbstractChronology.ReadExternal(@in)); case CHRONO_LOCAL_DATE_TIME_TYPE: return(ChronoLocalDateTimeImpl.ReadExternal(@in)); case CHRONO_ZONE_DATE_TIME_TYPE: return(ChronoZonedDateTimeImpl.ReadExternal(@in)); case JAPANESE_DATE_TYPE: return(JapaneseDate.ReadExternal(@in)); case JAPANESE_ERA_TYPE: return(JapaneseEra.ReadExternal(@in)); case HIJRAH_DATE_TYPE: return(HijrahDate.ReadExternal(@in)); case MINGUO_DATE_TYPE: return(MinguoDate.ReadExternal(@in)); case THAIBUDDHIST_DATE_TYPE: return(ThaiBuddhistDate.ReadExternal(@in)); case CHRONO_PERIOD_TYPE: return(ChronoPeriodImpl.ReadExternal(@in)); default: throw new StreamCorruptedException("Unknown serialized type"); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void readExternal(java.io.ObjectInput in) throws java.io.IOException public override void ReadExternal(ObjectInput @in) { _creationTime = @in.readLong(); _randomId = @in.readLong(); _storeVersion = @in.readLong(); _upgradeTime = @in.readLong(); _upgradeId = @in.readLong(); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: static HijrahDate readExternal(java.io.ObjectInput in) throws java.io.IOException, ClassNotFoundException internal static HijrahDate ReadExternal(ObjectInput @in) { HijrahChronology ChronoLocalDate_Fields.Chrono = (HijrahChronology)@in.ReadObject(); int year = @in.ReadInt(); int month = @in.ReadByte(); int dayOfMonth = @in.ReadByte(); return(ChronoLocalDate_Fields.Chrono.Date(year, month, dayOfMonth)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void readExternal(java.io.ObjectInput in) throws java.io.IOException, ClassNotFoundException public override void ReadExternal(ObjectInput @in) { _role = @in.readUTF(); _instanceId = ( InstanceId )@in.readObject(); if (@in.available() != 0) { _clusterUri = URI.create(@in.readUTF()); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: static ChronoZonedDateTime<?> readExternal(java.io.ObjectInput in) throws java.io.IOException, ClassNotFoundException //JAVA TO C# CONVERTER TODO TASK: Java wildcard generics are not converted to .NET: internal static ChronoZonedDateTime<?> ReadExternal(ObjectInput @in) { //JAVA TO C# CONVERTER TODO TASK: Java wildcard generics are not converted to .NET: //ORIGINAL LINE: ChronoLocalDateTime<?> dateTime = (ChronoLocalDateTime<?>) in.readObject(); ChronoLocalDateTime<?> dateTime = (ChronoLocalDateTime<?>) @in.ReadObject(); ZoneOffset offset = (ZoneOffset) @in.ReadObject(); ZoneId zone = (ZoneId) @in.ReadObject(); return dateTime.AtZone(offset).WithZoneSameLocal(zone); // TODO: ZDT uses ofLenient() }
/** * Supports Java Serialization. */ public override void readExternal(ObjectInput objectInput) { // Read the area code map storage strategy flag. boolean useFlyweightMapStorage = objectInput.readBoolean(); if (useFlyweightMapStorage) { areaCodeMapStorage = new FlyweightMapStorage(); } else { areaCodeMapStorage = new DefaultMapStorage(); } areaCodeMapStorage.readExternal(objectInput); }
override public void readExternal(ObjectInput objectInput) { int size = objectInput.readInt(); for (int i = 0; i < size; i++) { PhoneMetadata metadata = new PhoneMetadata(); metadata.readExternal(objectInput); metadata_.add(metadata); } }
// This method compute the value of the track played of a specific instrument according to its position, to its rotation etc... // TO Be changed private int ComputeTrackValue(ObjectInput objectInput) { if (objectInput == null) { return(0); } //int or = (int)objectInput.orientation; //return or <= 5 && or >= 1 ? or : 1; float orientation = objectInput.orientation; return((int)(orientation / (Mathf.PI / 2f)) + 1); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private static Object readInternal(byte type, java.io.ObjectInput in) throws java.io.IOException, ClassNotFoundException private static Object ReadInternal(sbyte type, ObjectInput @in) { switch (type) { case DURATION_TYPE: return(Duration.ReadExternal(@in)); case INSTANT_TYPE: return(Instant.ReadExternal(@in)); case LOCAL_DATE_TYPE: return(LocalDate.ReadExternal(@in)); case LOCAL_DATE_TIME_TYPE: return(LocalDateTime.ReadExternal(@in)); case LOCAL_TIME_TYPE: return(LocalTime.ReadExternal(@in)); case ZONE_DATE_TIME_TYPE: return(ZonedDateTime.ReadExternal(@in)); case ZONE_OFFSET_TYPE: return(ZoneOffset.ReadExternal(@in)); case ZONE_REGION_TYPE: return(ZoneRegion.ReadExternal(@in)); case OFFSET_TIME_TYPE: return(OffsetTime.ReadExternal(@in)); case OFFSET_DATE_TIME_TYPE: return(OffsetDateTime.ReadExternal(@in)); case YEAR_TYPE: return(Year.ReadExternal(@in)); case YEAR_MONTH_TYPE: return(YearMonth.ReadExternal(@in)); case MONTH_DAY_TYPE: return(MonthDay.ReadExternal(@in)); case PERIOD_TYPE: return(Period.ReadExternal(@in)); default: throw new StreamCorruptedException("Unknown serialized type"); } }
private void ProcessObjectMessage(OSCMessage msg) { string msgType = msg.Values[0].ToString(); // source / alive / set / fseq switch (msgType) { case "alive": { List <int> ids = new List <int>(surfaceObjects.Keys); foreach (int id in ids) { if (!msg.Values.Contains(id)) { surfaceObjects.Remove(id); } } break; } case "set": { int id = (int)msg.Values[1]; int tagValue = (int)msg.Values[2]; float x = (float)msg.Values[3]; float y = (float)msg.Values[4]; Vector2 position = new Vector2(x, y); float orientation = (float)msg.Values[5]; float xVel = (float)msg.Values[6]; float yVel = (float)msg.Values[7]; Vector2 velocity = new Vector2(xVel, yVel); float angularVel = (float)msg.Values[8]; float acc = (float)msg.Values[9]; float angularAcc = (float)msg.Values[10]; ObjectInput surfaceObject; if (surfaceObjects.TryGetValue(id, out surfaceObject)) { surfaceObject.UpdateProps(position, orientation, velocity, acc, angularVel, angularAcc); } else { surfaceObject = new ObjectInput(id, tagValue, position, orientation, velocity, acc, angularVel, angularAcc); surfaceObjects.Add(id, surfaceObject); } break; } } }
/** * Stores a value which is read from the provided {@code objectInput} to the provided byte {@code * buffer} at the specified {@code index}. * * @param objectInput the object input stream from which the value is read * @param wordSize the number of bytes used to store the value read from the stream * @param outputBuffer the byte buffer to which the value is stored * @param index the index where the value is stored in the buffer * @throws IOException if an error occurred reading from the object input stream */ private static void readExternalWord(ObjectInput objectInput, int wordSize, ByteBuffer outputBuffer, int index) { int wordIndex = index * wordSize; if (wordSize == SHORT_NUM_BYTES) { outputBuffer.putShort(wordIndex, objectInput.readShort()); } else { outputBuffer.putInt(wordIndex, objectInput.readInt()); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void readExternal(java.io.ObjectInput in) throws java.io.IOException, ClassNotFoundException public override void ReadExternal(ObjectInput @in) { _role = @in.readUTF(); _instanceId = ( InstanceId )@in.readObject(); _clusterUri = URI.create(@in.readUTF()); _roleUri = URI.create(@in.readUTF()); // if MemberIsAvailable message comes from old instance than we can't read storeId try { _storeId = StoreId.from(@in); } catch (IOException) { _storeId = StoreId.DEFAULT; } }
override public void readExternal(ObjectInput objectInput) { if (objectInput.readBoolean()) { setNationalNumberPattern(objectInput.readUTF()); } if (objectInput.readBoolean()) { setPossibleNumberPattern(objectInput.readUTF()); } if (objectInput.readBoolean()) { setExampleNumber(objectInput.readUTF()); } }
/** * Reads the area code entries from the provided input stream and stores them to the internal byte * buffers. */ private void readEntries(ObjectInput objectInput) { numOfEntries = objectInput.readInt(); if (phoneNumberPrefixes == null || phoneNumberPrefixes.capacity() < numOfEntries) { phoneNumberPrefixes = ByteBuffer.allocate(numOfEntries * prefixSizeInBytes); } if (descriptionIndexes == null || descriptionIndexes.capacity() < numOfEntries) { descriptionIndexes = ByteBuffer.allocate(numOfEntries * descIndexSizeInBytes); } for (int i = 0; i < numOfEntries; i++) { readExternalWord(objectInput, prefixSizeInBytes, phoneNumberPrefixes, i); readExternalWord(objectInput, descIndexSizeInBytes, descriptionIndexes, i); } }
/** * Supports Java Serialization. */ public override void readExternal(ObjectInput objectInput) { numOfEntries = objectInput.readInt(); if (countryCallingCodes == null || countryCallingCodes.Length < numOfEntries) { countryCallingCodes = new int[numOfEntries]; } if (availableLanguages == null) { availableLanguages = new ArrayList<Set<String>>(); } for (int i = 0; i < numOfEntries; i++) { countryCallingCodes[i] = objectInput.readInt(); int numOfLangs = objectInput.readInt(); Set<String> setOfLangs = new HashSet<String>(); for (int j = 0; j < numOfLangs; j++) { setOfLangs.add(objectInput.readUTF()); } availableLanguages.add(setOfLangs); } }
public override void readExternal(ObjectInput objectInput) { numOfEntries = objectInput.readInt(); if (phoneNumberPrefixes == null || phoneNumberPrefixes.Length < numOfEntries) { phoneNumberPrefixes = new int[numOfEntries]; } if (descriptions == null || descriptions.Length < numOfEntries) { descriptions = new String[numOfEntries]; } for (int i = 0; i < numOfEntries; i++) { phoneNumberPrefixes[i] = objectInput.readInt(); descriptions[i] = objectInput.readUTF(); } int sizeOfLengths = objectInput.readInt(); possibleLengths.clear(); for (int i = 0; i < sizeOfLengths; i++) { possibleLengths.add(objectInput.readInt()); } }
/// <summary> /// The object implements the readExternal method to restore its /// contents by calling the methods of DataInput for primitive /// types and readObject for objects, strings and arrays. The /// readExternal method must read the values in the same sequence /// and with the same types as were written by writeExternal. </summary> /// <exception cref="ClassNotFoundException"> If the class for an object being /// restored cannot be found. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void readExternal(java.io.ObjectInput in) throws java.io.IOException, ClassNotFoundException public virtual void ReadExternal(ObjectInput @in) { String s = @in.ReadUTF(); if (s == null || s.Length() == 0) // long mime type { sbyte[] ba = new sbyte[@in.ReadInt()]; @in.ReadFully(ba); s = StringHelperClass.NewString(ba); } try { Parse(s); } catch (MimeTypeParseException e) { throw new IOException(e.ToString()); } }
// Function called each frame when there is a touch /*void OnTouchReceive(Dictionary<int, FingerInput> surfaceFingers, Dictionary<int, ObjectInput> surfaceObjects) * { * //Debug.ClearDeveloperConsole(); * ObjectInput[] instrumentCurrentObjects = new ObjectInput[instrumentStates.Count]; * for (int i = 0; i < instrumentStates.Count; i++) * { * instrumentCurrentObjects[i] = null; * } * TryStartEvent(surfaceObjects); * foreach (KeyValuePair<int, ObjectInput> entry in surfaceObjects) * { * // * //Debug.Log(entry.Value.orientation); * instrumentCurrentObjects[entry.Value.tagValue] = entry.Value; * * } * for (int i = 0; i < instrumentStates.Count; i++) * { * //instrumentCurrentObjects[i] can be null * UpdateTrackValue(i, instrumentCurrentObjects[i]); * * if (effectsOn && instrumentCurrentObjects[i] != null) * { * UpdateAudioEffects(i, instrumentCurrentObjects[i]); * Debug.Log("Audio Effect Updated"); * } * * } * * * } */ private void UpdateAudioEffects(int parameterTag, ObjectInput objectInput) { //Reverb float x = objectInput.posRelative.x; float y = objectInput.posRelative.y; float reverbValue = x < reverbXMax ? (reverbXMax - x) / reverbXMax : 0; float flangerValue = x > flangerXMin ? (x - flangerXMin) / flangerXMin : 0; float distortionValue = y < distortionYMax ? (distortionYMax - y) / distortionYMax : 0; float filterValue = y > filterYMin ? (y - filterYMin) / (1 - filterYMin) : 0; //Debug.Log(distortionValue); eventInstance.setParameterByName("Distortion" + instrumentStates[parameterTag].instrument, distortionValue); eventInstance.setParameterByName("Reverb" + instrumentStates[parameterTag].instrument, reverbValue); eventInstance.setParameterByName("Filter" + instrumentStates[parameterTag].instrument, filterValue); eventInstance.setParameterByName("Flanger" + instrumentStates[parameterTag].instrument, flangerValue); instrumentStates[parameterTag].UpdateEffects(reverbValue, flangerValue, filterValue, distortionValue); }
// Update the corresponding parameter private void UpdateTrackValue(int instrumentTag, ObjectInput instrumentTableObject) { int trackValue = ComputeTrackValue(instrumentTableObject); if (trackValue == 0) { eventInstance.setParameterByName(instrumentStates[instrumentTag].instrument, trackValue); instrumentStates[instrumentTag].UpdateTrackValue(trackValue); // This following line is only for the object creation. As the check whether instr.isTriggered is not done, we untrigger it here in case it spawns near another fiducial } if (trackValue != instrumentStates[instrumentTag].trackValue) { if (!instrumentStates[instrumentTag].isTriggered) { eventInstance.setParameterByName(instrumentStates[instrumentTag].instrument, trackValue); } instrumentStates[instrumentTag].UpdateTrackValue(trackValue); // This following line is only for the object creation. As the check whether instr.isTriggered is not done, we untrigger it here in case it spawns near another fiducial } }
override public void readExternal(ObjectInput objectInput) { setPattern(objectInput.readUTF()); setFormat(objectInput.readUTF()); int leadingDigitsPatternSize = objectInput.readInt(); for (int i = 0; i < leadingDigitsPatternSize; i++) { leadingDigitsPattern_.add(objectInput.readUTF()); } if (objectInput.readBoolean()) { setNationalPrefixFormattingRule(objectInput.readUTF()); } if (objectInput.readBoolean()) { setDomesticCarrierCodeFormattingRule(objectInput.readUTF()); } setNationalPrefixOptionalWhenFormatting(objectInput.readBoolean()); }
public void readExternal(ObjectInput objectInput) { numOfEntries = objectInput.readInt(); if (countryCallingCodes == null || countryCallingCodes.Length < numOfEntries) { countryCallingCodes = new int[numOfEntries]; } if (availableLanguages == null) { availableLanguages = new ArrayList <Set <String> >(); } for (int i = 0; i < numOfEntries; i++) { countryCallingCodes[i] = objectInput.readInt(); int numOfLangs = objectInput.readInt(); Set <String> setOfLangs = new HashSet <String>(); for (int j = 0; j < numOfLangs; j++) { setOfLangs.add(objectInput.readUTF()); } availableLanguages.add(setOfLangs); } }
void RenderSlider(ObjectInput obj) { Color color = sliderColors[obj.tagValue]; GameObject volumeSliderInstance = Instantiate(volumeSliderPrefab, obj.position, Quaternion.identity); GameObject contour = volumeSliderInstance.transform.GetChild(0).gameObject; SpriteRenderer contourRenderer = contour.GetComponent <SpriteRenderer>(); SpriteRenderer fillRenderer = contour.transform.GetChild(0).gameObject.GetComponent <SpriteRenderer>(); int sortingLayerID = SortingLayer.NameToID("Obj" + obj.tagValue); contourRenderer.color = color; fillRenderer.color = color; fillRenderer.sortingLayerID = sortingLayerID; fillRenderer.sortingOrder = (obj.tagValue * 2) + 1; SpriteMask fillMask = volumeSliderInstance.transform.GetChild(1).gameObject.GetComponent <SpriteMask>(); fillMask.isCustomRangeActive = true; fillMask.frontSortingLayerID = sortingLayerID; fillMask.frontSortingOrder = (obj.tagValue * 2) + 1; fillMask.backSortingLayerID = sortingLayerID; fillMask.backSortingOrder = obj.tagValue * 2; SetVolumeSliderFill(volumeSliderInstance, audioEventListener.trackVolumes[obj.tagValue]); GameObject existingInstance; if (volumeSliderInstances.TryGetValue(obj.tagValue, out existingInstance)) { Destroy(existingInstance); volumeSliderInstances.Remove(obj.tagValue); } volumeSliderInstances.Add(obj.tagValue, volumeSliderInstance); fillRenderers.Add(obj.tagValue, fillRenderer); }
public void readExternal(ObjectInput objectInput) { numOfEntries = objectInput.readInt(); if (phoneNumberPrefixes == null || phoneNumberPrefixes.Length < numOfEntries) { phoneNumberPrefixes = new int[numOfEntries]; } if (descriptions == null || descriptions.Length < numOfEntries) { descriptions = new String[numOfEntries]; } for (int i = 0; i < numOfEntries; i++) { phoneNumberPrefixes[i] = objectInput.readInt(); descriptions[i] = objectInput.readUTF(); } int sizeOfLengths = objectInput.readInt(); possibleLengths.clear(); for (int i = 0; i < sizeOfLengths; i++) { possibleLengths.add(objectInput.readInt()); } }
void sendDummyData() { foreach (KeyCode key in instrumentKeys.Keys) { if (Input.GetKeyDown(key)) { instrumentFocus = instrumentKeys[key]; } } // If InstrumentFocus has been set, then we look for key pressed if (instrumentFocus != -1) { lastAddedObjects = new List <ObjectInput>(); lastRemovedObjects = new List <ObjectInput>(); lastUpdatedObjects = new List <ObjectInput>(); bool deleted = false; //space is pressed to activate/desactivate the selected instrument if (Input.GetKeyDown("space")) { foreach (ObjectInput objectInput1 in surfaceObjects.Values) { if (objectInput1.tagValue == instrumentFocus) { lastRemovedObjects.Add(objectInput1); surfaceObjects.Remove(objectInput1.id); objectInstances.Remove(instrumentFocus); OnObjectRemove(lastRemovedObjects); deleted = true; break; } } if (!deleted) { ObjectInput objectInput1 = new ObjectInput(instrumentFocus, instrumentFocus, ComputeWorldPosition(0.5f, 0.5f), new Vector2(0.5f, 0.5f), 0, new Vector2(0, 0), 0f, 0f, 0f); surfaceObjects.Add(instrumentFocus, objectInput1); objectInstances.Add(instrumentFocus, instrumentFocus); lastAddedObjects.Add(objectInput1); OnObjectAdd(lastAddedObjects); } } // If the object is already on the table, we can look for other keys used to control the position of the instrument if (surfaceObjects.TryGetValue(instrumentFocus, out ObjectInput objectInput)) { bool modified = false; //up,down,left,right control the position if (Input.GetKey("up")) { Vector2 newPosRel = objectInput.posRelative + new Vector2(0, Time.deltaTime * 0.5f); Vector2 newPos = ComputeWorldPosition(newPosRel.x, newPosRel.y); objectInput.UpdateProps(newPos, newPosRel, -objectInput.orientation, objectInput.velocity, 0f, 0f, 0f); modified = true; } if (Input.GetKey("down")) { Vector2 newPosRel = objectInput.posRelative + new Vector2(0, -Time.deltaTime * 0.5f); Vector2 newPos = ComputeWorldPosition(newPosRel.x, newPosRel.y); objectInput.UpdateProps(newPos, newPosRel, -objectInput.orientation, objectInput.velocity, 0f, 0f, 0f); modified = true; } if (Input.GetKey("left")) { Vector2 newPosRel = objectInput.posRelative + new Vector2(-Time.deltaTime * 0.5f, 0); Vector2 newPos = ComputeWorldPosition(newPosRel.x, newPosRel.y); objectInput.UpdateProps(newPos, newPosRel, -objectInput.orientation, objectInput.velocity, 0f, 0f, 0f); modified = true; } if (Input.GetKey("right")) { Vector2 newPosRel = objectInput.posRelative + new Vector2(Time.deltaTime * 0.5f, 0); Vector2 newPos = ComputeWorldPosition(newPosRel.x, newPosRel.y); objectInput.UpdateProps(newPos, newPosRel, -objectInput.orientation, objectInput.velocity, 0f, 0f, 0f); modified = true; } if (Input.GetKey("a")) { float newOrientation = -objectInput.orientation + Time.deltaTime * 2f; objectInput.UpdateProps(objectInput.position, objectInput.posRelative, newOrientation, objectInput.velocity, 0f, 0f, 0f); modified = true; } if (Input.GetKey("z")) { float newOrientation = -objectInput.orientation - Time.deltaTime * 2f; objectInput.UpdateProps(objectInput.position, objectInput.posRelative, newOrientation, objectInput.velocity, 0f, 0f, 0f); modified = true; } if (modified) { lastUpdatedObjects.Add(objectInput); OnObjectUpdate(lastUpdatedObjects); } } } /*if (surfaceObjects.Count == 0) * { * surfaceObjects.Add(0, new ObjectInput(0, 0, ComputeWorldPosition(0.4f, 0.3f), new Vector2(0.4f, 0.3f), rotations[0], new Vector2(0, 0), 0f, 0f, 0f)); * surfaceObjects.Add(1, new ObjectInput(1, 1, ComputeWorldPosition(0.6f, 0.25f), new Vector2(0.6f, 0.25f), rotations[1], new Vector2(0, 0), 0f, 0f, 0f)); * surfaceObjects.Add(2, new ObjectInput(2, 2, ComputeWorldPosition(0.4f, 0.6f), new Vector2(0.4f, 0.6f), rotations[2], new Vector2(0, 0), 0f, 0f, 0f)); * surfaceObjects.Add(3, new ObjectInput(3, 3, ComputeWorldPosition(0.2f, 0.3f), new Vector2(0.2f, 0.3f), rotations[3], new Vector2(0, 0), 0f, 0f, 0f)); * surfaceObjects.Add(4, new ObjectInput(4, 4, ComputeWorldPosition(0.3f, 0.7f), new Vector2(0.3f, 0.7f), rotations[4], new Vector2(0, 0), 0f, 0f, 0f)); * surfaceObjects.Add(5, new ObjectInput(5, 5, ComputeWorldPosition(0.8f, 0.25f), new Vector2(0.8f, 0.25f), rotations[5], new Vector2(0, 0), 0f, 0f, 0f)); * surfaceObjects.Add(6, new ObjectInput(6, 6, ComputeWorldPosition(0.5f, 0.8f), new Vector2(0.5f, 0.8f), rotations[6], new Vector2(0, 0), 0f, 0f, 0f)); * surfaceObjects.Add(7, new ObjectInput(7, 7, ComputeWorldPosition(0.4f, 0.9f), new Vector2(0.4f, 0.9f), rotations[7], new Vector2(0, 0), 0f, 0f, 0f)); * * List<ObjectInput> added = new List<ObjectInput>(surfaceObjects.Values); * OnObjectAdd(added); * } else * { * List<ObjectInput> updated = new List<ObjectInput>(); * for (int i = 0; i < rotations.Length; i++) * { * if (surfaceObjects.ContainsKey(i) && rotations[i] != surfaceObjects[i].orientation) * { * surfaceObjects[i].UpdateOrientation(rotations[i]); * updated.Add(surfaceObjects[i]); * } * } * * // // moving object * // ObjectInput obj = surfaceObjects[1]; * // float x = obj.posRelative.x + (Time.deltaTime * 0.04f); * // float y = obj.posRelative.y - (Time.deltaTime * 0.04f); * // if (x >= 1.0f) * // { * // x = 0.0f; * // } * // if (y <= 0f) * // { * // y = 1.0f; * // } * // Vector2 position = ComputeWorldPosition(x, y); * // Vector2 posRelative = new Vector2(x, y); * // obj.UpdateProps(position, posRelative, 1f, new Vector2(0, 0), 0f, 0f, 0f); * * // updated.Add(obj); * * if (updated.Count > 0) * { * OnObjectUpdate(updated); * } * } */ }
public override void readExternal(ObjectInput objectInput) { int size = objectInput.readInt(); for (int i = 0; i < size; i++) { PhoneMetadata metadata = new PhoneMetadata(); metadata.readExternal(objectInput); metadata_.add(metadata); } }
/// <summary> /// Restores this <code>DataFlavor</code> from a Serialized state. /// </summary> public void readExternal(ObjectInput @is) { }
public override void readExternal(ObjectInput objectInput) { if (objectInput.readBoolean()) { setNationalNumberPattern(objectInput.readUTF()); } if (objectInput.readBoolean()) { setPossibleNumberPattern(objectInput.readUTF()); } if (objectInput.readBoolean()) { setExampleNumber(objectInput.readUTF()); } }
public override void readExternal(ObjectInput objectInput) { setPattern(objectInput.readUTF()); setFormat(objectInput.readUTF()); int leadingDigitsPatternSize = objectInput.readInt(); for (int i = 0; i < leadingDigitsPatternSize; i++) { leadingDigitsPattern_.add(objectInput.readUTF()); } if (objectInput.readBoolean()) { setNationalPrefixFormattingRule(objectInput.readUTF()); } if (objectInput.readBoolean()) { setDomesticCarrierCodeFormattingRule(objectInput.readUTF()); } setNationalPrefixOptionalWhenFormatting(objectInput.readBoolean()); }
public override void readExternal(ObjectInput objectInput) { boolean hasDesc = objectInput.readBoolean(); if (hasDesc) { PhoneNumberDesc desc = new PhoneNumberDesc(); desc.readExternal(objectInput); setGeneralDesc(desc); } hasDesc = objectInput.readBoolean(); if (hasDesc) { PhoneNumberDesc desc = new PhoneNumberDesc(); desc.readExternal(objectInput); setFixedLine(desc); } hasDesc = objectInput.readBoolean(); if (hasDesc) { PhoneNumberDesc desc = new PhoneNumberDesc(); desc.readExternal(objectInput); setMobile(desc); } hasDesc = objectInput.readBoolean(); if (hasDesc) { PhoneNumberDesc desc = new PhoneNumberDesc(); desc.readExternal(objectInput); setTollFree(desc); } hasDesc = objectInput.readBoolean(); if (hasDesc) { PhoneNumberDesc desc = new PhoneNumberDesc(); desc.readExternal(objectInput); setPremiumRate(desc); } hasDesc = objectInput.readBoolean(); if (hasDesc) { PhoneNumberDesc desc = new PhoneNumberDesc(); desc.readExternal(objectInput); setSharedCost(desc); } hasDesc = objectInput.readBoolean(); if (hasDesc) { PhoneNumberDesc desc = new PhoneNumberDesc(); desc.readExternal(objectInput); setPersonalNumber(desc); } hasDesc = objectInput.readBoolean(); if (hasDesc) { PhoneNumberDesc desc = new PhoneNumberDesc(); desc.readExternal(objectInput); setVoip(desc); } hasDesc = objectInput.readBoolean(); if (hasDesc) { PhoneNumberDesc desc = new PhoneNumberDesc(); desc.readExternal(objectInput); setPager(desc); } hasDesc = objectInput.readBoolean(); if (hasDesc) { PhoneNumberDesc desc = new PhoneNumberDesc(); desc.readExternal(objectInput); setUan(desc); } hasDesc = objectInput.readBoolean(); if (hasDesc) { PhoneNumberDesc desc = new PhoneNumberDesc(); desc.readExternal(objectInput); setEmergency(desc); } hasDesc = objectInput.readBoolean(); if (hasDesc) { PhoneNumberDesc desc = new PhoneNumberDesc(); desc.readExternal(objectInput); setVoicemail(desc); } hasDesc = objectInput.readBoolean(); if (hasDesc) { PhoneNumberDesc desc = new PhoneNumberDesc(); desc.readExternal(objectInput); setShortCode(desc); } hasDesc = objectInput.readBoolean(); if (hasDesc) { PhoneNumberDesc desc = new PhoneNumberDesc(); desc.readExternal(objectInput); setStandardRate(desc); } hasDesc = objectInput.readBoolean(); if (hasDesc) { PhoneNumberDesc desc = new PhoneNumberDesc(); desc.readExternal(objectInput); setCarrierSpecific(desc); } hasDesc = objectInput.readBoolean(); if (hasDesc) { PhoneNumberDesc desc = new PhoneNumberDesc(); desc.readExternal(objectInput); setNoInternationalDialling(desc); } setId(objectInput.readUTF()); setCountryCode(objectInput.readInt()); setInternationalPrefix(objectInput.readUTF()); boolean hasString = objectInput.readBoolean(); if (hasString) { setPreferredInternationalPrefix(objectInput.readUTF()); } hasString = objectInput.readBoolean(); if (hasString) { setNationalPrefix(objectInput.readUTF()); } hasString = objectInput.readBoolean(); if (hasString) { setPreferredExtnPrefix(objectInput.readUTF()); } hasString = objectInput.readBoolean(); if (hasString) { setNationalPrefixForParsing(objectInput.readUTF()); } hasString = objectInput.readBoolean(); if (hasString) { setNationalPrefixTransformRule(objectInput.readUTF()); } setSameMobileAndFixedLinePattern(objectInput.readBoolean()); int nationalFormatSize = objectInput.readInt(); for (int i = 0; i < nationalFormatSize; i++) { NumberFormat numFormat = new NumberFormat(); numFormat.readExternal(objectInput); numberFormat_.add(numFormat); } int intlNumberFormatSize = objectInput.readInt(); for (int i = 0; i < intlNumberFormatSize; i++) { NumberFormat numFormat = new NumberFormat(); numFormat.readExternal(objectInput); intlNumberFormat_.add(numFormat); } setMainCountryForCode(objectInput.readBoolean()); hasString = objectInput.readBoolean(); if (hasString) { setLeadingDigits(objectInput.readUTF()); } setLeadingZeroPossible(objectInput.readBoolean()); }
public ObjectInputStream (ObjectInput stream) { _javaObjectInput = stream; }