示例#1
0
    public virtual void OnPointerEnter(PointerEventData eventData)
    {
        if (!Interactable)
        {
            return;
        }

        Animator.SetBool("Selected", true);
        SoundMusicManager.PlayMainMenuSFX(MainMenuSFXs.buttonSelected);
    }
示例#2
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Debug.LogWarning("More than one SoundMusicManager in the Scene");
     }
 }
示例#3
0
    public virtual void OnPointerClick(PointerEventData eventData)
    {
        if (!Interactable)
        {
            return;
        }

        Animator.SetBool("Pressed", true);
        OnClickEvent?.Invoke();

        SoundMusicManager.PlayMainMenuSFX(MainMenuSFXs.buttonPressed);
    }
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }
        DontDestroyOnLoad(gameObject);

        source = GetComponent <AudioSource>();
    }
示例#5
0
文件: Config.cs 项目: sirdrunk/Razor
        public void Save()
        {
            string profileDir = Config.GetUserDirectory("Profiles");
            string file       = Path.Combine(profileDir, String.Format("{0}.xml", m_Name));

            if (m_Name != "default" && !m_Warned)
            {
                try
                {
                    m_Mutex = new System.Threading.Mutex(true, String.Format("Razor_Profile_{0}", m_Name));

                    if (!m_Mutex.WaitOne(10, false))
                    {
                        throw new Exception("Can't grab profile mutex, must be in use!");
                    }
                }
                catch
                {
                    //MessageBox.Show( Engine.ActiveWindow, Language.Format( LocString.ProfileInUse, m_Name ), "Profile In Use", MessageBoxButtons.OK, MessageBoxIcon.Warning );
                    //m_Warned = true;
                    return; // refuse to overwrite profiles that we don't own.
                }
            }

            XmlTextWriter xml;

            try
            {
                xml = new XmlTextWriter(file, Encoding.Default);
            }
            catch
            {
                return;
            }

            xml.Formatting  = Formatting.Indented;
            xml.IndentChar  = '\t';
            xml.Indentation = 1;

            xml.WriteStartDocument(true);
            xml.WriteStartElement("profile");

            foreach (KeyValuePair <string, object> de in m_Props)
            {
                xml.WriteStartElement("property");
                xml.WriteAttributeString("name", de.Key);
                if (de.Value == null)
                {
                    xml.WriteAttributeString("type", "-null-");
                }
                else
                {
                    xml.WriteAttributeString("type", de.Value.GetType().FullName);
                    xml.WriteString(de.Value.ToString());
                }

                xml.WriteEndElement();
            }

            xml.WriteStartElement("filters");
            Filter.Save(xml);
            xml.WriteEndElement();

            xml.WriteStartElement("counters");
            Counter.SaveProfile(xml);
            xml.WriteEndElement();

            xml.WriteStartElement("agents");
            Agent.SaveProfile(xml);
            xml.WriteEndElement();

            xml.WriteStartElement("dresslists");
            DressList.Save(xml);
            xml.WriteEndElement();

            xml.WriteStartElement("hotkeys");
            HotKey.Save(xml);
            xml.WriteEndElement();

            xml.WriteStartElement("passwords");
            PasswordMemory.Save(xml);
            xml.WriteEndElement();

            xml.WriteStartElement("overheadmessages");
            OverheadMessages.Save(xml);
            xml.WriteEndElement();

            xml.WriteStartElement("containerlabels");
            ContainerLabels.Save(xml);
            xml.WriteEndElement();

            xml.WriteStartElement("macrovariables");
            MacroVariables.Save(xml);
            xml.WriteEndElement();

            xml.WriteStartElement("scriptvariables");
            ScriptVariables.Save(xml);
            xml.WriteEndElement();

            xml.WriteStartElement("friends");
            FriendsManager.Save(xml);
            xml.WriteEndElement();

            xml.WriteStartElement("targetfilters");
            TargetFilterManager.Save(xml);
            xml.WriteEndElement();

            xml.WriteStartElement("soundfilters");
            SoundMusicManager.Save(xml);
            xml.WriteEndElement();

            xml.WriteEndElement(); // end profile section

            xml.Close();
        }
