void Start() { selectedObjs = new List <GameObject>(); mainCam = Camera.main; audioSource = GetComponent <AudioSource>(); selectClip = SoundBox.Instance.selection; deselectClip = SoundBox.Instance.deselect; pickUp = GetComponent <MFPP.Modules.PickUpModule>(); iconContainer = Toolbox.Instance.GetIconContainer(); Radius = GetComponent <CharacterController>().radius; }
public virtual void Start() { _iconContainer = Toolbox.Instance.GetIconContainer(); _renderer = GetComponent <Renderer>(); if (_renderer) { _material = _renderer.material; } SetMaterialFloatProp("_Flippable", 0); SetMaterialFloatProp("_onHold", 0f); _selectionRenderChange = GetComponent <SelectionRenderChange>(); _action = GetComponent <TakeActionOnAction>(); }
public FontAwesomeInterop(string configYaml) { var deserializer = new Deserializer(namingConvention: new CamelCaseNamingConvention(), ignoreUnmatched: true); _config = deserializer.Deserialize<ConfigContainer>(new StreamReader(configYaml)); if(string.IsNullOrEmpty(_config.IconMeta)) throw new Exception("icon meta"); var iconPath = Path.Combine(Path.GetDirectoryName(configYaml), _config.IconMeta); if(!File.Exists(iconPath)) throw new FileNotFoundException("icon.yaml file specified in _config.yaml could not be found", iconPath); _iconContainer = deserializer.Deserialize<IconContainer>(new StreamReader(iconPath)); }
public void UpdateToolbox() { if (!player) { player = GameObject.FindWithTag("Player"); } if (!mainCanvas) { mainCanvas = GameObject.FindWithTag("Main Canvas"); } playerCam = player.GetComponentInChildren <Camera>(); raycastManager = player.GetComponent <RaycastManager>(); pickUp = player.GetComponent <MFPP.Modules.PickUpModule>(); flipScript = player.GetComponent <flipScript>(); UpdateTransforms(); iconContainer = GameObject.FindWithTag("IconContainer").GetComponent <IconContainer>(); pauseMenu = GameObject.Find("PauseMenu"); Application.backgroundLoadingPriority = ThreadPriority.Low; cameraFogStartDefault = Camera.main.GetComponent <UnityStandardAssets.ImageEffects.GlobalFog>().startDistance; fogDensityDefault = RenderSettings.fogDensity; if (Toolbox.Instance == this) { SoundEffectsAudio = GameObject.Find("SoundEffectsAudio").GetComponent <AudioSource>(); } Debug.Log("adding player info!"); Toolbox.Instance.player = player; Toolbox.Instance.playerCam = playerCam; Toolbox.Instance.pickUp = pickUp; Toolbox.Instance.raycastManager = raycastManager; Toolbox.Instance.flipScript = flipScript; UpdateTransforms(); Toolbox.Instance.iconContainer = iconContainer; Toolbox.Instance.pauseMenu = pauseMenu; Toolbox.Instance.SoundEffectsAudio = GameObject.Find("SoundEffectsAudio").GetComponent <AudioSource>(); Toolbox.Instance.SoundtrackAudio = GameObject.Find("LaserChords").GetComponent <AudioSource>(); Toolbox.Instance.soundEffectsSlider = pauseMenu.transform.GetChild(2).GetComponent <Slider>(); Toolbox.Instance.soundEffectsSlider.onValueChanged.AddListener(delegate { VolumeChangeCheck(); }); }
public FontAwesomeInterop(string configYaml) { var deserializer = new Deserializer(namingConvention: new CamelCaseNamingConvention(), ignoreUnmatched: true); _config = deserializer.Deserialize <ConfigContainer>(new StreamReader(configYaml)); if (string.IsNullOrEmpty(_config.IconMeta)) { throw new Exception("icon meta"); } var iconPath = Path.Combine(Path.GetDirectoryName(configYaml), _config.IconMeta); if (!File.Exists(iconPath)) { throw new FileNotFoundException("icon.yaml file specified in _config.yaml could not be found", iconPath); } _iconContainer = deserializer.Deserialize <IconContainer>(new StreamReader(iconPath)); }
public FAConfigYamlParser(string configYaml) { var deserializer = new DeserializerBuilder() .IgnoreUnmatchedProperties() .Build(); _config = deserializer.Deserialize <ConfigContainer>(new StreamReader(configYaml)); if (string.IsNullOrEmpty(_config.IconMeta)) { throw new Exception("Missing Icon metadata on config.yml"); } var iconPath = Path.Combine(Path.GetDirectoryName(configYaml), _config.IconMeta); if (!File.Exists(iconPath)) { throw new FileNotFoundException("icon.yaml file specified in _config.yaml could not be found", iconPath); } _iconContainer = deserializer.Deserialize <IconContainer>(new StreamReader(iconPath)); }
private static IconContainer GetIconFromShell(string path, bool useExtension, bool largeIcon) { IconContainer container; ShellFileInfo fileInfo = new ShellFileInfo(); IconCriticalHandle critHandle = null; uint fileAttributes = 0x80; uint flags = 0x100; if (!largeIcon) { flags |= 1; } if (useExtension) { flags |= 0x10; if (string.IsNullOrEmpty(path)) { fileAttributes = 0x10; } } try { if (ShellAPI.SHGetFileInfo(path, fileAttributes, ref fileInfo, (uint)Marshal.SizeOf(fileInfo), flags) == IntPtr.Zero) { throw new Win32Exception(Marshal.GetLastWin32Error()); } critHandle = new IconCriticalHandle(fileInfo.handle); container = new IconContainer(critHandle); } finally { if ((critHandle == null) && (fileInfo.handle != IntPtr.Zero)) { ShellAPI.DestroyIcon(fileInfo.handle); } } return container; }
public void SetIcon(Drawable icon) { IconContainer.Icon = icon; IconContainer.Show(); }
public ThemifyIconsInterop(string bowerJson, string configCss) { if (!File.Exists(bowerJson)) { throw new FileNotFoundException($"'{bowerJson}' file could not be found"); } if (!File.Exists(configCss)) { throw new FileNotFoundException($"'{configCss}' file could not be found"); } Container = new ConfigContainer(); using (var fileStream = new FileStream(bowerJson, FileMode.Open)) { using (var streamReader = new StreamReader(fileStream)) { var cfg = streamReader.ReadToEnd(); dynamic bower = JsonConvert.DeserializeObject <ExpandoObject>(cfg); Container.ThemifyIcons.DocBlob = bower.version.ToString(); Container.ThemifyIcons.Url = bower.homepage.ToString(); if (bower.keywords.Count > 0) { Container.ThemifyIcons.Tagline = string.Join(",", bower.keywords); } if (bower.license.Count > 0) { Container.ThemifyIcons.License = string.Join(",", bower.license); } if (bower.authors.Count > 0) { Container.ThemifyIcons.Authors = new List <Author>(); foreach (dynamic author in bower.authors) { var str = author.ToString() as string; if (str == null) { continue; } var infos = str.Split('<'); Container.ThemifyIcons.Authors.Add(new Author { Name = infos[0].Trim(), Contact = infos[1].Trim('<', '>').Trim() }); if (bower.repository != null && bower.repository.type != null && bower.repository.type == "git") { Container.ThemifyIcons.Github = new Github(); Container.ThemifyIcons.Github.Url = bower.repository.url.ToString(); } } } } } var parser = new Parser(); _iconContainer = new IconContainer(); using (var fileStream = new FileStream(configCss, FileMode.Open)) { using (var streamReader = new StreamReader(fileStream)) { var css = streamReader.ReadToEnd(); var styleSheet = parser.Parse(css); foreach (var styleRule in styleSheet.StyleRules.Where(s => s.Value.StartsWith(".ti-"))) { var selector = styleRule.Value; var id = selector.Replace(".ti-", string.Empty).Replace(":before", string.Empty); var strUnicode = styleRule.Declarations.First(d => d.Name.Equals("content", StringComparison.InvariantCultureIgnoreCase)).Term.ToString(); var unicode = $@"{(ushort) strUnicode[1]:x4}"; var iconEntry = new IconEntry { Id = id, Unicode = unicode }; _iconContainer.Icons.Add(iconEntry); } } } }
using UnityEngine; using System.Collections; namespace MFPP.Modules { [HelpURL("https://ashkoredracson.github.io/MFPP/#pick-up-module")] [DisallowMultipleComponent] public class PickUpModule : PlayerModule { /// <summary> /// The maximum pickup distance. /// </summary> [Space] [Tooltip("The maximum pickup distance.")] public float MaxPickupDistance = 2f; public float breakDistance = 5f; public float maxVelocity = 12; [Tooltip("Pick up button.")] public string PickUpButton = "Pick Up"; public Transform playerCam; public GameObject heldObject; public FootstepAsset originalFootstep; public FootstepAsset dragFootstep; public Rigidbody target; [SerializeField] private LayerMask newLayerMask; private Camera mainCamera; private float originalWalkingSpeed = 3; private IconContainer iconContainer; private AudioSource audioSource; private AudioClip pickupClip; private AudioClip dropClip; private AudioClip popClip; private float CurrentHeight; private float Radius; private IHoldable _holdable; private ISelectable _selectable; private ReticleObject _rObject; private RaycastManager rm; void Start () { mainCamera = Camera.main; audioSource = GetComponent<AudioSource>(); SoundBox sound = SoundBox.Instance; pickupClip = sound.pickup; popClip = sound.pop; dropClip = sound.deselect; iconContainer = Toolbox.Instance.GetIconContainer(); CurrentHeight = GetComponent<MFPP.Player>().CurrentHeight; Radius = GetComponent<CharacterController>().radius; rm = GetComponent<RaycastManager>(); } public override void AfterUpdate() { if (ControlManager.Instance.GetButtonDown("PickUp")) // If pick up button was pressed { if (target) // If we already have a target rigidbody, set it to null, thus dropping/throwing it. {PutDown();} else {PrepareForPickup();} } if (target) // If target is not null, move the target in front of the camera at max pickup distance.