/// <summary> /// Read the data using the reader. /// </summary> /// <param name="reader">Reader.</param> public override object Read(ISaveGameReader reader) { UnityEngine.UI.ColorBlock colorBlock = new UnityEngine.UI.ColorBlock(); foreach (string property in reader.Properties) { switch (property) { case "normalColor": colorBlock.normalColor = reader.ReadProperty <UnityEngine.Color> (); break; case "highlightedColor": colorBlock.highlightedColor = reader.ReadProperty <UnityEngine.Color> (); break; case "pressedColor": colorBlock.pressedColor = reader.ReadProperty <UnityEngine.Color> (); break; case "disabledColor": colorBlock.disabledColor = reader.ReadProperty <UnityEngine.Color> (); break; case "colorMultiplier": colorBlock.colorMultiplier = reader.ReadProperty <System.Single> (); break; case "fadeDuration": colorBlock.fadeDuration = reader.ReadProperty <System.Single> (); break; } } return(colorBlock); }
public override void SetDatum(SoundMarker newDatum) { base.SetDatum(newDatum); // Specifics string soundName = "\"" + datum.hotspot.name + "\""; if (soundName == null || soundName.Length < 1) { soundName = "<Untitled>"; } soundName += string.Format(" ({0:0.0}m - {1:0.0}m)", datum.hotspot.minDistance * 2f, datum.hotspot.maxDistance * 2f); titleLabel.text = soundName; subtitleLabel.text = datum.hotspot.soundFile.filenameWithExtension; Color markerCol = datum.color; titleLabel.color = markerCol; subtitleLabel.color = markerCol; iconImage.color = markerCol; iconImage.sprite = datum.iconSprite; UnityEngine.UI.ColorBlock buttonCols = button.colors; buttonCols.pressedColor = markerCol.ColorWithBrightness(0.5f); button.colors = buttonCols; }
public void SoundColorButtonClicked() { // Just cycle through colors for now if (canvasDelegate == null) { return; } SoundMarker selectedSound = canvasDelegate.objectSelection.selectedMarker; if (selectedSound == null) { return; } selectedSound.SetToNextColor(); Color newCol = selectedSound.color; repositionImage.color = newCol; soundIconImage.color = newCol; soundColorImage.color = newCol; minRadiusSlider.SetColorTint(newCol); maxRadiusSlider.SetColorTint(newCol); UnityEngine.UI.ColorBlock cols = soundSrcButton.colors; cols.normalColor = newCol; cols.highlightedColor = newCol.ColorWithBrightness(-0.15f); cols.pressedColor = newCol.ColorWithBrightness(-0.3f); soundSrcButton.colors = cols; canvasDelegate.objectSelection.SetSelectionRadiusColor(newCol); }
static object PerformMemberwiseClone(ref object o) { var ins = new UnityEngine.UI.ColorBlock(); ins = (UnityEngine.UI.ColorBlock)o; return(ins); }
private static void SetDefaultColorTransitionValues(UnityEngine.UI.Selectable slider) { UnityEngine.UI.ColorBlock colors = slider.colors; colors.highlightedColor = new Color(0.882f, 0.882f, 0.882f); colors.pressedColor = new Color(0.698f, 0.698f, 0.698f); colors.disabledColor = new Color(0.521f, 0.521f, 0.521f); }
void DoSetValue() { if (_selectable == null) { return; } _colorBlock = _selectable.colors; if (!colorMultiplier.IsNone) { _colorBlock.colorMultiplier = colorMultiplier.Value; } if (!fadeDuration.IsNone) { _colorBlock.fadeDuration = fadeDuration.Value; } if (!normalColor.IsNone) { _colorBlock.normalColor = normalColor.Value; } if (!pressedColor.IsNone) { _colorBlock.pressedColor = pressedColor.Value; } if (!highlightedColor.IsNone) { _colorBlock.highlightedColor = highlightedColor.Value; } if (!disabledColor.IsNone) { _colorBlock.disabledColor = disabledColor.Value; } _selectable.colors = _colorBlock; }
private void AddSceneColor(UnityEngine.UI.Selectable selectable) { UnityEngine.UI.ColorBlock colorBlock = selectable.colors; AddSceneColor(colorBlock.normalColor); // Uncomment if you want to include additional colorBlock colors //AddSceneColor(colorBlock.highlightedColor); //AddSceneColor(colorBlock.pressedColor); //AddSceneColor(colorBlock.disabledColor); }
/// <summary> /// Write the specified value using the writer. /// </summary> /// <param name="value">Value.</param> /// <param name="writer">Writer.</param> public override void Write(object value, ISaveGameWriter writer) { UnityEngine.UI.ColorBlock colorBlock = (UnityEngine.UI.ColorBlock)value; writer.WriteProperty("normalColor", colorBlock.normalColor); writer.WriteProperty("highlightedColor", colorBlock.highlightedColor); writer.WriteProperty("pressedColor", colorBlock.pressedColor); writer.WriteProperty("disabledColor", colorBlock.disabledColor); writer.WriteProperty("colorMultiplier", colorBlock.colorMultiplier); writer.WriteProperty("fadeDuration", colorBlock.fadeDuration); }
public override void OnReuse() { base.OnReuse(); var colorblock = colors; colors = new UnityEngine.UI.ColorBlock() { normalColor = color, disabledColor = colorblock.disabledColor * color, highlightedColor = colorblock.highlightedColor * color, pressedColor = colorblock.pressedColor * color, selectedColor = colorblock.selectedColor * color, colorMultiplier = colorblock.colorMultiplier, fadeDuration = colorblock.fadeDuration }; }
static ColorBox() { var ColorBox = Resources.Load <UnityEngine.GameObject>("OldScenePrefabs/NewGameMenu").transform.Find("NewGameBack/FaceView/FaceBack/FaceSettingHolder/NoseNameBack/ColorNameBack/FaceColorHolder/ColorBox"); _pointerClick = ColorBox.GetComponent <PointerClick>(); _BackgroundImage = ColorBox.GetComponent <UnityEngine.UI.Toggle>().graphic as UnityEngine.UI.Image; _image = ColorBox.GetComponent <UnityEngine.UI.Image>(); _colors = ColorBox.GetComponent <UnityEngine.UI.Toggle>().colors; _transition = ColorBox.GetComponent <UnityEngine.UI.Toggle>().transition; }
public void TurnButtonDisplay(int player) { UnityEngine.UI.ColorBlock colorBlock = UnityEngine.UI.ColorBlock.defaultColorBlock; colorBlock.normalColor = Config.Palette.PlayerColor(player); colorBlock.disabledColor = Config.Palette.PlayerColor(player); colorBlock.highlightedColor = new Color(.722f, .722f, .722f); colorBlock.pressedColor = new Color(.447f, .447f, .447f); playerTurnDisplay.colors = colorBlock; playerTurnDisplay.transform.FindChild("PlayerTurnText").GetComponent <UnityEngine.UI.Text>().text = "Player " + player + " Turn"; undoButtonDisplay.colors = colorBlock; }
// ------------------------------------------------ public void SoundMarkerSelected(SoundMarker selectedSound) { // Change the InputField text soundNameInputField.text = selectedSound.hotspot.name; soundLabelResizeText.text = selectedSound.hotspot.name; // Change the 2D UI representation soundIconImage.sprite = selectedSound.iconSprite; // Set the trigger and loop toggles triggerPlaybackToggle.isOn = selectedSound.hotspot.triggerPlayback; loopAudioToggle.isOn = selectedSound.hotspot.loopAudio; loopAudioToggle.interactable = (triggerPlaybackToggle.isOn == true); SetTriggerVisualInteractiveState(loopAudioToggle); pitchSlider.value = selectedSound.hotspot.pitchBend; volumeSlider.value = selectedSound.hotspot.soundVolume; // Change the colour of the UI Color newCol = selectedSound.color; repositionImage.color = newCol; soundIconImage.color = newCol; soundColorImage.color = newCol; minRadiusSlider.SetColorTint(newCol); maxRadiusSlider.SetColorTint(newCol); minRadiusSlider.SetSliderRadius(selectedSound.soundMinDist, notifyDelegate: false); maxRadiusSlider.SetSliderRadius(selectedSound.soundMaxDist, notifyDelegate: false); UnityEngine.UI.ColorBlock cols = soundSrcButton.colors; cols.normalColor = newCol; cols.highlightedColor = newCol.ColorWithBrightness(-0.15f); cols.pressedColor = newCol.ColorWithBrightness(-0.3f); soundSrcButton.colors = cols; if (selectedSound.hotspot.soundFile.isDefaultSoundFile) { soundFilenameText.text = "Tap to change sound"; } else { soundFilenameText.text = "\"" + selectedSound.hotspot.soundFile.filenameWithExtension + "\""; } int charLimit = 21; int charsOver = soundFilenameText.text.Length - charLimit; float percentOverCharLimit = (charsOver > 0) ? (charsOver / 8f) : 0; soundFilenameText.fontSize = 36 - (int)(8 * percentOverCharLimit); }
static void WriteBackInstance(CSHotFix.Runtime.Enviorment.AppDomain __domain, StackObject *ptr_of_this_method, IList <object> __mStack, ref UnityEngine.UI.ColorBlock instance_of_this_method) { ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method); switch (ptr_of_this_method->ObjectType) { case ObjectTypes.Object: { __mStack[ptr_of_this_method->Value] = instance_of_this_method; } break; case ObjectTypes.FieldReference: { var ___obj = __mStack[ptr_of_this_method->Value]; if (___obj is ILTypeInstance) { ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = instance_of_this_method; } else { var t = __domain.GetType(___obj.GetType()) as CLRType; t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, instance_of_this_method); } } break; case ObjectTypes.StaticFieldReference: { var t = __domain.GetType(ptr_of_this_method->Value); if (t is ILType) { ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = instance_of_this_method; } else { ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, instance_of_this_method); } } break; case ObjectTypes.ArrayReference: { var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as UnityEngine.UI.ColorBlock[]; instance_of_arrayReference[ptr_of_this_method->ValueLow] = instance_of_this_method; } break; } }
public override void SetDatum(SoundMarker newDatum) { base.SetDatum(newDatum); ReloadUI(); Color markerCol = datum.color; titleLabel.color = markerCol; subtitleLabel.color = markerCol; iconImage.color = markerCol; iconImage.sprite = datum.iconSprite; UnityEngine.UI.ColorBlock buttonCols = button.colors; buttonCols.pressedColor = markerCol.ColorWithBrightness(0.5f); button.colors = buttonCols; }
static StackObject *set_colors_6(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.UI.ColorBlock value = (UnityEngine.UI.ColorBlock) typeof(UnityEngine.UI.ColorBlock).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); UnityEngine.UI.Selectable instance_of_this_method; instance_of_this_method = (UnityEngine.UI.Selectable) typeof(UnityEngine.UI.Selectable).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.colors = value; return(__ret); }
static StackObject *get_disabledColor_8(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method); UnityEngine.UI.ColorBlock instance_of_this_method = (UnityEngine.UI.ColorBlock) typeof(UnityEngine.UI.ColorBlock).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); var result_of_this_method = instance_of_this_method.disabledColor; ptr_of_this_method = ILIntepreter.Minus(__esp, 1); WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method); __intp.Free(ptr_of_this_method); return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
static StackObject *op_Inequality_16(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.UI.ColorBlock point2 = (UnityEngine.UI.ColorBlock) typeof(UnityEngine.UI.ColorBlock).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); UnityEngine.UI.ColorBlock point1 = (UnityEngine.UI.ColorBlock) typeof(UnityEngine.UI.ColorBlock).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = point1 != point2; __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method ? 1 : 0; return(__ret + 1); }
/// <summary> /// Sets all of the current variables to a ColorBlock and returns it /// </summary> /// <param name="cb">The color block from the UI element</param> /// <returns>The color block with the new values</returns> public void SetColorBlock(UnityEngine.UI.Selectable selectable) { UnityEngine.UI.Image img = selectable.GetComponent <UnityEngine.UI.Image>(); Undo.RecordObject(selectable, "Change ColorBlock"); if (selectable.transition == UnityEngine.UI.Selectable.Transition.ColorTint) { img.color = Color.white; UnityEngine.UI.ColorBlock cb = selectable.colors; cb.normalColor = normal; cb.highlightedColor = highlighted; cb.pressedColor = pressed; cb.disabledColor = disabled; selectable.colors = cb; } else if (selectable.GetComponent <UnityEngine.UI.Image>()) { img.color = normal; } }
/* * // Should be called from unit weapon assignment as well as turn end__ * private bool IsDraftLimitReached(WSUnitManager unitReceivingWeapon) { // Null works for no new unit receiving a weapon * bool isUnitReceivingIncluded = false; * * int weaponsTally = 0; * foreach (WSUnitManager unit in _units[activePlayer]) { * if (unit.WeaponType != WeaponType.None) { * weaponsTally++; * } * if (unit == unitReceivingWeapon) { * isUnitReceivingIncluded = true; * } * } * * Debug.Log(draftPhase); * * if (isUnitReceivingIncluded) { * return true; * } * if ((draftPhase == 1 && weaponsTally == 3) || (draftPhase == 2 && weaponsTally == _units[activePlayer].Count)) { * return true; * } * return false; * }*/ #endregion public void EndTurn() { if (!uiHandler.inputEnabled) { return; } if (matchController != null) { EndWeaponSelection();//Use netcode version of turnend return; } _units[activePlayer][_selectedUnitIter].LitBorder = false; // Maybe there's a better way to organize this? switch (activePlayer) { case 1: activePlayer = 2; break; case 2: EndWeaponSelection(); return; } UnityEngine.UI.ColorBlock colorBlock = UnityEngine.UI.ColorBlock.defaultColorBlock; colorBlock.normalColor = Config.Palette.PlayerColor(activePlayer); playerTurnDisplay.colors = colorBlock; playerTurnDisplay.transform.FindChild("PlayerTurnText").GetComponent <UnityEngine.UI.Text>().text = "Player " + activePlayer + " Turn"; EstablishDraftVisibility(activePlayer); uiHandler.CenterCameraOnUnits(activePlayer); SelectedUnitIter = 0; UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(null);//Prevents button from remaining highlighted after use if (playerDirectory[activePlayer] == PlayerType.AI) { EndTurn(); } }
private void SetColorSwipe(Image image, UnityEngine.UI.Button button) { string lowerName = image.name.ToLower(); Color color; if (ColorUtility.TryParseHtmlString(image.arguments[0], out color)) { if (lowerName.StartsWith("n_")) { RectTransform rectTransform = button.GetComponent <RectTransform>(); rectTransform.sizeDelta = new Vector2(image.size.width, image.size.height); rectTransform.anchoredPosition = new Vector2(image.position.x, image.position.y); button.image.color = color; button.transition = UnityEngine.UI.Selectable.Transition.ColorTint; UnityEngine.UI.ColorBlock state = button.colors; state.normalColor = color; button.colors = state; } else if (lowerName.StartsWith("p_")) { button.transition = UnityEngine.UI.Selectable.Transition.ColorTint; UnityEngine.UI.ColorBlock state = button.colors; state.pressedColor = color; button.colors = state; } else if (lowerName.StartsWith("d_")) { button.transition = UnityEngine.UI.Selectable.Transition.ColorTint; UnityEngine.UI.ColorBlock state = button.colors; state.disabledColor = color; button.colors = state; } else if (lowerName.StartsWith("h_")) { button.transition = UnityEngine.UI.Selectable.Transition.ColorTint; UnityEngine.UI.ColorBlock state = button.colors; state.highlightedColor = color; button.colors = state; } } }
private void updateUIColor(Color newCol, bool notifyDelegate = true) { repositionImage.color = newCol; soundShapeImage.color = newCol; soundAppearanceImage.color = newCol; minRadiusSlider.SetColorTint(newCol); maxRadiusSlider.SetColorTint(newCol); UnityEngine.UI.ColorBlock cols = soundSrcButton.colors; cols.normalColor = newCol; cols.highlightedColor = newCol.ColorWithBrightness(-0.15f); cols.pressedColor = newCol.ColorWithBrightness(-0.3f); soundSrcButton.colors = cols; if (!notifyDelegate) { return; } canvasDelegate.objectSelection.SetSelectionRadiusColor(newCol); }
static StackObject *GetHashCode_19(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method); UnityEngine.UI.ColorBlock instance_of_this_method = (UnityEngine.UI.ColorBlock) typeof(UnityEngine.UI.ColorBlock).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); var result_of_this_method = instance_of_this_method.GetHashCode(); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method); __intp.Free(ptr_of_this_method); __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method; return(__ret + 1); }
public override void OnEnter() { GameObject _go = Fsm.GetOwnerDefaultTarget(gameObject); if (_go!=null) { _selectable = _go.GetComponent<UnityEngine.UI.Selectable>(); } if (_selectable!=null && resetOnExit.Value) { _originalColorBlock = _selectable.colors; } DoSetValue(); if (!everyFrame) { Finish(); } }
static StackObject *set_fadeDuration_13(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Single @value = *(float *)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method); UnityEngine.UI.ColorBlock instance_of_this_method = (UnityEngine.UI.ColorBlock) typeof(UnityEngine.UI.ColorBlock).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); instance_of_this_method.fadeDuration = value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method); __intp.Free(ptr_of_this_method); return(__ret); }
public override void OnEnter() { GameObject _go = Fsm.GetOwnerDefaultTarget(gameObject); if (_go != null) { _selectable = _go.GetComponent <UnityEngine.UI.Selectable>(); } if (_selectable != null && resetOnExit.Value) { _originalColorBlock = _selectable.colors; } DoSetValue(); if (!everyFrame) { Finish(); } }
public Boolean UnityEngine.UI.ColorBlock::op_Inequality(UnityEngine.UI.ColorBlock,UnityEngine.UI.ColorBlock)
// ------------------------------------------------ public void SoundMarkerSelected(SoundMarker selectedSound) { // Change the InputField text soundNameInputField.text = selectedSound.hotspot.name; soundLabelResizeText.text = selectedSound.hotspot.name; // Change the 2D UI representation soundIconImage.sprite = selectedSound.iconSprite; // Set the trigger and loop toggles triggerPlaybackToggle.isOn = selectedSound.hotspot.triggerPlayback; loopAudioToggle.isOn = selectedSound.hotspot.loopAudio; loopAudioToggle.interactable = (triggerPlaybackToggle.isOn == true); SetTriggerVisualInteractiveState(loopAudioToggle); pitchSlider.value = selectedSound.hotspot.pitchBend; volumeSlider.value = selectedSound.hotspot.soundVolume; // Filter values freqCutoffSlider.value = selectedSound.hotspot.freqCutoff; phaserSlider.value = selectedSound.hotspot.phaserLevel; distortionSlider.value = selectedSound.hotspot.distortion; // Syncronisation button subtitle syncSubtitleText.text = "Edit synchronised Sound Markers"; if (canvasDelegate != null) { System.Collections.Generic.HashSet <string> syncedMarkers = canvasDelegate.SynchronisedMarkerIDsWithMarkerID(selectedSound.hotspot.id); if (syncedMarkers != null && syncedMarkers.Count > 1) { syncSubtitleText.text = string.Format("Synced with {0} Sound Marker{1}", syncedMarkers.Count - 1, (syncedMarkers.Count == 2 ? "" : "s")); } } // Change the colour of the UI Color newCol = selectedSound.color; repositionImage.color = newCol; soundIconImage.color = newCol; soundColorImage.color = newCol; minRadiusSlider.SetColorTint(newCol); maxRadiusSlider.SetColorTint(newCol); minRadiusSlider.SetSliderRadius(selectedSound.soundMinDist, notifyDelegate: false); maxRadiusSlider.SetSliderRadius(selectedSound.soundMaxDist, notifyDelegate: false); UnityEngine.UI.ColorBlock cols = soundSrcButton.colors; cols.normalColor = newCol; cols.highlightedColor = newCol.ColorWithBrightness(-0.15f); cols.pressedColor = newCol.ColorWithBrightness(-0.3f); soundSrcButton.colors = cols; if (selectedSound.hotspot.soundFile.isDefaultSoundFile) { soundFilenameText.text = "Tap to change sound"; } else { soundFilenameText.text = "\"" + selectedSound.hotspot.soundFile.filenameWithExtension + "\""; } int charLimit = 21; int charsOver = soundFilenameText.text.Length - charLimit; float percentOverCharLimit = (charsOver > 0) ? (charsOver / 8f) : 0; soundFilenameText.fontSize = 36 - (int)(8 * percentOverCharLimit); }
void DoSetValue() { if (_selectable==null) { return; } _colorBlock = _selectable.colors; if (!colorMultiplier.IsNone) { _colorBlock.colorMultiplier = colorMultiplier.Value; } if (!fadeDuration.IsNone) { _colorBlock.fadeDuration = fadeDuration.Value; } if (!normalColor.IsNone) { _colorBlock.normalColor = normalColor.Value; } if (!pressedColor.IsNone) { _colorBlock.pressedColor = pressedColor.Value; } if (!highlightedColor.IsNone) { _colorBlock.highlightedColor = highlightedColor.Value; } if (!disabledColor.IsNone) { _colorBlock.disabledColor = disabledColor.Value; } _selectable.colors = _colorBlock; }
void Start() { //Netcode and playerdirectory Vaults.wsUnitList = new List <WSUnitDescriptor>(); netPlayersInVault = new List <int>(); GameObject matchControllerObject = GameObject.Find("MatchController"); if (matchControllerObject != null) { matchController = matchControllerObject.GetComponent <Deft.Netcode.MatchController>(); } if (matchController != null) { playerDirectory = new Dictionary <int, PlayerType>(); foreach (int player in matchController.netRepPlayers.Keys) { if (matchController.whoAmI == player) { playerDirectory.Add(player, PlayerType.Local); } else { playerDirectory.Add(player, PlayerType.Online); } } } else if (Vaults.playerDirectory != null) { playerDirectory = Vaults.playerDirectory; } else { playerDirectory = new Dictionary <int, PlayerType>(); playerDirectory.Add(1, PlayerType.Local); playerDirectory.Add(2, PlayerType.AI); } //Variable instantiation uiHandler = GetComponent <WSUIHandler>(); _hexGrid = new Dictionary <Vector2, WSHexManager>(); _units = new Dictionary <int, List <WSUnitManager> >(); //Load inert hexgrid for visual aid to players LoadGrid(); uiHandler.Initialize(); //Choose the player whose turn it is if (matchController != null) { activePlayer = matchController.whoAmI; if (activePlayer == 2) // Have the turn button show correctly in network mode { UnityEngine.UI.ColorBlock colorBlock = UnityEngine.UI.ColorBlock.defaultColorBlock; colorBlock.normalColor = Config.Palette.PlayerColor(2); playerTurnDisplay.colors = colorBlock; playerTurnDisplay.transform.FindChild("PlayerTurnText").GetComponent <UnityEngine.UI.Text>().text = "Player 2 Turn"; } } else { activePlayer = 1; } draftPhase = 1; //Load units to have weapons and base types modified by players _units[1] = new List <WSUnitManager>(); _units[2] = new List <WSUnitManager>(); LoadUnitPositions(); EstablishDraftVisibility(activePlayer); uiHandler.CenterCameraOnUnits(activePlayer); SelectedUnitIter = 0; }