示例#6
0
文件: Config.cs 项目: sirdrunk/Razor
        public bool Load()
        {
            if (m_Name == null || m_Name.Trim() == "")
            {
                return(false);
            }

            string path = Config.GetUserDirectory("Profiles");
            string file = Path.Combine(path, String.Format("{0}.xml", m_Name));

            if (!File.Exists(file))
            {
                return(false);
            }

            XmlDocument doc = new XmlDocument();

            try
            {
                doc.Load(file);
            }
            catch
            {
                MessageBox.Show(Engine.ActiveWindow, Language.Format(LocString.ProfileCorrupt, file),
                                "Profile Load Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return(false);
            }

            XmlElement root = doc["profile"];

            if (root == null)
            {
                return(false);
            }

            Assembly exe = Assembly.GetCallingAssembly();

            if (exe == null)
            {
                return(false);
            }

            foreach (XmlElement el in root.GetElementsByTagName("property"))
            {
                try
                {
                    string name    = el.GetAttribute("name");
                    string typeStr = el.GetAttribute("type");
                    string val     = el.InnerText;

                    if (typeStr == "-null-" || name == "LimitSize" || name == "VisRange")
                    {
                        //m_Props[name] = null;
                        if (m_Props.ContainsKey(name))
                        {
                            m_Props.Remove(name);
                        }
                    }
                    else
                    {
                        Type type = Type.GetType(typeStr);
                        if (type == null)
                        {
                            type = exe.GetType(typeStr);
                        }

                        if (m_Props.ContainsKey(name) || name == "ForceSize")
                        {
                            if (type == null)
                            {
                                m_Props.Remove(name);
                            }
                            else
                            {
                                m_Props[name] = GetObjectFromString(val, type);
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show(Engine.ActiveWindow, Language.Format(LocString.ProfileLoadEx, e.ToString()),
                                    "Profile Load Exception", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }

            Filter.Load(root["filters"]);
            Counter.LoadProfile(root["counters"]);
            Agent.LoadProfile(root["agents"]);
            DressList.Load(root["dresslists"]);
            TargetFilterManager.Load(root["targetfilters"]);
            SoundMusicManager.Load(root["soundfilters"]);
            FriendsManager.Load(root["friends"]);
            HotKey.Load(root["hotkeys"]);
            PasswordMemory.Load(root["passwords"]);
            OverheadMessages.Load(root["overheadmessages"]);
            ContainerLabels.Load(root["containerlabels"]);
            MacroVariables.Load(root["macrovariables"]);
            //imports previous absolutetargets and doubleclickvariables if present in profile
            if ((root.SelectSingleNode("absolutetargets") != null) ||
                (root.SelectSingleNode("doubleclickvariables") != null))
            {
                MacroVariables.Import(root);
            }

            ScriptVariables.Load(root["scriptvariables"]);

            GoldPerHourTimer.Stop();
            DamageTracker.Stop();

            if (m_Props.ContainsKey("ForceSize"))
            {
                try
                {
                    int x, y;
                    switch ((int)m_Props["ForceSize"])
                    {
                    case 1:
                        x = 960;
                        y = 600;
                        break;

                    case 2:
                        x = 1024;
                        y = 768;
                        break;

                    case 3:
                        x = 1152;
                        y = 864;
                        break;

                    case 4:
                        x = 1280;
                        y = 720;
                        break;

                    case 5:
                        x = 1280;
                        y = 768;
                        break;

                    case 6:
                        x = 1280;
                        y = 800;
                        break;

                    case 7:
                        x = 1280;
                        y = 960;
                        break;

                    case 8:
                        x = 1280;
                        y = 1024;
                        break;

                    case 0:
                    default:
                        x = 800;
                        y = 600;
                        break;
                    }

                    SetProperty("ForceSizeX", x);
                    SetProperty("ForceSizeY", y);

                    if (x != 800 || y != 600)
                    {
                        SetProperty("ForceSizeEnabled", true);
                    }

                    m_Props.Remove("ForceSize");
                }
                catch
                {
                }
            }

            //if ( !Language.Load( GetString( "Language" ) ) )
            //	MessageBox.Show( Engine.ActiveWindow, "Warning: Could not load language from profile, using current language instead.", "Language Error", MessageBoxButtons.OK, MessageBoxIcon.Warning );

            return(true);
        }
示例#7
0
 public virtual void OnPointerExit(PointerEventData eventData)
 {
     Animator.SetBool("Selected", false);
     Animator.SetBool("Pressed", false);
     SoundMusicManager.PlayMainMenuSFX(MainMenuSFXs.buttonDeselected);
 }
 private void Play(AudioClip[] audioClips)
 {
     Play(SoundMusicManager.GetRandomAudioClip(audioClips));
     AudioSource.pitch = UnityEngine.Random.Range(0.85f, 1.15f);
 }