Inheritance: MonoBehaviour
コード例 #1
0
ファイル: LocalizeWidget.cs プロジェクト: wuxin0602/Nothing
    // Force-localize the widget.
    private void Localize(LanguageManager thisLanguage = null)
    {
        var w = GetComponent<UIWidget>();
        var lbl = w as UILabel;
        var sp = w as UISprite;

        var val = loc.GetTextValue(Key);
        if (string.IsNullOrEmpty(val))
        {
            val = "Missing String";
        }

        if (lbl != null)
        {
            // If this is a label used by input, we should localize its default value instead
            var input = NGUITools.FindInParents<UIInput>(lbl.gameObject);
            if (input != null && input.label == lbl)
            {
                input.defaultText = val;
            }
            else
            {
                lbl.text = val;
            }
        }
        else if (sp != null)
        {
            sp.spriteName = val;
            sp.MakePixelPerfect();
        }
    }
コード例 #2
0
 public static LanguageManager getInstance()
 {
     if(_instance == null){
         _instance = new LanguageManager();
     }
     return _instance;
 }
コード例 #3
0
        public void InitTables()
        {
            db.CreateTable<Language>();
            LanguageManager langManager = new LanguageManager(db);
            langManager.InitDefaultData();

            db.CreateTable<TranslateProvider>();

            db.CreateTable<Direction>();
            DirectionManager managerDirection = new DirectionManager(db);
            managerDirection.InitDefaultData();

            db.CreateTable<TranslateProvider>();
            TranslateProviderManager managerProvider = new TranslateProviderManager(db);
            managerProvider.InitDefaultData();

            db.CreateTable<Favorites>();

            db.CreateTable<SourceExpression>();
            //SourceExpressionManager managerSourceExpression = new SourceExpressionManager(db);
            //managerSourceExpression.InitDefaultData();

            db.CreateTable<TranslatedExpression>();

            db.CreateTable<DefinitionTypes>();
            DefinitionTypesManager managerTypes = new DefinitionTypesManager(db);
            managerTypes.InitDefaultData();

            db.CreateTable<SourceDefinition>();

            db.CreateTable<Chat>();

            db.CreateTable<ChatHistory>();
        }
コード例 #4
0
ファイル: Tutorial.cs プロジェクト: penspanic/SpaceOdyssey
 void Awake()
 {
     if(languageMgr == null)
         languageMgr = GameObject.FindObjectOfType<LanguageManager>();
     if(gameMgr == null)
         gameMgr = GameObject.FindObjectOfType<GameManager>();
 }
コード例 #5
0
	void Start () 
	{
		languageManager = LanguageManager.Instance;
		
		SmartCultureInfo deviceCulture = languageManager.GetDeviceCultureIfSupported();
		if(deviceCulture != null)
		{
			languageManager.ChangeLanguage(deviceCulture);	
		}
		else
		{
			Debug.Log("The device language is not available in the current application. Loading default."); 
		}
		
		if(languageManager.NumberOfSupportedLanguages > 0)
		{
			currentLanguageKeys = languageManager.GetAllKeys();
			availableLanguages = languageManager.GetSupportedLanguages();
		}
		else
		{
			Debug.LogError("No languages are created!, Open the Smart Localization plugin at Window->Smart Localization and create your language!");
		}

		LanguageManager.Instance.OnChangeLanguage += OnLanguageChanged;
	}
コード例 #6
0
 void OnEnable()
 {
     if(!Application.isEditor || Application.isPlaying)
         _languageManager = LanguageManager.Instance;
     foreach(var alternative in alternatives)
         alternative.Initialize();
 }
		public LanguageManagerWrapper(LanguageManager languageManager)
		{
			if(languageManager == null)
				throw new ArgumentNullException("languageManager");

			this._languageManager = languageManager;
		}
 void OnLanguageChanged(LanguageManager languageManager)
 {
     dropdown.options.Clear();
     foreach(var options in optionData){
         dropdown.options.Add(new Dropdown.OptionData(languageManager.GetTextValue(options.text), options.image));
     }
 }
コード例 #9
0
ファイル: UseBoosterText.cs プロジェクト: spilist/shoong
 void OnChangeLanguage(LanguageManager languageManager)
 {
   description = LanguageManager.Instance.GetTextValue("Tutorial_UseBooster");
   text.text = description + " 0/" + limit;
   text.font = LangManager.lm.getFont();
   text.fontSize = (int)(origFontSize * LangManager.lm.getFontScale());
 }
コード例 #10
0
ファイル: StartMenuGUI.cs プロジェクト: harecu/ECO
    void Start()
    {
        langManager = LanguageManager.Instance;

        string systemLang = langManager.GetSystemLanguage();
        if(langManager.IsLanguageSupported(systemLang))
            langManager.SetDefaultLanguage(systemLang);
    }
コード例 #11
0
 void InitializationAndLocalization() {
     // Inicilización del gestor
     languageManager = LanguageManager.Instance;
     languageManager.ChangeLanguage(_language);
     languageManager.OnChangeLanguage += OnChangeLanguage;
     // Localización de la escena
     sceneName = SceneManager.GetActiveScene().name;
     LocalizateScene(sceneName);
 }
コード例 #12
0
 public void TestMust_Get2ChatsForLastDays()
 {
     var db = new MockSQLite();
     var languageManager = new LanguageManager(db);
     var chatHistoryManager = new ChatHistoryManager(db);
     var chatManager = new ChatManager(db, languageManager, chatHistoryManager);
     var list = chatManager.GetChatsForLastDays(5);
     Assert.IsTrue(list.Count == 2);
 }
コード例 #13
0
    void Start()
    {
        //Subscribe to the change language event
        thisLanguageManager = LanguageManager.Instance;
        thisLanguageManager.addLanguageChangedListener(OnChangeLanguage);

        //Run the method one first time
        OnChangeLanguage(thisLanguageManager);
    }
コード例 #14
0
 /// <summary>
 /// Основной конструктор
 /// </summary>
 /// <param name="view"></param>
 /// <param name="db"></param>
 /// <param name="selectedChatID"></param>
 public DictionaryChatPresenter(IDictionaryChatView view, ISQLiteTesting db, int selectedChatID)
 {
     this.view = view;
     this.db = db;
     this.selectedChatID = selectedChatID;
     LanguageManager languageManager = new LanguageManager(db);
     this.chatHistoryManager = new ChatHistoryManager(db);
     this.chatManager = new ChatManager(db, languageManager, chatHistoryManager);
     this.languageManager = new LanguageManager(db);
 }
コード例 #15
0
ファイル: BarItem.cs プロジェクト: wuxin0602/Nothing
 /// <summary>
 /// Initialize the current bar item.
 /// </summary>
 /// <param name="itemNameKey">The name of the bar item.</param>
 public virtual void Init(string itemNameKey)
 {
     if(loc == null)
     {
         loc = LanguageManager.Instance;
     }
     var itemName = loc.GetTextValue(itemNameKey);
     BarItemName = itemName;
     DescName = itemName;
 }
コード例 #16
0
ファイル: LocalText.cs プロジェクト: spilist/shoong
  void OnChangeLanguage(LanguageManager languageManager)
  {
    if (key != "") {
      origString = LanguageManager.Instance.GetTextValue(key);
      textObject.text = origString;
    }

    textObject.font = LangManager.lm.getFont();
    textObject.fontSize = (int)(origFontSize * LangManager.lm.getFontScale());
  }
コード例 #17
0
    void OnChangeLanguage(LanguageManager thisLanguageManager)
    {
        //Initialize all your language specific variables here
        thisAudioClip = thisLanguageManager.GetAudioClip(localizedKey);

        if(thisAudioSource != null)
        {
            thisAudioSource.clip = thisAudioClip;
        }
    }
コード例 #18
0
ファイル: LanguageSingleton.cs プロジェクト: Arafo/Syncopia
    public static void InstanceLanguage(bool newLang = false)
    {
        if (_instance == null) {
            _instance = new LanguageManager(Path.Combine(Application.dataPath, file), GameSettings.G_LANGUAGE.ToDescription());
        }

        // Cambio de idioma
        if (newLang && _instance != null)
            _instance.setLanguage(Path.Combine(Application.dataPath, file), GameSettings.G_LANGUAGE.ToDescription());
    }
コード例 #19
0
    void Awake()
    {
        languageMgr = GameObject.FindObjectOfType<LanguageManager>();
        tutorial = GameObject.FindObjectOfType<Tutorial>();

        riseEndY = transform.position.y + moveDistance / 2;
        fallEndY = transform.position.y - moveDistance / 2;


    }
コード例 #20
0
ファイル: LocalizeWidget.cs プロジェクト: wuxin0602/Nothing
    // Localize the widget on start.
    private void Start()
    {
        // Reference the language manager
        loc = LanguageManager.Instance;

        // Hook up a delegate to run the localize script whenever a language was changed
        loc.OnChangeLanguage += Localize;

        // Initial localize run
        Localize();
    }
コード例 #21
0
ファイル: Pause.cs プロジェクト: Reigninwild/Calculator
    // Use this for initialization
    void Start()
    {
        languageManager = LanguageManager.Instance;
        languageManager.OnChangeLanguage += OnLanguageChanged;

        SmartCultureInfo systemLanguage = languageManager.GetSupportedSystemLanguage();
        if (systemLanguage != null)
        {
            languageManager.ChangeLanguage(systemLanguage);
        }
    }
コード例 #22
0
ファイル: UIManager.cs プロジェクト: penspanic/SpaceOdyssey
    void Awake()
    {
        audioSource = GetComponent<AudioSource>();
        player = GameObject.FindObjectOfType<Player>();
        dm = GameObject.FindObjectOfType<DataManager>();
        gm = GameObject.FindObjectOfType<GameManager>();
        sectorMgr = GameObject.FindObjectOfType<SectorManager>();
        languageMgr = GameObject.FindObjectOfType<LanguageManager>();
        selectButtonText = selectButton.GetComponentInChildren<Text>();

        NotifyLanguageUsable();
    }
コード例 #23
0
 public List<LanguageViewModel> GetLanguages()
 {
     try
     {
         LanguageManager mn = new LanguageManager();
         return Converter.ToViewModel(mn.GetLanguage());
     }
     catch (Exception ex)
     {
         return null;
     }
 }
コード例 #24
0
 public LanguageViewModel GetSelectedLanguage()
 {
     try
     {
         LanguageManager mn = new LanguageManager();
         return Converter.ToViewModel(mn.GetLanguageByCultureName(CultureHelper.GetCurrentCulture()));
     }
     catch (Exception ex)
     {
         return null;
     }
 }
コード例 #25
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            base.ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;

            var languageManager = new LanguageManager(SqlLiteInstance.DB);
            var chatHistoryManager = new ChatHistoryManager(SqlLiteInstance.DB);
            presenter = new DirectionsPresenter(this, new ChatManager(SqlLiteInstance.DB, languageManager, chatHistoryManager), languageManager);

            addTab("Recent", Resource.Layout.DirectionsRecent, new Action(()=> presenter.SelectedRecentLanguagesEvent()));
            addTab("All languages", Resource.Layout.DirectionsAll, new Action(()=> presenter.SelectedAllLanguagesEvent(Locale.Default.Language)));
        }
コード例 #26
0
    void Start()
    {
        textMesh=GetComponent<TextMesh>();

        if (textMesh!=null)
        {
            //Subscribe to the change language event
            thisLanguageManager = LanguageManager.Instance;
            thisLanguageManager.addLanguageChangedListener(OnChangeLanguage);

            //Run the method one first time
            OnChangeLanguage(thisLanguageManager);
        }
    }
コード例 #27
0
ファイル: Tutorial.cs プロジェクト: gamesatqu/ABG-Rush
    private void Init()
    {
        currentSlide = 0;
        totalSlides = spritesTutorial.Length;
        if (LanguageManager._LanguageManager)
        {
            lm = LanguageManager._LanguageManager;
        }
        else
        {
            lm = null;
        }

        initialized = true;
    }
コード例 #28
0
ファイル: LocalizatedUIText.cs プロジェクト: Oxy949/Obscended
    // Use this for initialization
    void Start () {
        lmanager = LanguageManager.Instance;
        string lang = "en";
        try
        {
            //lang = SteamApps.GetCurrentGameLanguage().Substring(0, 2);
        }
        catch (Exception e)
        {
            Debug.Log(e.ToString());
        }

        lmanager.ChangeLanguage(lang);
        text = GetComponent<Text>();

    }
コード例 #29
0
        public void TestMust_GetListAllDirections()
        {
            //arrange
            var db = new MockSQLite();
            var languageManager = new LanguageManager(db);
            var mockView = new MockDirectionsView();
            var chatHistoryManager = new ChatHistoryManager(db);
            var presenter = new DirectionsPresenter(mockView, new ChatManager(db, languageManager, chatHistoryManager), languageManager);

            //act
            presenter.SelectedAllLanguagesEvent("en");

            //assert
            Assert.GreaterOrEqual(6, mockView.listLanguages.Count, "Количество элементов меньше ожидаемого");
            Assert.IsTrue(mockView.listLanguages.Exists(i => i.NameLocal == "Русский"), "В коллекции нет Русского языка, а должен быть");
            Assert.IsTrue(mockView.listLanguages.Exists(i => i.NameLocal == "English"), "В коллекции нет Английского языка, а должен быть");
        }
コード例 #30
0
        public void TestMust_GetListRecentDirections()
        {
            //arrange
            var db = new MockSQLite();
            var languageManager = new LanguageManager(db);
            var mockView = new MockDirectionsView();
            var chatHistoryManager = new ChatHistoryManager(db);
            var presenter = new DirectionsPresenter(mockView, new ChatManager(db, languageManager, chatHistoryManager), languageManager);

            //act
            presenter.SelectedRecentLanguagesEvent();

            //assert
            Assert.AreEqual(2, mockView.listDirectionsRecent.Count);
            Assert.AreEqual(1, mockView.listDirectionsRecent[0].ChatId);//порядок важен
            Assert.AreEqual(2, mockView.listDirectionsRecent[1].ChatId);//порядок важен
        }
コード例 #31
0
        public override bool TakeAction()
        {
            TaskStar taskOpsStar = TaskStar.Star1;

            userLv         = ContextUser.UserLv;
            this.ErrorCode = ops;
            if (ops == 1)
            {
                if (!VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.RefreashDailyTask))
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St_VipNotEnoughNotFuntion;
                    return(false);
                }
                List <UserTask> taskArray = new GameDataCacheSet <UserTask>().FindAll(ContextUser.UserID, u => u.TaskState == TaskState.AllowTake && u.TaskType == TaskType.Daily);
                if (taskArray.Count > 0)
                {
                    if (taskArray[0].TaskStar == TaskStar.Star5)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St3005_RefreashStarFull;
                        return(false);
                    }
                }
                ErrorInfo = string.Format(LanguageManager.GetLang().St3005_RefreashUseGold, useProGold);
                return(false);
            }
            else if (ops == 2)
            {
                if (ContextUser.GoldNum < useProGold)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
                    return(false);
                }

                List <UserTask> taskArray = new GameDataCacheSet <UserTask>().FindAll(ContextUser.UserID, u => u.TaskState != TaskState.Disable && u.TaskType == TaskType.Daily);
                if (taskArray.Count > 0)
                {
                    taskOpsStar = TaskHelper.GetTaskStar(taskArray[0].TaskStar, taskArray[0].TakeDate);
                }
                foreach (UserTask taskInfo in taskArray)
                {
                    taskInfo.TaskStar = taskOpsStar;
                    //taskInfo.Update();
                }
                ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, useProGold, int.MaxValue);
                //ContextUser.Update();
                if (taskArray.Count > 0)
                {
                    userTaskList = taskArray;
                    //UserTask userTask = taskArray[0];
                    //刷新任务
                    //userTaskList = TaskHelper.RefreshDailyTask(ContextUser.UserID, userTask);
                }
            }
            else if (ops == 3)
            {
                if (!VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.ShuanChuMaxXingJiRenWu))
                {
                    this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                    this.ErrorInfo = LanguageManager.GetLang().St_VipNotEnoughNotFuntion;
                    return(false);
                }
                this.ErrorInfo = string.Format(LanguageManager.GetLang().St3005_RefreashUseGold, useFullGold);
                return(false);
            }
            else if (ops == 4)
            {
                if (ContextUser.GoldNum < useFullGold)
                {
                    this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                    this.ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
                    return(false);
                }

                taskOpsStar = TaskStar.Star5;
                List <UserTask> taskArray = new GameDataCacheSet <UserTask>().FindAll(ContextUser.UserID, u => u.TaskState == TaskState.AllowTake && u.TaskType == TaskType.Daily);

                foreach (UserTask taskInfo in taskArray)
                {
                    taskInfo.TaskStar = taskOpsStar;
                    //taskInfo.Update();
                }
                if (taskArray.Count > 0)
                {
                    UserTask userTask = taskArray[0];
                    //刷新任务
                    userTaskList = TaskHelper.RefreshDailyTask(ContextUser.UserID, userTask);
                }

                ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, useFullGold, int.MaxValue);
                //ContextUser.Update();
            }
            else if (ops == 5)
            {
                if (!VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.DailyRenWuZhiJieWanCheng))
                {
                    this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                    this.ErrorInfo = LanguageManager.GetLang().St_VipNotEnoughNotFuntion;
                    return(false);
                }
                this.ErrorInfo = string.Format(LanguageManager.GetLang().St3005_CompletedUseGold, completedUseGold);
                return(false);
            }
            else if (ops == 6)
            {
                if (ContextUser.GoldNum < completedUseGold)
                {
                    this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                    this.ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
                    return(false);
                }

                List <UserTask> taskArray = new GameDataCacheSet <UserTask>().FindAll(ContextUser.UserID, u => u.TaskState == TaskState.Taked && u.TaskType == TaskType.Daily);
                if (taskArray.Count > 0)
                {
                    UserTask      userTask  = taskArray[0];
                    DailyTaskInfo dtaskInfo = new ConfigCacheSet <DailyTaskInfo>().FindKey(taskArray[0].TaskID);
                    //交付任务

                    //奖励
                    int userExp = ContextUser.ExpNum;
                    int expNum  = userTask.GetDailyExpNum(userLv);
                    ContextUser.ExpNum = MathUtils.Addition(ContextUser.ExpNum, expNum, int.MaxValue);
                    //ContextUser.Update();
                    var userItem = userTask.GetDailyItem(userLv);
                    if (userItem != null)
                    {
                        UserItemHelper.AddUserItem(ContextUser.UserID, userItem.ItemID, userItem.Num);
                    }
                    userTask.TaskState   = TaskState.Close;
                    userTask.CompleteNum = MathUtils.Addition(userTask.CompleteNum, 1, int.MaxValue);
                    //userTask.Update();
                    //奖励日志
                    UserTaskLog taskLog = new UserTaskLog()
                    {
                        LogID     = System.Guid.NewGuid().ToString(),
                        TaskID    = userTask.TaskID,
                        UserID    = userTask.UserID,
                        TaskType  = userTask.TaskType,
                        TaskState = userTask.TaskState,
                        TaskPrize = string.Format("ExpNum:{0},item:{1}={2};User expnum:{3}", expNum,
                                                  userItem != null ? userItem.ItemID : 0,
                                                  userItem != null ? userItem.Num : 0,
                                                  userExp
                                                  ),
                        CreateDate = DateTime.Now
                    };
                    var sender = DataSyncManager.GetDataSender();
                    sender.Send(taskLog);
                    //刷新任务
                    userTaskList = TaskHelper.RefreshDailyTask(ContextUser.UserID, userTask);

                    ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, completedUseGold, int.MaxValue);
                    //ContextUser.Update();
                }
            }
            else if (ops == 0)
            {
                if (TaskID > 0)
                {
                    UserTask userTask = new GameDataCacheSet <UserTask>().FindKey(ContextUser.UserID, TaskID);
                    if (userTask == null || userTask.TaskState != TaskState.Completed)
                    {
                        this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                        this.ErrorInfo = LanguageManager.GetLang().St3007_NoCompleted;
                        return(false);
                    }
                    if (TaskHelper.GetTaskCompleteNum(ContextUser.UserID) >= TaskHelper.DailyEveryMaxNum)
                    {
                        this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                        this.ErrorInfo = LanguageManager.GetLang().St3005_CompletedTimeout;
                        return(false);
                    }
                    DailyTaskInfo dtaskInfo = new ConfigCacheSet <DailyTaskInfo>().FindKey(userTask.TaskID);
                    //交付任务

                    //奖励
                    int userExp = ContextUser.ExpNum;
                    int expNum  = userTask.GetDailyExpNum(userLv);
                    ContextUser.ExpNum = MathUtils.Addition(ContextUser.ExpNum, expNum, int.MaxValue);
                    //ContextUser.Update();
                    var userItem = userTask.GetDailyItem(userLv);
                    if (userItem != null)
                    {
                        UserItemHelper.AddUserItem(ContextUser.UserID, userItem.ItemID, userItem.Num);
                    }
                    userTask.TaskState   = TaskState.Close;
                    userTask.CompleteNum = MathUtils.Addition(userTask.CompleteNum, 1, int.MaxValue);
                    //userTask.Update();
                    //奖励日志
                    UserTaskLog taskLog = new UserTaskLog()
                    {
                        LogID     = System.Guid.NewGuid().ToString(),
                        TaskID    = userTask.TaskID,
                        UserID    = userTask.UserID,
                        TaskType  = userTask.TaskType,
                        TaskState = userTask.TaskState,
                        TaskPrize = string.Format("ExpNum:{0},item:{1}={2};User expnum:{3}", expNum,
                                                  userItem != null ? userItem.ItemID : 0,
                                                  userItem != null ? userItem.Num : 0,
                                                  userExp
                                                  ),
                        CreateDate = DateTime.Now
                    };

                    var sender = DataSyncManager.GetDataSender();
                    sender.Send(taskLog);
                    //刷新任务
                    userTaskList = TaskHelper.RefreshDailyTask(ContextUser.UserID, userTask);
                }
                else
                {
                    //刷新当天任务
                    if (!TaskHelper.CheckDailyTaskTimeout(ContextUser.UserID, out userTaskList))
                    {
                        userTaskList = new GameDataCacheSet <UserTask>().FindAll(ContextUser.UserID,
                                                                                 m => m.TaskType.Equals(TaskType.Daily) &&
                                                                                 !m.TaskState.Equals(TaskState.NoTake) &&
                                                                                 !m.TaskState.Equals(TaskState.Disable)
                                                                                 );
                    }

                    if (userTaskList.Count == 0)
                    {
                        //初始化时刷新任务
                        userTaskList = TaskHelper.RefreshDailyTask(ContextUser.UserID, null);
                    }

                    //刷新状态
                    foreach (UserTask userTask in userTaskList)
                    {
                        bool isModify = false;

                        if (userTask.TaskState == TaskState.Taked &&
                            userTask.TaskTargetNum.ToInt() >= (int)userTask.TaskStar)
                        {
                            isModify           = true;
                            userTask.TaskState = TaskState.Completed;
                        }
                        if (isModify)
                        {
                            //userTask.Update();
                        }
                    }
                }
            }

            //计算当天完成次数
            currNum = TaskHelper.GetTaskCompleteNum(ContextUser.UserID);
            return(true);
        }
コード例 #32
0
        private void cmdBurnEdge_Click(object sender, EventArgs e)
        {
            // Edge cannot go below 1.
            if (AttributeObject.Value <= 0)
            {
                Program.MainForm.ShowMessageBox(LanguageManager.GetString("Message_CannotBurnEdge"), LanguageManager.GetString("MessageTitle_CannotBurnEdge"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            // Verify that the user wants to Burn a point of Edge.
            if (Program.MainForm.ShowMessageBox(LanguageManager.GetString("Message_BurnEdge"), LanguageManager.GetString("MessageTitle_BurnEdge"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            AttributeObject.Degrade(1);
            ValueChanged?.Invoke(this, e);
        }
コード例 #33
0
        public KnowledgeSkillControl(KnowledgeSkill skill)
        {
            _skill = skill;
            InitializeComponent();

            LanguageManager.TranslateWinForm(GlobalOptions.Language, this);

            //Display
            lblModifiedRating.DoDatabinding("Text", skill, nameof(KnowledgeSkill.DisplayPool));
            lblModifiedRating.DoDatabinding("ToolTipText", skill, nameof(KnowledgeSkill.PoolToolTip));

            List <ListItem> lstTypes = KnowledgeSkill.KnowledgeTypes(GlobalOptions.Language).ToList();

            lstTypes.Sort(CompareListItems.CompareNames);

            cboType.BeginUpdate();
            cboSkill.BeginUpdate();
            cboSpec.BeginUpdate();
            cboType.DataSource    = lstTypes;
            cboType.DisplayMember = nameof(ListItem.Name);
            cboType.ValueMember   = nameof(ListItem.Value);
            cboType.DataBindings.Add("SelectedValue", skill, nameof(KnowledgeSkill.Type), false, DataSourceUpdateMode.OnPropertyChanged);

            nudSkill.Visible = !skill.CharacterObject.Created && skill.CharacterObject.SkillsSection.HasKnowledgePoints;
            nudKarma.Visible = !skill.CharacterObject.Created;
            chkKarma.Visible = !skill.CharacterObject.Created;
            cboSpec.Visible  = !skill.CharacterObject.Created;
            //cboType.Visible = !skill.CharacterObject.Created;

            btnCareerIncrease.Visible = skill.CharacterObject.Created;
            lblSpec.Visible           = skill.CharacterObject.Created;
            btnAddSpec.Visible        = skill.CharacterObject.Created;
            lblRating.Visible         = skill.CharacterObject.Created;

            if (skill.CharacterObject.Created)
            {
                nudKarma.Visible = false;
                nudSkill.Visible = false;

                lblRating.Visible = true;
                lblRating.DataBindings.Add("Text", skill, nameof(Skill.Rating), false, DataSourceUpdateMode.OnPropertyChanged);

                //New knowledge skills start at 0. Leave the Type selector unlocked until they spend Karma on the skill.
                cboType.Enabled = (skill.Karma == 0 && skill.Base == 0 || string.IsNullOrWhiteSpace(_skill.Type));

                lblName.Visible = true;
                lblName.DataBindings.Add("Text", skill, nameof(KnowledgeSkill.WriteableName), false, DataSourceUpdateMode.OnPropertyChanged);
                lblName.DataBindings.Add("ForeColor", skill, nameof(Skill.PreferredColor));
                lblName.DataBindings.Add("ToolTipText", skill, nameof(Skill.SkillToolTip));

                lblSpec.Visible = true;
                lblSpec.DataBindings.Add("Text", skill, nameof(Skill.DisplaySpecialization), false, DataSourceUpdateMode.OnPropertyChanged);

                cboSkill.Visible = false;
                chkKarma.Visible = false;
                cboSpec.Visible  = false;

                lblModifiedRating.Location = new Point(294 - 30, 4);

                btnAddSpec.DataBindings.Add("Enabled", skill, nameof(Skill.CanAffordSpecialization), false, DataSourceUpdateMode.OnPropertyChanged);
                btnAddSpec.DataBindings.Add("Visible", skill, nameof(Skill.CanHaveSpecs), false, DataSourceUpdateMode.OnPropertyChanged);
                btnAddSpec.DataBindings.Add("ToolTipText", skill, nameof(Skill.AddSpecToolTip), false, DataSourceUpdateMode.OnPropertyChanged);
                btnCareerIncrease.DataBindings.Add("Enabled", skill, nameof(Skill.CanUpgradeCareer), false, DataSourceUpdateMode.OnPropertyChanged);
                btnCareerIncrease.DataBindings.Add("ToolTipText", skill, nameof(Skill.UpgradeToolTip), false, DataSourceUpdateMode.OnPropertyChanged);
            }
            else
            {
                //Up down boxes
                nudKarma.DataBindings.Add("Value", skill, nameof(Skill.Karma), false, DataSourceUpdateMode.OnPropertyChanged);
                nudKarma.DataBindings.Add("InterceptMouseWheel", skill.CharacterObject.Options, nameof(CharacterOptions.InterceptMode), false, DataSourceUpdateMode.OnPropertyChanged);

                nudSkill.DataBindings.Add("Value", skill, nameof(Skill.Base), false, DataSourceUpdateMode.OnPropertyChanged);
                nudSkill.DataBindings.Add("Enabled", skill.CharacterObject.SkillsSection, nameof(SkillsSection.HasKnowledgePoints), false, DataSourceUpdateMode.OnPropertyChanged);
                nudSkill.DataBindings.Add("InterceptMouseWheel", skill.CharacterObject.Options, nameof(CharacterOptions.InterceptMode), false, DataSourceUpdateMode.OnPropertyChanged);

                chkKarma.DataBindings.Add("Checked", skill, nameof(Skill.BuyWithKarma), false,
                                          DataSourceUpdateMode.OnPropertyChanged);
                List <ListItem> lstDefaultKnowledgeSkills = KnowledgeSkill.DefaultKnowledgeSkills(GlobalOptions.Language).ToList();
                lstDefaultKnowledgeSkills.Sort(CompareListItems.CompareNames);
                cboSkill.DataSource    = lstDefaultKnowledgeSkills;
                cboSkill.DisplayMember = nameof(ListItem.Name);
                cboSkill.ValueMember   = nameof(ListItem.Value);
                cboSkill.SelectedIndex = -1;
                cboSkill.DataBindings.Add("Text", skill, nameof(KnowledgeSkill.WriteableName), false, DataSourceUpdateMode.OnPropertyChanged);

                //dropdown/spec
                cboSpec.DataSource    = skill.CGLSpecializations;
                cboSpec.DisplayMember = nameof(ListItem.Name);
                cboSpec.ValueMember   = nameof(ListItem.Value);
                cboSpec.SelectedIndex = -1;

                if (skill.ForcedName)
                {
                    cboSpec.Enabled = false;
                }
                else
                {
                    cboSpec.DataBindings.Add("Enabled", skill, nameof(Skill.CanHaveSpecs), false, DataSourceUpdateMode.OnPropertyChanged);
                }
                cboSpec.DataBindings.Add("Text", skill, nameof(Skill.Specialization), false, DataSourceUpdateMode.OnPropertyChanged);

                skill.PropertyChanged += Skill_PropertyChanged;
            }

            if (skill.ForcedName)
            {
                DataBindings.Add("Enabled", skill, nameof(KnowledgeSkill.Enabled), false, DataSourceUpdateMode.OnPropertyChanged);

                nudKarma.Visible          = false;
                nudSkill.Visible          = false;
                cboSkill.Enabled          = false;
                chkKarma.Visible          = false;
                btnAddSpec.Enabled        = false;
                btnCareerIncrease.Enabled = false;

                if (!skill.CharacterObject.Created)
                {
                    cboType.Enabled   = string.IsNullOrEmpty(_skill.Type);
                    lblRating.Visible = true;
                    lblRating.DataBindings.Add("Text", skill, nameof(Skill.Rating), false, DataSourceUpdateMode.OnPropertyChanged);
                }

                cmdDelete.Visible = false;
            }
            else
            {
                cmdDelete.Click += (sender, args) =>
                {
                    skill.UnbindSkill();
                    skill.CharacterObject.SkillsSection.KnowledgeSkills.Remove(skill);
                };
            }
            cboType.EndUpdate();
            cboSkill.EndUpdate();
            cboSpec.EndUpdate();
        }
コード例 #34
0
ファイル: SkillControl2.cs プロジェクト: nebeker/chummer5a
        public SkillControl2(Skill objSkill)
        {
            if (objSkill == null)
            {
                return;
            }
            _objSkill           = objSkill;
            _objAttributeActive = objSkill.AttributeObject;
            InitializeComponent();
            SkillControl2_DpiChangedAfterParent(null, EventArgs.Empty);
            this.UpdateLightDarkMode();
            this.TranslateWinForm();

            foreach (ToolStripItem tssItem in cmsSkillLabel.Items)
            {
                tssItem.UpdateLightDarkMode();
                tssItem.TranslateToolStripItemsRecursively();
            }

            SuspendLayout();

            //Display
            _fntNormalName = lblName.Font;
            _fntItalicName = new Font(_fntNormalName, FontStyle.Italic);
            _fntNormal     = btnAttribute.Font;
            _fntItalic     = new Font(_fntNormal, FontStyle.Italic);

            if (!_objSkill.Default)
            {
                lblName.Font = _fntItalicName;
            }
            lblName.DoOneWayDataBinding("Text", objSkill, nameof(Skill.CurrentDisplayName));
            lblName.DoOneWayDataBinding("ForeColor", objSkill, nameof(Skill.PreferredColor));
            lblName.DoOneWayDataBinding("ToolTipText", objSkill, nameof(Skill.HtmlSkillToolTip));

            btnAttribute.DoOneWayDataBinding("Text", objSkill, nameof(Skill.DisplayAttribute));

            lblModifiedRating.Text        = objSkill.DisplayOtherAttribute(_objAttributeActive.Abbrev);
            lblModifiedRating.ToolTipText = objSkill.CompileDicepoolTooltip(_objAttributeActive.Abbrev);

            // Creating controls outside of the designer saves on handles if the controls would be invisible anyway
            if (objSkill.AllowDelete) // For active skills, can only change by going from Create to Career mode, so no databinding necessary
            {
                cmdDelete = new Button
                {
                    AutoSize                = true,
                    AutoSizeMode            = AutoSizeMode.GrowAndShrink,
                    Dock                    = DockStyle.Fill,
                    Margin                  = new Padding(3, 0, 3, 0),
                    Name                    = "cmdDelete",
                    Tag                     = "String_Delete",
                    Text                    = "Delete",
                    UseVisualStyleBackColor = true
                };
                cmdDelete.Click += cmdDelete_Click;
                cmdDelete.UpdateLightDarkMode();
                cmdDelete.TranslateWinForm();
                tlpRight.Controls.Add(cmdDelete, 4, 0);
            }

            int intMinimumSize;

            using (Graphics g = CreateGraphics())
                intMinimumSize = (int)(25 * g.DpiX / 96.0f);

            if (objSkill.CharacterObject.Created)
            {
                lblCareerRating = new Label
                {
                    Anchor      = AnchorStyles.Right,
                    AutoSize    = true,
                    MinimumSize = new Size(intMinimumSize, 0),
                    Name        = "lblCareerRating",
                    Text        = "00",
                    TextAlign   = ContentAlignment.MiddleRight
                };
                btnCareerIncrease = new ButtonWithToolTip
                {
                    Anchor                  = AnchorStyles.Right,
                    AutoSize                = true,
                    AutoSizeMode            = AutoSizeMode.GrowAndShrink,
                    Image                   = Resources.add,
                    Margin                  = new Padding(3, 0, 3, 0),
                    Name                    = "btnCareerIncrease",
                    Padding                 = new Padding(1),
                    UseVisualStyleBackColor = true
                };
                btnCareerIncrease.Click += btnCareerIncrease_Click;

                lblCareerRating.DoOneWayDataBinding("Text", objSkill, nameof(Skill.Rating));
                btnCareerIncrease.DoOneWayDataBinding("Enabled", objSkill, nameof(Skill.CanUpgradeCareer));
                btnCareerIncrease.DoOneWayDataBinding("ToolTipText", objSkill, nameof(Skill.UpgradeToolTip));

                lblCareerRating.UpdateLightDarkMode();
                lblCareerRating.TranslateWinForm();
                btnCareerIncrease.UpdateLightDarkMode();
                btnCareerIncrease.TranslateWinForm();
                tlpMain.Controls.Add(lblCareerRating, 2, 0);
                tlpMain.Controls.Add(btnCareerIncrease, 3, 0);

                btnAddSpec = new ButtonWithToolTip
                {
                    Anchor                  = AnchorStyles.Right,
                    AutoSize                = true,
                    AutoSizeMode            = AutoSizeMode.GrowAndShrink,
                    Image                   = Resources.add,
                    Margin                  = new Padding(3, 0, 3, 0),
                    Name                    = "btnAddSpec",
                    Padding                 = new Padding(1),
                    UseVisualStyleBackColor = true
                };
                btnAddSpec.Click += btnAddSpec_Click;
                lblCareerSpec     = new Label
                {
                    Anchor    = AnchorStyles.Left,
                    AutoSize  = true,
                    Name      = "lblCareerSpec",
                    Text      = "[Specializations]",
                    TextAlign = ContentAlignment.MiddleLeft
                };
                lblCareerSpec.DoOneWayDataBinding("Text", objSkill, nameof(Skill.CurrentDisplaySpecialization));
                btnAddSpec.DoOneWayDataBinding("Enabled", objSkill, nameof(Skill.CanAffordSpecialization));
                btnAddSpec.DoDatabinding("Visible", objSkill, nameof(Skill.CanHaveSpecs));
                btnAddSpec.DoOneWayDataBinding("ToolTipText", objSkill, nameof(Skill.AddSpecToolTip));

                lblCareerSpec.UpdateLightDarkMode();
                lblCareerSpec.TranslateWinForm();
                btnAddSpec.UpdateLightDarkMode();
                btnAddSpec.TranslateWinForm();
                tlpRight.Controls.Add(lblCareerSpec, 0, 0);
                tlpRight.Controls.Add(btnAddSpec, 1, 0);

                List <ListItem> lstAttributeItems = new List <ListItem>(AttributeSection.AttributeStrings.Count);
                foreach (string strLoopAttribute in AttributeSection.AttributeStrings)
                {
                    if (strLoopAttribute == "MAGAdept")
                    {
                        if (!objSkill.CharacterObject.Options.MysAdeptSecondMAGAttribute)
                        {
                            continue;
                        }
                        lstAttributeItems.Add(new ListItem(strLoopAttribute, LanguageManager.MAGAdeptString()));
                    }
                    else
                    {
                        string strAttributeShort = LanguageManager.GetString("String_Attribute" + strLoopAttribute + "Short", GlobalOptions.Language, false);
                        lstAttributeItems.Add(new ListItem(strLoopAttribute, !string.IsNullOrEmpty(strAttributeShort) ? strAttributeShort : strLoopAttribute));
                    }
                }

                cboSelectAttribute = new ElasticComboBox
                {
                    Anchor            = AnchorStyles.Left | AnchorStyles.Right,
                    DropDownStyle     = ComboBoxStyle.DropDownList,
                    FormattingEnabled = true,
                    Margin            = new Padding(3, 0, 3, 0),
                    Name = "cboSelectAttribute"
                };
                cboSelectAttribute.DropDownClosed += cboSelectAttribute_Closed;
                cboSelectAttribute.BeginUpdate();
                cboSelectAttribute.DataSource    = null;
                cboSelectAttribute.DataSource    = lstAttributeItems;
                cboSelectAttribute.DisplayMember = nameof(ListItem.Name);
                cboSelectAttribute.ValueMember   = nameof(ListItem.Value);
                cboSelectAttribute.SelectedValue = _objSkill.AttributeObject.Abbrev;
                cboSelectAttribute.EndUpdate();
                cboSelectAttribute.UpdateLightDarkMode();
                cboSelectAttribute.TranslateWinForm();
                pnlAttributes.Controls.Add(cboSelectAttribute);
            }
            else
            {
                nudSkill = new NumericUpDownEx
                {
                    Anchor              = AnchorStyles.Right,
                    AutoSize            = true,
                    InterceptMouseWheel = NumericUpDownEx.InterceptMouseWheelMode.WhenMouseOver,
                    Margin              = new Padding(3, 2, 3, 2),
                    Maximum             = new decimal(new[] { 99, 0, 0, 0 }),
                    Name = "nudSkill"
                };
                nudKarma = new NumericUpDownEx
                {
                    Anchor              = AnchorStyles.Right,
                    AutoSize            = true,
                    InterceptMouseWheel = NumericUpDownEx.InterceptMouseWheelMode.WhenMouseOver,
                    Margin              = new Padding(3, 2, 3, 2),
                    Maximum             = new decimal(new[] { 99, 0, 0, 0 }),
                    Name = "nudKarma"
                };

                // Trick to make it seem like the button is a label (+ onclick method not doing anything in Create mode)
                btnAttribute.FlatAppearance.MouseDownBackColor = Color.Transparent;
                btnAttribute.FlatAppearance.MouseOverBackColor = Color.Transparent;

                nudSkill.DoDatabinding("Visible", objSkill.CharacterObject, nameof(objSkill.CharacterObject.EffectiveBuildMethodUsesPriorityTables));
                nudSkill.DoDatabinding("Value", objSkill, nameof(Skill.Base));
                nudSkill.DoOneWayDataBinding("Enabled", objSkill, nameof(Skill.BaseUnlocked));
                nudSkill.InterceptMouseWheel = GlobalOptions.InterceptMode;
                nudKarma.DoDatabinding("Value", objSkill, nameof(Skill.Karma));
                nudKarma.DoOneWayDataBinding("Enabled", objSkill, nameof(Skill.KarmaUnlocked));
                nudKarma.InterceptMouseWheel = GlobalOptions.InterceptMode;

                nudSkill.UpdateLightDarkMode();
                nudSkill.TranslateWinForm();
                nudKarma.UpdateLightDarkMode();
                nudKarma.TranslateWinForm();
                tlpMain.Controls.Add(nudSkill, 2, 0);
                tlpMain.Controls.Add(nudKarma, 3, 0);

                if (objSkill.IsExoticSkill)
                {
                    lblCareerSpec = new Label
                    {
                        Anchor    = AnchorStyles.Left,
                        AutoSize  = true,
                        Name      = "lblCareerSpec",
                        Text      = "[Specializations]",
                        TextAlign = ContentAlignment.MiddleLeft
                    };
                    lblCareerSpec.DoOneWayDataBinding("Text", objSkill, nameof(Skill.CurrentDisplaySpecialization));
                    lblCareerSpec.UpdateLightDarkMode();
                    lblCareerSpec.TranslateWinForm();
                    tlpRight.Controls.Add(lblCareerSpec, 0, 0);
                }
                else
                {
                    cboSpec = new ElasticComboBox
                    {
                        Anchor            = AnchorStyles.Left | AnchorStyles.Right,
                        AutoCompleteMode  = AutoCompleteMode.Suggest,
                        FormattingEnabled = true,
                        Margin            = new Padding(3, 0, 3, 0),
                        Name    = "cboSpec",
                        Sorted  = true,
                        TabStop = false
                    };
                    cboSpec.BeginUpdate();
                    cboSpec.DataSource    = null;
                    cboSpec.DataSource    = objSkill.CGLSpecializations;
                    cboSpec.DisplayMember = nameof(ListItem.Name);
                    cboSpec.ValueMember   = nameof(ListItem.Value);
                    cboSpec.SelectedIndex = -1;
                    cboSpec.DoDatabinding("Text", objSkill, nameof(Skill.Specialization));
                    cboSpec.DoOneWayDataBinding("Enabled", objSkill, nameof(Skill.CanHaveSpecs));
                    cboSpec.EndUpdate();
                    cboSpec.UpdateLightDarkMode();
                    cboSpec.TranslateWinForm();
                    chkKarma = new ColorableCheckBox(components)
                    {
                        Anchor             = AnchorStyles.Left,
                        AutoSize           = true,
                        DefaultColorScheme = true,
                        Margin             = new Padding(3, 0, 3, 0),
                        Name = "chkKarma",
                        UseVisualStyleBackColor = true
                    };
                    chkKarma.DoDatabinding("Visible", objSkill.CharacterObject, nameof(objSkill.CharacterObject.EffectiveBuildMethodUsesPriorityTables));
                    chkKarma.DoDatabinding("Checked", objSkill, nameof(Skill.BuyWithKarma));
                    chkKarma.DoOneWayDataBinding("Enabled", objSkill, nameof(Skill.CanHaveSpecs));
                    chkKarma.UpdateLightDarkMode();
                    chkKarma.TranslateWinForm();
                    tlpRight.Controls.Add(cboSpec, 0, 0);
                    tlpRight.Controls.Add(chkKarma, 1, 0);
                }
            }

            this.DoOneWayDataBinding("Enabled", objSkill, nameof(Skill.Enabled));
            this.DoOneWayDataBinding("BackColor", objSkill, nameof(Skill.PreferredControlColor));

            ResumeLayout(true);

            _blnLoading = false;

            _objSkill.PropertyChanged += Skill_PropertyChanged;
        }
コード例 #35
0
        public override bool TakeAction()
        {
            if (!string.IsNullOrEmpty(ContextUser.MercenariesID))
            {
                if (CombatHelper.GuildBossKill(ContextUser.MercenariesID))
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St5405_BossKilled;
                    return(false);
                }
                GuildBossCombat bossCombat = new GuildBossCombat(ContextUser.MercenariesID);
                UserGuild       guild      = bossCombat.UserGuild;
                if (guild != null)
                {
                    CombatStatus combatStatus = guild.CombatStatus;
                    if (combatStatus != CombatStatus.Wait && combatStatus != CombatStatus.Combat)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St5402_CombatNoStart;
                        return(false);
                    }
                    ErrorCode = ops;
                    if (ops == 1)
                    {
                        ErrorInfo = string.Format(LanguageManager.GetLang().St5202_InspireTip, ExpNum);
                    }
                    else if (ops == 2)
                    {
                        if (ContextUser.ExpNum < ExpNum)
                        {
                            ErrorCode = LanguageManager.GetLang().ErrorCode;
                            ErrorInfo = LanguageManager.GetLang().St_ExpNumNotEnough;
                            return(false);
                        }
                        if (!bossCombat.Inspire(Uid, false, out inspirePercent))
                        {
                            ErrorCode = LanguageManager.GetLang().ErrorCode;
                            ErrorInfo = LanguageManager.GetLang().St_InspireFailed;
                        }

                        if (ContextUser.ExpNum >= ExpNum)
                        {
                            ContextUser.ExpNum = MathUtils.Subtraction(ContextUser.ExpNum, ExpNum, 0);
                            //ContextUser.Update();
                        }
                    }
                    else if (ops == 3)
                    {
                        ErrorInfo = string.Format(LanguageManager.GetLang().St5202_InspireGoldTip, GlodNum);
                    }
                    else if (ops == 4)
                    {
                        if (ContextUser.GoldNum < GlodNum)
                        {
                            ErrorCode = LanguageManager.GetLang().ErrorCode;
                            ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
                            return(false);
                        }
                        if (!bossCombat.Inspire(Uid, true, out inspirePercent))
                        {
                            ErrorCode = LanguageManager.GetLang().ErrorCode;
                            ErrorInfo = LanguageManager.GetLang().St_InspireFailed;
                        }

                        if (ContextUser.GoldNum >= GlodNum)
                        {
                            ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, GlodNum, int.MaxValue);
                            //ContextUser.Update();
                        }
                    }
                }
            }
            return(true);
        }
コード例 #36
0
ファイル: Action1307.cs プロジェクト: zxx0367/Scut-samples
        public override bool TakeAction()
        {
            var package          = UserCrystalPackage.Get(Uid);
            var userCrystalArray = package.CrystalPackage.FindAll(m => m.IsSale == 1 && m.GeneralID.Equals(0));
            //命格背包
            var crystalArray = package.CrystalPackage.FindAll(m => m.IsSale == 2 && m.GeneralID.Equals(0));

            if (ops == 1)
            {
                UserCrystalInfo userCrystal = package.CrystalPackage.Find(m => m.UserCrystalID.Equals(userCrystalID));
                if (crystalArray.Count >= ContextUser.CrystalNum)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1307_FateBackpackFull;
                    return(false);
                }
                userCrystal.IsSale = 2;
                package.SaveCrystal(userCrystal);
                ErrorCode = 1;
            }
            else if (ops == 2)
            {
                userCrystalArray.QuickSort((x, y) =>
                {
                    int result = 0;
                    if (x == null && y == null)
                    {
                        return(0);
                    }
                    if (x != null && y == null)
                    {
                        return(1);
                    }
                    if (x == null)
                    {
                        return(-1);
                    }
                    result = (int)new ConfigCacheSet <CrystalInfo>().FindKey(y.CrystalID).CrystalQuality.CompareTo(
                        new ConfigCacheSet <CrystalInfo>().FindKey(x.CrystalID).CrystalQuality);
                    if (result == 0)
                    {
                        result = y.CurrExprience.CompareTo(x.CurrExprience);
                    }
                    return(result);
                });
                int subNum = ContextUser.CrystalNum;
                if (subNum <= crystalArray.Count)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1307_FateBackpackFull;
                    return(false);
                }

                foreach (UserCrystalInfo crystal in userCrystalArray)
                {
                    UserCrystalInfo[] crystalArray1 = package.CrystalPackage.FindAll(m => m.IsSale == 2 && m.GeneralID.Equals(0)).ToArray();
                    if (subNum <= crystalArray1.Length)
                    {
                        ErrorCode = 1;
                        ErrorInfo = LanguageManager.GetLang().St1307_FateBackpackFull;
                        return(false);
                    }
                    CrystalInfo crystalInfo = new ConfigCacheSet <CrystalInfo>().FindKey(crystal.CrystalID);
                    if (crystalInfo != null && crystalInfo.IsTelegrams == 1 && crystal.IsSale == 1)
                    {
                        crystal.IsSale = 2;
                        package.SaveCrystal(crystal);
                        //package.DelayChange();
                        ErrorCode = 1;
                    }
                }
            }
            else
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().ServerBusy;
                return(false);
            }
            return(true);
        }
コード例 #37
0
        public AttributeControl(CharacterAttrib attribute)
        {
            if (attribute == null)
            {
                return;
            }
            _strAttributeName = attribute.Abbrev;
            _objCharacter     = attribute.CharacterObject;
            _dataSource       = _objCharacter.AttributeSection.GetAttributeBindingByName(AttributeName);

            InitializeComponent();

            SuspendLayout();
            //Display
            lblName.DoOneWayDataBinding("Text", _dataSource, nameof(CharacterAttrib.DisplayNameFormatted));
            lblValue.DoOneWayDataBinding("Text", _dataSource, nameof(CharacterAttrib.DisplayValue));
            lblLimits.DoOneWayDataBinding("Text", _dataSource, nameof(CharacterAttrib.AugmentedMetatypeLimits));
            lblValue.DoOneWayDataBinding("ToolTipText", _dataSource, nameof(CharacterAttrib.ToolTip));
            if (_objCharacter.Created)
            {
                cmdImproveATT = new ButtonWithToolTip
                {
                    Anchor                  = AnchorStyles.Right,
                    AutoSize                = true,
                    AutoSizeMode            = AutoSizeMode.GrowAndShrink,
                    Padding                 = new Padding(1),
                    MinimumSize             = new Size(24, 24),
                    ImageDpi96              = Resources.add,
                    ImageDpi192             = Resources.add1,
                    Name                    = "cmdImproveATT",
                    UseVisualStyleBackColor = true
                };
                cmdImproveATT.Click += cmdImproveATT_Click;
                cmdImproveATT.DoOneWayDataBinding("ToolTipText", _dataSource, nameof(CharacterAttrib.UpgradeToolTip));
                cmdImproveATT.DoOneWayDataBinding("Enabled", _dataSource, nameof(CharacterAttrib.CanUpgradeCareer));
                flpRight.Controls.Add(cmdImproveATT);
                if (AttributeName == "EDG")
                {
                    cmdBurnEdge = new ButtonWithToolTip
                    {
                        Anchor                  = AnchorStyles.Right,
                        AutoSize                = true,
                        AutoSizeMode            = AutoSizeMode.GrowAndShrink,
                        Padding                 = new Padding(1),
                        MinimumSize             = new Size(24, 24),
                        ImageDpi96              = Resources.fire,
                        ImageDpi192             = Resources.fire1,
                        Name                    = "cmdBurnEdge",
                        ToolTipText             = LanguageManager.GetString("Tip_CommonBurnEdge"),
                        UseVisualStyleBackColor = true
                    };
                    cmdBurnEdge.Click += cmdBurnEdge_Click;
                    flpRight.Controls.Add(cmdBurnEdge);
                }
            }
            else
            {
                while (AttributeObject.KarmaMaximum < 0 && AttributeObject.Base > 0)
                {
                    --AttributeObject.Base;
                }
                // Very rough fix for when Karma values somehow exceed KarmaMaximum after loading in. This shouldn't happen in the first place, but this ad-hoc patch will help fix crashes.
                if (AttributeObject.Karma > AttributeObject.KarmaMaximum)
                {
                    AttributeObject.Karma = AttributeObject.KarmaMaximum;
                }

                nudKarma = new NumericUpDownEx
                {
                    Anchor              = AnchorStyles.Right,
                    AutoSize            = true,
                    InterceptMouseWheel = NumericUpDownEx.InterceptMouseWheelMode.WhenMouseOver,
                    Margin              = new Padding(3, 0, 3, 0),
                    Maximum             = new decimal(new[] { 99, 0, 0, 0 }),
                    MinimumSize         = new Size(35, 0),
                    Name = "nudKarma"
                };
                nudKarma.BeforeValueIncrement += nudKarma_BeforeValueIncrement;
                nudKarma.ValueChanged         += nudKarma_ValueChanged;
                nudBase = new NumericUpDownEx
                {
                    Anchor              = AnchorStyles.Right,
                    AutoSize            = true,
                    InterceptMouseWheel = NumericUpDownEx.InterceptMouseWheelMode.WhenMouseOver,
                    Margin              = new Padding(3, 0, 3, 0),
                    Maximum             = new decimal(new[] { 99, 0, 0, 0 }),
                    MinimumSize         = new Size(35, 0),
                    Name = "nudBase"
                };
                nudBase.BeforeValueIncrement += nudBase_BeforeValueIncrement;
                nudBase.ValueChanged         += nudBase_ValueChanged;

                nudBase.DoOneWayDataBinding("Visible", _objCharacter, nameof(Character.EffectiveBuildMethodUsesPriorityTables));
                nudBase.DoOneWayDataBinding("Maximum", _dataSource, nameof(CharacterAttrib.PriorityMaximum));
                nudBase.DoDataBinding("Value", _dataSource, nameof(CharacterAttrib.Base));
                nudBase.DoOneWayDataBinding("Enabled", _dataSource, nameof(CharacterAttrib.BaseUnlocked));
                nudBase.InterceptMouseWheel = GlobalSettings.InterceptMode;

                nudKarma.DoOneWayDataBinding("Maximum", _dataSource, nameof(CharacterAttrib.KarmaMaximum));
                nudKarma.DoDataBinding("Value", _dataSource, nameof(CharacterAttrib.Karma));
                nudKarma.InterceptMouseWheel = GlobalSettings.InterceptMode;

                flpRight.Controls.Add(nudKarma);
                flpRight.Controls.Add(nudBase);
            }

            ResumeLayout();

            this.UpdateLightDarkMode();
            this.TranslateWinForm();
        }
コード例 #38
0
        private void cmdImproveATT_Click(object sender, EventArgs e)
        {
            int intUpgradeKarmaCost = AttributeObject.UpgradeKarmaCost;

            if (intUpgradeKarmaCost == -1)
            {
                return;                            //TODO: more descriptive
            }
            if (intUpgradeKarmaCost > _objCharacter.Karma)
            {
                Program.MainForm.ShowMessageBox(LanguageManager.GetString("Message_NotEnoughKarma"), LanguageManager.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            string confirmstring = string.Format(GlobalSettings.CultureInfo, LanguageManager.GetString("Message_ConfirmKarmaExpense"), AttributeObject.DisplayNameFormatted, AttributeObject.Value + 1, intUpgradeKarmaCost);

            if (!CommonFunctions.ConfirmKarmaExpense(confirmstring))
            {
                return;
            }

            AttributeObject.Upgrade();
            ValueChanged?.Invoke(this, e);
        }
コード例 #39
0
ファイル: LanguageLoader.cs プロジェクト: charlink1/iwmr
 void OnChangeLanguage(LanguageManager thisLanguageManager)
 {
     TranslateText();
 }
コード例 #40
0
        public override bool TakeAction()
        {
            List <UserQueue> queueList = new GameDataCacheSet <UserQueue>().FindAll(ContextUser.UserID, m => m.QueueType == QueueType.SaoDang);

            if (queueList.Count > 0)
            {
                this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                this.ErrorInfo = LanguageManager.GetLang().St4007_Saodanging;
                return(false);
            }
            var itemList = UserItemHelper.GetItems(Uid).FindAll(m => m.ItemStatus == ItemStatus.BeiBao);

            if (itemList.Count >= ContextUser.GridNum)
            {
                this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                this.ErrorInfo = LanguageManager.GetLang().St4007_BeiBaoTimeOut;
                return(false);
            }
            List <PlotNPCInfo> npcList = new ConfigCacheSet <PlotNPCInfo>().FindAll(m => m.PlotID == plotID);
            //战斗次数
            int plotNpcNum = npcList.Count;
            int energyNum  = 0;
            int battleNum;

            if (ops == 1)
            {
                //用尽精力,玩家可扫荡轮数
                energyNum = ContextUser.EnergyNum > 200 ? 200 : ContextUser.EnergyNum.ToInt();
                int userTurnsNum = (int)Math.Floor((double)energyNum / PlotInfo.BattleEnergyNum);
                battleNum = userTurnsNum * plotNpcNum;
                coldTime  = battleNum * PlotInfo.BattleSpeedNum;
            }
            else if (ops == 2)
            {
                //30分钟
                coldTime  = Time_30;
                battleNum = PlotHelper.GetBattleNum(Time_30);
                energyNum = PlotHelper.GetTurnsNum(plotNpcNum, battleNum) * PlotInfo.BattleEnergyNum;
            }
            else if (ops == 3)
            {
                //60分钟
                coldTime  = Time_60;
                battleNum = PlotHelper.GetBattleNum(Time_60);
                energyNum = PlotHelper.GetTurnsNum(plotNpcNum, battleNum) * PlotInfo.BattleEnergyNum;
            }
            else
            {
                this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                return(false);
            }
            if (ContextUser.EnergyNum == 0 || ContextUser.EnergyNum < energyNum)
            {
                this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                this.ErrorInfo = LanguageManager.GetLang().St_EnergyNotEnough;
                return(false);
            }
            //清除扫荡池
            var sweepCacheSet = new GameDataCacheSet <UserSweepPool>();
            List <UserSweepPool> sweepPoolList = sweepCacheSet.FindAll(ContextUser.UserID);

            foreach (UserSweepPool sweepPool in sweepPoolList)
            {
                if (sweepPool != null)
                {
                    sweepCacheSet.Delete(sweepPool);
                }
            }

            if (coldTime > 0)
            {
                //在开始战斗时扣一次玩家精力,无战斗离开返还
                ContextUser.ResetSweepPool(plotID);
                //开始扫荡暂不扣精力
                //ContextUser.RemoveEnergyNum(PlotInfo.BattleEnergyNum);
                ContextUser.UserStatus = UserStatus.SaoDang;
                //ContextUser.Update();

                //放入队列中
                UserQueue userQueue = new UserQueue()
                {
                    QueueID       = Guid.NewGuid().ToString(),
                    UserID        = ContextUser.UserID,
                    QueueType     = QueueType.SaoDang,
                    QueueName     = QueueType.SaoDang.ToString(),
                    TotalColdTime = coldTime,
                    Timing        = DateTime.Now,
                    ColdTime      = coldTime,
                    IsSuspend     = false
                };
                new GameDataCacheSet <UserQueue>().Add(userQueue);
            }
            return(true);
        }
コード例 #41
0
        private void BWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            this.OnProgressBarStateChanged(new ProgressBarStateChangedEventArgs(Forms.MyMainMenu.ProgressBarVisibleState.Infinite));
            Forms.PSO2WorkspaceCleanupDialog requestForm = e.Argument as Forms.PSO2WorkspaceCleanupDialog;

            // Predict how many files <FullPath, RelativePath>
            this.OnStepChanged(new StepEventArgs(LanguageManager.GetMessageText("WorkspaceManager_PreparingFileList", "Preparing file list")));
            Dictionary <string, string> fileList = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);

            if (requestForm.StrictClean)
            {
                string[] characterPresetExts = CharacterPreset.GetFileExts();
                string   tmpCurrentPath;
                foreach (string filename in Directory.EnumerateFiles(DefaultValues.Directory.DocumentWorkSpace, "*", SearchOption.TopDirectoryOnly))
                {
                    if (filename.EndsWith(".pso2", StringComparison.OrdinalIgnoreCase) || filename.EndsWith(".ver", StringComparison.OrdinalIgnoreCase) || filename.EndsWith(".txt", StringComparison.OrdinalIgnoreCase))
                    {
                        fileList.Add(filename, filename.Remove(0, DefaultValues.Directory.DocumentWorkSpace.Length + 1));
                    }
                    else
                    {
                        for (int i = 0; i < characterPresetExts.Length; i++)
                        {
                            if (filename.EndsWith($".{characterPresetExts[i]}"))
                            {
                                fileList.Add(filename, filename.Remove(0, DefaultValues.Directory.DocumentWorkSpace.Length + 1));
                                break;
                            }
                        }
                    }
                }
                tmpCurrentPath = Path.Combine(DefaultValues.Directory.DocumentWorkSpace, "log");
                if (Directory.Exists(tmpCurrentPath))
                {
                    foreach (string filename in Directory.EnumerateFiles(tmpCurrentPath, "*.txt", SearchOption.TopDirectoryOnly))
                    {
                        fileList.Add(filename, filename.Remove(0, DefaultValues.Directory.DocumentWorkSpace.Length + 1));
                    }
                }
                tmpCurrentPath = Path.Combine(DefaultValues.Directory.DocumentWorkSpace, "download");
                if (Directory.Exists(tmpCurrentPath))
                {
                    foreach (string filename in Directory.EnumerateFiles(tmpCurrentPath, "*", SearchOption.TopDirectoryOnly))
                    {
                        if (filename.EndsWith(".pat", StringComparison.OrdinalIgnoreCase) || filename.EndsWith(".txt", StringComparison.OrdinalIgnoreCase))
                        {
                            fileList.Add(filename, filename.Remove(0, DefaultValues.Directory.DocumentWorkSpace.Length + 1));
                        }
                    }
                }
                tmpCurrentPath = Path.Combine(DefaultValues.Directory.DocumentWorkSpace, "temp");
                if (Directory.Exists(tmpCurrentPath))
                {
                    foreach (string filename in Directory.EnumerateFiles(tmpCurrentPath, "*", SearchOption.TopDirectoryOnly))
                    {
                        fileList.Add(filename, filename.Remove(0, DefaultValues.Directory.DocumentWorkSpace.Length + 1));
                    }
                }
                tmpCurrentPath = Path.Combine(DefaultValues.Directory.DocumentWorkSpace, "pictures");
                if (Directory.Exists(tmpCurrentPath))
                {
                    foreach (string filename in Directory.EnumerateFiles(tmpCurrentPath, "*", SearchOption.TopDirectoryOnly))
                    {
                        if (filename.EndsWith(".bmp", StringComparison.OrdinalIgnoreCase) || filename.EndsWith(".jpg", StringComparison.OrdinalIgnoreCase) || filename.EndsWith(".jpeg", StringComparison.OrdinalIgnoreCase) || filename.EndsWith(".png", StringComparison.OrdinalIgnoreCase))
                        {
                            fileList.Add(filename, filename.Remove(0, DefaultValues.Directory.DocumentWorkSpace.Length + 1));
                        }
                    }
                }
                tmpCurrentPath = Path.Combine(DefaultValues.Directory.DocumentWorkSpace, "symbolarts");
                if (Directory.Exists(tmpCurrentPath))
                {
                    foreach (string filename in Directory.EnumerateFiles(tmpCurrentPath, "*.sar", SearchOption.AllDirectories))
                    {
                        fileList.Add(filename, filename.Remove(0, DefaultValues.Directory.DocumentWorkSpace.Length + 1));
                    }
                }
            }
            else
            {
                foreach (string filename in Directory.EnumerateFiles(DefaultValues.Directory.DocumentWorkSpace, "*", SearchOption.AllDirectories))
                {
                    fileList.Add(filename, filename.Remove(0, DefaultValues.Directory.DocumentWorkSpace.Length + 1));
                }
            }

            this.OnProgressTotalChanged(new ProgressEventArgs(fileList.Count));
            this.OnProgressBarStateChanged(new ProgressBarStateChangedEventArgs(Forms.MyMainMenu.ProgressBarVisibleState.Percent));
            int counting = 0;

            this.OnProgressCurrentChanged(new ProgressEventArgs(counting));
            if (requestForm.CreateBackup)
            {
                this.OnStepChanged(new StepEventArgs(LanguageManager.GetMessageText("WorkspaceManager_BeginPSO2WorkSpaceBackup", "Backing up datas")));
                SharpCompress.Writers.Zip.ZipWriterOptions asdasd = new SharpCompress.Writers.Zip.ZipWriterOptions(requestForm.CompressionType);
                asdasd.LeaveStreamOpen = false;
                if (requestForm.CompressionType == SharpCompress.Common.CompressionType.Deflate)
                {
                    asdasd.DeflateCompressionLevel = requestForm.CompressionLevel;
                }
                using (FileStream fs = new FileStream(requestForm.BackupPath, FileMode.Create, FileAccess.ReadWrite, FileShare.None))
                    using (SharpCompress.Writers.Zip.ZipWriter zw = new SharpCompress.Writers.Zip.ZipWriter(fs, asdasd))
                    {
                        foreach (var _keypair in fileList)
                        {
                            if (this.bWorker.CancellationPending)
                            {
                                e.Cancel = true;
                                break;
                            }
                            counting++;
                            this.OnProgressCurrentChanged(new ProgressEventArgs(counting));
                            using (FileStream fss = File.OpenRead(_keypair.Key))
                                zw.Write(_keypair.Value, fss, File.GetLastWriteTime(_keypair.Key));
                        }
                    }
            }
            if (!this.bWorker.CancellationPending)
            {
                counting = 0;
                this.OnStepChanged(new StepEventArgs(LanguageManager.GetMessageText("WorkspaceManager_BeginPSO2WorkSpaceCleanup", "Cleaning up datas")));
                foreach (string fullpath in fileList.Keys)
                {
                    if (this.bWorker.CancellationPending)
                    {
                        e.Cancel = true;
                        break;
                    }
                    if (fullpath.EndsWith("version.ver", StringComparison.OrdinalIgnoreCase) || fullpath.EndsWith("precede.txt", StringComparison.OrdinalIgnoreCase))
                    {
                    }
                    else
                    {
                        File.Delete(fullpath);
                    }
                    counting++;
                    this.OnProgressCurrentChanged(new ProgressEventArgs(counting));
                }
                foreach (string folderpath in Directory.EnumerateDirectories(DefaultValues.Directory.DocumentWorkSpace, "*", SearchOption.TopDirectoryOnly))
                {
                    if (Leayal.IO.DirectoryHelper.IsFolderEmpty(folderpath))
                    {
                        Directory.Delete(folderpath, true);
                    }
                }
            }
        }
コード例 #42
0
ファイル: Action1256.cs プロジェクト: zxx0367/Scut-samples
        public override bool TakeAction()
        {
            var syntheList = new CacheList <SynthesisInfo>();
            var package    = UserEnchant.Get(ContextUser.UserID);

            if (ops == 1)
            {
                UserEnchantInfo userEnchantinfo1 = package.EnchantPackage.Find(m => m.UserEnchantID == userEnchantID1);
                UserEnchantInfo userEnchantinfo2 = package.EnchantPackage.Find(m => m.UserEnchantID == userEnchantID2);
                if (userEnchantinfo1 == null || userEnchantinfo2 == null)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1256_EnchantNotEnough;
                    return(false);
                }

                if (userEnchantinfo1.EnchantLv >= GameConfigSet.MaxEnchantLv)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1256_OutMaxEnchantLv;
                    return(false);
                }
                int         entExprience1 = 0;
                int         entExprience2 = 0;
                EnchantInfo enchant1      = new ConfigCacheSet <EnchantInfo>().FindKey(userEnchantinfo1.EnchantID);
                EnchantInfo enchant2      = new ConfigCacheSet <EnchantInfo>().FindKey(userEnchantinfo2.EnchantID);
                if (enchant1 != null && enchant2 != null)
                {
                    entExprience1 = enchant1.Experience;
                    entExprience2 = enchant2.Experience;
                    if (userEnchantinfo1.EnchantLv > userEnchantinfo2.EnchantLv ||
                        (userEnchantinfo1.EnchantLv == userEnchantinfo2.EnchantLv &&
                         userEnchantinfo1.CurrExprience >= userEnchantinfo2.CurrExprience))
                    {
                        UpdateEnchant(userEnchantID1, userEnchantID2, entExprience2);
                        syntheList.Add(new SynthesisInfo()
                        {
                            DemandID = userEnchantinfo2.EnchantID, Num = userEnchantinfo2.CurrExprience
                        });
                        UserLogHelper.AppenEnchantLog(ContextUser.UserID, 4, userEnchantinfo1, syntheList);
                    }
                    else
                    {
                        UpdateEnchant(userEnchantID2, userEnchantID1, entExprience1);
                        syntheList.Add(new SynthesisInfo()
                        {
                            DemandID = userEnchantinfo1.EnchantID, Num = userEnchantinfo1.CurrExprience
                        });
                        UserLogHelper.AppenEnchantLog(ContextUser.UserID, 4, userEnchantinfo2, syntheList);
                    }
                }
            }
            else if (ops == 2)
            {
                int experience   = 0;
                var enchantArray = package.EnchantPackage.FindAll(m => string.IsNullOrEmpty(m.UserItemID));
                if (enchantArray.Count == 0)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1256_EnchantNotEnough;
                    return(false);
                }
                if (enchantArray.Count == 1)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1256_EnchantNumNotEnough;
                    return(false);
                }
                enchantArray.QuickSort((x, y) =>
                {
                    int result = 0;
                    if (x == null && y == null)
                    {
                        return(0);
                    }
                    if (x != null && y == null)
                    {
                        return(1);
                    }
                    if (x == null)
                    {
                        return(-1);
                    }
                    result = y.EnchantLv.CompareTo(x.EnchantLv);
                    if (result == 0)
                    {
                        result = y.CurrExprience.CompareTo(x.CurrExprience);
                    }
                    return(result);
                });

                UserEnchantInfo uEnchantInfo =
                    package.EnchantPackage.Find(m => m.UserEnchantID == enchantArray[0].UserEnchantID);
                if (uEnchantInfo == null)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1262_EnchantSynthesisNotEnough;
                    return(false);
                }
                EnchantLvInfo enchantLvInfo = new ConfigCacheSet <EnchantLvInfo>().FindKey(uEnchantInfo.EnchantID,
                                                                                           GameConfigSet.MaxEnchantLv);
                int maxExprience = enchantLvInfo == null ? 0 : enchantLvInfo.Experience;

                foreach (var info in enchantArray)
                {
                    EnchantInfo enchantInfo = new ConfigCacheSet <EnchantInfo>().FindKey(info.EnchantID);
                    if (enchantInfo != null)
                    {
                        experience = enchantInfo.Experience;
                    }
                    if (uEnchantInfo.UserEnchantID != info.UserEnchantID)
                    {
                        if (uEnchantInfo.CurrExprience >= maxExprience)
                        {
                            ErrorCode = LanguageManager.GetLang().ErrorCode;
                            ErrorInfo = LanguageManager.GetLang().St1256_OutMaxEnchantLv;
                            return(false);
                        }
                        syntheList.Add(new SynthesisInfo()
                        {
                            DemandID = info.EnchantID, Num = info.CurrExprience
                        });
                        UpdateEnchant(uEnchantInfo.UserEnchantID, info.UserEnchantID, experience);
                    }
                }
                UserLogHelper.AppenEnchantLog(ContextUser.UserID, 4, uEnchantInfo, syntheList);
            }
            return(true);
        }
コード例 #43
0
        /// <summary>
        ///     Performs actions based on the character's last loaded AppVersion attribute.
        /// </summary>
        private void LegacyShim()
        {
            //Unstored Cost and LP values prior to 5.190.2 nightlies.
            if (_objCharacter.LastSavedVersion > new Version(5, 190, 0))
            {
                return;
            }
            var objXmlDocument          = XmlManager.Load("lifestyles.xml");
            var objLifestyleQualityNode = GetNode() ??
                                          objXmlDocument.SelectSingleNode(
                "/chummer/qualities/quality[name = \"" + _strName + "\"]");

            if (objLifestyleQualityNode == null)
            {
                List <ListItem> lstQualities = new List <ListItem>(1);
                using (var xmlQualityList = objXmlDocument.SelectNodes("/chummer/qualities/quality"))
                {
                    if (xmlQualityList != null)
                    {
                        foreach (XmlNode xmlNode in xmlQualityList)
                        {
                            lstQualities.Add(new ListItem(xmlNode["id"]?.InnerText,
                                                          xmlNode["translate"]?.InnerText ?? xmlNode["name"]?.InnerText));
                        }
                    }
                }

                using (frmSelectItem frmSelect = new frmSelectItem
                {
                    Description = string.Format(GlobalOptions.CultureInfo, LanguageManager.GetString("String_intCannotFindLifestyleQuality"), _strName)
                })
                {
                    frmSelect.SetGeneralItemsMode(lstQualities);
                    frmSelect.ShowDialog(Program.MainForm);
                    if (frmSelect.DialogResult == DialogResult.Cancel)
                    {
                        return;
                    }

                    objLifestyleQualityNode =
                        objXmlDocument.SelectSingleNode("/chummer/qualities/quality[id = \"" + frmSelect.SelectedItem +
                                                        "\"]");
                }
            }

            var intTemp = 0;
            var strTemp = string.Empty;

            if (objLifestyleQualityNode.TryGetStringFieldQuickly("cost", ref strTemp))
            {
                CostString = strTemp;
            }
            if (objLifestyleQualityNode.TryGetInt32FieldQuickly("lp", ref intTemp))
            {
                LP = intTemp;
            }
            if (objLifestyleQualityNode.TryGetInt32FieldQuickly("areamaximum", ref intTemp))
            {
                AreaMaximum = intTemp;
            }
            if (objLifestyleQualityNode.TryGetInt32FieldQuickly("comfortsmaximum", ref intTemp))
            {
                ComfortMaximum = intTemp;
            }
            if (objLifestyleQualityNode.TryGetInt32FieldQuickly("securitymaximum", ref intTemp))
            {
                SecurityMaximum = intTemp;
            }
            if (objLifestyleQualityNode.TryGetInt32FieldQuickly("area", ref intTemp))
            {
                Area = intTemp;
            }
            if (objLifestyleQualityNode.TryGetInt32FieldQuickly("comforts", ref intTemp))
            {
                Comfort = intTemp;
            }
            if (objLifestyleQualityNode.TryGetInt32FieldQuickly("security", ref intTemp))
            {
                Security = intTemp;
            }
            if (objLifestyleQualityNode.TryGetInt32FieldQuickly("multiplier", ref intTemp))
            {
                Multiplier = intTemp;
            }
            if (objLifestyleQualityNode.TryGetInt32FieldQuickly("multiplierbaseonly", ref intTemp))
            {
                BaseMultiplier = intTemp;
            }
        }
コード例 #44
0
        public async Task <IEnumerable <TreeNode> > GetCharacterRosterTreeNode(frmCharacterRoster frmCharRoster, bool forceUpdate)
        {
            try
            {
                ContextMenuStrip myContextMenuStrip = null;
                List <TreeNode>  list = new List <TreeNode>();
                using (new CursorWait(true, frmCharRoster))
                {
                    frmCharRoster.DoThreadSafe(() =>
                    {
                        myContextMenuStrip = frmCharRoster.CreateContextMenuStrip();
                        var menulist       = myContextMenuStrip.Items.Cast <ToolStripMenuItem>().ToList();
                        foreach (var item in menulist)
                        {
                            switch (item.Name)
                            {
                            case "tsToggleFav":
                                myContextMenuStrip.Items.Remove(item);
                                break;

                            case "tsCloseOpenCharacter":
                                myContextMenuStrip.Items.Remove(item);
                                break;

                            case "tsSort":
                                myContextMenuStrip.Items.Remove(item);
                                break;

                            case "tsDelete":
                                ToolStripMenuItem newDelete = new ToolStripMenuItem(item.Text, item.Image);
                                newDelete.Click            += frmCharRoster.tsDelete_Click;
                                myContextMenuStrip.Items.Add(newDelete);
                                break;

                            default:
                                break;
                            }
                        }
                        ToolStripMenuItem newShare = new ToolStripMenuItem("Share")
                        {
                            Name  = "tsShareChummer",
                            Tag   = "Menu_ShareChummer",
                            Text  = "Share chummer",
                            Size  = new System.Drawing.Size(177, 22),
                            Image = global::Chummer.Properties.Resources.link_add
                        };
                        newShare.Click += NewShareOnClick;
                        myContextMenuStrip.Items.Add(newShare);
                        LanguageManager.TranslateWinForm(GlobalOptions.Language, myContextMenuStrip);
                    });
                    if (ChummerHub.Client.Properties.Settings.Default.UserModeRegistered == true)
                    {
                        Log.Info("Loading CharacterRoster from SINners...");
                        Func <Task <HttpOperationResponse <ResultAccountGetSinnersByAuthorization> > > myMethodName = async() =>
                        {
                            try
                            {
                                var client = StaticUtils.GetClient();
                                var ret    = await client.GetSINnersByAuthorizationWithHttpMessagesAsync();

                                return(ret);
                            }
                            catch (Exception e)
                            {
                                Log.Error(e);
                                throw;
                            }
                        };
                        var res = await ChummerHub.Client.Backend.Utils.GetCharacterRosterTreeNode(forceUpdate, myMethodName);

                        if (res == null)
                        {
                            throw new ArgumentException("Could not load owned SINners from WebService.");
                        }
                        list = res.ToList();
                    }
                    var myadd     = MyTreeNodes2Add.ToList();
                    var mysortadd = (from a in myadd orderby a.Value.Text select a).ToList();
                    foreach (var addme in mysortadd)
                    {
                        list.Add(addme.Value);
                    }
                    AddContextMenuStripRecursive(list, myContextMenuStrip);
                    return(list);
                }
            }
            catch (Microsoft.Rest.SerializationException e)
            {
                if (e.Content.Contains("Log in - ChummerHub"))
                {
                    TreeNode node = new TreeNode("Online, but not logged in!")
                    {
                        ToolTipText = "Please log in (Options -> Plugins -> Sinners (Cloud) -> Login", Tag = e
                    };
                    Log.Warn(e, "Online, but not logged in!");
                    return(new List <TreeNode>()
                    {
                        node
                    });
                }
                else
                {
                    Log.Error(e);
                    TreeNode node = new TreeNode("Error: " + e.Message)
                    {
                        ToolTipText = e.ToString(), Tag = e
                    };
                    return(new List <TreeNode>()
                    {
                        node
                    });
                }
            }
            catch (Exception e)
            {
                Log.Error(e);
                TreeNode node = new TreeNode("SINners Error: please log in")
                {
                    ToolTipText = e.ToString(), Tag = e
                };
                var objCache = new frmCharacterRoster.CharacterCache
                {
                    ErrorText = e.ToString()
                };
                node.Tag = objCache;
                return(new List <TreeNode>()
                {
                    node
                });
            }
        }
コード例 #45
0
    public void joinGame(int characterId, string name)
    {
        if (characterId < 1)
        {
            return;
        }

        Hashtable h = new Hashtable(1);

        h.Add("characterId", characterId);

        PhotonNetwork.player.SetCustomProperties(h);
        PhotonNetwork.player.NickName = name;

        NetworkManager.Instance.startConnection();
        GameObject.Find("Canvas/MainPanel/LoginOptions/JoinButton/Text").GetComponent <Text> ().text = LanguageManager.get("CONNECTING") + "...";
    }
コード例 #46
0
        public override bool TakeAction()
        {
            //int maxEquNum = ConfigEnvSet.GetInt("UserQueue.EquStrengMaxNum");
            //int coldTime = ConfigEnvSet.GetInt("UserItem.EquColdTime");

            //铜钱不足
            var package = UserItemPackage.Get(Uid);

            userItem = package.ItemPackage.Find(m => !m.IsRemove && m.UserItemID.Equals(userItemID)) ?? new UserItemInfo();
            if (ops == StrongOnce)
            {
                // 强化 1 次用钱
                strongMoney = new UserItemHelper(userItem, 1).StrongMoney;
            }
            else if (ops == StrongTenTimes)
            {
                // 强化 10 次用钱
                strongMoney = new UserItemHelper(userItem, 10).StrongMoney;
            }
            short strongMaxLv = (ContextUser.UserLv * 3).ToShort(); //MathUtils.Addition(ContextUser.UserLv, 1.ToShort()); //强化最高等级

            if (ContextUser.GameCoin < strongMoney)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St_GameCoinNotEnough;
                return(false);
            }

            //UserGeneral userGeneral = new GameDataCacheSet<UserGeneral>().FindKey(ContextUser.UserID, userItem.GeneralID);
            //if (userGeneral != null && userItem.ItemLv >= strongMaxLv)
            //{
            //    ErrorCode = LanguageManager.GetLang().ErrorCode;
            //    ErrorInfo = LanguageManager.GetLang().St1204_EquGeneralMaxLv;
            //    return false;
            //}

            if (userItem.ItemLv >= strongMaxLv)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1204_EquMaxLv;
                return(false);
            }

            itemInfo = new ConfigCacheSet <ItemBaseInfo>().FindKey(userItem.ItemID);
            if (itemInfo != null)
            {
                itemEquArray = new ConfigCacheSet <ItemEquAttrInfo>().FindAll(m => m.ItemID == itemInfo.ItemID);
            }

            if (strongMoney > ContextUser.GameCoin)
            {
                isStrong = 1;
            }
            else if (userItem.ItemLv >= strongMaxLv)
            {
                isStrong = 2;
            }


            UpdateUserItem(ContextUser, userItem, strongMoney);
            //日常任务-强化
            TaskHelper.TriggerDailyTask(Uid, 4001);

            UserGeneral general = new GameDataCacheSet <UserGeneral>().FindKey(ContextUser.UserID, userItem.GeneralID);

            if (general != null)
            {
                general.RefreshMaxLife();
            }
            return(true);
        }
コード例 #47
0
 public FileNameFormatViewModel(Settings settings, LanguageManager languageManager)
     : base(settings, languageManager)
 {
 }
コード例 #48
0
        public override bool TakeAction()
        {
            var cacheSet = new ShareCacheStruct <UserFriends>();

            _isSuccess = 1;
            if (_friendId != "")
            {
                //找到本玩家的数据
                List <UserFriends> friendArray = cacheSet.FindAll(m => m.UserID == ContextUser.UserID);
                int friendNum = ConfigEnvSet.GetInt("UserFriends.MaxFriendNum");
                //添加的好友上限
                if (friendArray.Count >= friendNum)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St9103_TheMaximumReachedAFriend;
                    return(false);
                }
                //查看是否在user库中有该玩家
                GameUser userInfo = new GameDataCacheSet <GameUser>().FindKey(_friendId);
                if (userInfo == null)
                {
                    UserCacheGlobal.LoadOffline(_friendId);
                    userInfo = new GameDataCacheSet <GameUser>().FindKey(_friendId);
                }
                if (userInfo == null)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St9103_NotFriendsUserID;
                    return(false);
                }

                //在好友表中查找本玩家 和添加好友的关系
                var userFriend  = cacheSet.FindKey(ContextUser.UserID, _friendId);
                var userFriend1 = cacheSet.FindKey(_friendId, ContextUser.UserID);

                if (userFriend == null)
                {
                    //创建新的数据 并且添加成关注类型
                    var friends = new UserFriends
                    {
                        UserID     = ContextUser.UserID,
                        FriendID   = _friendId,
                        FriendType = FriendType.Attention
                    };
                    cacheSet.Add(friends, GameEnvironment.CacheGlobalPeriod);
                    //todo test
                    friends.ChatTime = DateTime.Now;
                }
                //如果玩家数据不为空
                else
                {
                    //判断两个玩家的关系
                    if (userFriend.FriendType == FriendType.Friend)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St9103_TheUserHasAFriendIn;
                        return(false);
                    }

                    ////如果已经发送请求就不在继续发
                    //if (userFriend.FriendType == FriendType.Attention)
                    //{
                    //    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    //    ErrorInfo = LanguageManager.GetLang().St_FirendNoticeTip;
                    //    return false;
                    //}

                    //加好友都是变为关注 从仇敌那里也能转换为关注
                    if (userFriend.FriendType != FriendType.Friend)
                    {
                        userFriend.FriendType = FriendType.Attention;
                    }
                }

                //判断对方是否有和本玩家的数据 如果没有创建 有改状态
                if (userFriend1 == null)
                {
                    var friends2 = new UserFriends
                    {
                        UserID     = _friendId,
                        FriendID   = ContextUser.UserID,
                        FriendType = FriendType.Fans,
                    };
                    cacheSet.Add(friends2, GameEnvironment.CacheGlobalPeriod);
                    //todo test
                    friends2.ChatTime = DateTime.Now;
                }

                // 发送系统信件
                try
                {
                    Guid     newGuid  = Guid.NewGuid();
                    UserMail userMail = new UserMail(newGuid);
                    userMail.UserId       = Int32.Parse(_friendId);
                    userMail.MailType     = MailType.Friends;
                    userMail.Title        = LanguageManager.GetLang().St_AskFirendMailTitle;
                    userMail.Content      = string.Format(LanguageManager.GetLang().St_AskFirendTip, ContextUser.NickName);
                    userMail.SendDate     = DateTime.Now;
                    userMail.IsReply      = true;
                    userMail.ReplyStatus  = 0;
                    userMail.FromUserId   = Int32.Parse(ContextUser.UserID);
                    userMail.FromUserName = ContextUser.NickName;
                    TjxMailService mailService = new TjxMailService(ContextUser);
                    mailService.Send(userMail);
                }
                catch (Exception)
                {
                }
            }
            //上传的好友名字不为空
            else if (_friendName != null)
            {
                List <UserFriends> friendArray = cacheSet.FindAll(m => m.UserID == ContextUser.UserID);
                int friendNum = ConfigEnvSet.GetInt("UserFriends.MaxFriendNum");
                if (friendArray.Count >= friendNum)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St9103_TheMaximumReachedAFriend;
                    return(false);
                }
                GameUser friend = null;
                new GameDataCacheSet <GameUser>().Foreach((personalId, key, user) =>
                {
                    if (user.NickName == _friendName)
                    {
                        friend = user;
                        return(false);
                    }
                    return(true);
                });
                if (friend != null)
                {
                    GameUser    gameUser   = new GameDataCacheSet <GameUser>().FindKey(friend.UserID);
                    UserFriends userFriend = cacheSet.FindKey(ContextUser.UserID, _friendId);
                    if (userFriend != null)
                    {
                        if (userFriend.FriendType == FriendType.Fans)
                        {
                            this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                            this.ErrorInfo = LanguageManager.GetLang().St9103_TheUserHasTheFansIn;
                            return(false);
                        }
                        else if (userFriend.FriendType == FriendType.Blacklist)
                        {
                            this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                            this.ErrorInfo = LanguageManager.GetLang().St9103_TheUserHasTheBlacklist;
                            return(false);
                        }
                        else
                        {
                            this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                            this.ErrorInfo = LanguageManager.GetLang().St9103_TheUserHasAFriendIn;
                            return(false);
                        }
                    }
                    UserFriends friends = new UserFriends()
                    {
                        UserID     = ContextUser.UserID,
                        FriendID   = gameUser.UserID,
                        FriendType = FriendType.Attention
                    };
                    cacheSet.Add(friends, GameEnvironment.CacheGlobalPeriod);

                    UserFriends friends2 = new UserFriends()
                    {
                        UserID     = gameUser.UserID,
                        FriendID   = ContextUser.UserID,
                        FriendType = FriendType.Fans,
                    };
                    cacheSet.Add(friends2, GameEnvironment.CacheGlobalPeriod);
                }
                else
                {
                    this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                    this.ErrorInfo = LanguageManager.GetLang().St9103_DoesNotExistTheUser;
                    return(false);
                }
            }
            return(true);
        }
コード例 #49
0
        public override bool TakeAction()
        {
            var             package     = UserCrystalPackage.Get(Uid);
            UserGeneral     userGeneral = new GameDataCacheSet <UserGeneral>().FindKey(ContextUser.UserID, generalID);
            UserCrystalInfo userCrystal = package.CrystalPackage.Find(m => m.UserCrystalID.Equals(userCrystalID));

            if (userCrystal == null || userGeneral == null)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                return(false);
            }

            var userCrystalArray = package.CrystalPackage.FindAll(m => m.IsSale == 2 && m.GeneralID.Equals(0));
            var crystalArray     = package.CrystalPackage.FindAll(m => m.IsSale == 2 && m.GeneralID.Equals(generalID));

            if (ops == 0)
            {
                if (userCrystal.IsSale == 2 && userCrystal.GeneralID != 0)
                {
                    if (userCrystalArray.Count >= ContextUser.CrystalNum)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St1307_FateBackpackFull;
                        return(false);
                    }

                    if (userCrystalArray.Count < ContextUser.CrystalNum &&
                        userCrystal.GeneralID > 0 &&
                        userCrystal.Position > 0)
                    {
                        userCrystal.GeneralID = 0;
                        userCrystal.Position  = 0;
                        package.SaveCrystal(userCrystal);
                        //package.DelayChange();
                    }
                }
            }
            if (potion > IsGridOpen(userGeneral.GeneralLv))
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1213_GridNumNotEnough;
                return(false);
            }
            else if (ops == 1)
            {
                if (userCrystal.IsSale == 2)
                {
                    CrystalInfo crystalInfo = new ConfigCacheSet <CrystalInfo>().FindKey(userCrystal.CrystalID);
                    if (crystalInfo == null)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        return(false);
                    }

                    if (crystalArray.Count >= UserHelper.GetOpenNum(userGeneral.GeneralLv))
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St1309_OpenNumNotEnough;
                        return(false);
                    }

                    foreach (UserCrystalInfo crystal in crystalArray)
                    {
                        CrystalInfo crystalInfo2 = new ConfigCacheSet <CrystalInfo>().FindKey(crystal.CrystalID);
                        if (crystalInfo2 != null && crystalInfo.AbilityID == crystalInfo2.AbilityID)
                        {
                            ErrorCode = LanguageManager.GetLang().ErrorCode;
                            ErrorInfo = LanguageManager.GetLang().St1309_TheSameFate;
                            return(false);
                        }
                    }

                    UserCrystalInfo[] potionCrystalArray = package.CrystalPackage.FindAll(m => m.GeneralID == generalID && m.Position == potion).ToArray();
                    if (potionCrystalArray.Length > 0)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St1309_TheGridFullSameFate;
                        return(false);
                    }

                    if (userCrystal.IsSale == 2 &&
                        userCrystal.GeneralID == 0 &&
                        userCrystal.Position == 0)
                    {
                        userCrystal.GeneralID = generalID;
                        userCrystal.Position  = potion;
                        package.SaveCrystal(userCrystal);
                    }
                }
            }
            userGeneral.RefreshMaxLife();
            return(true);
        }
コード例 #50
0
 private void initTextLanguage()
 {
     btnLoginLabel.text = LanguageManager.GetWord("AwardView.loginAward");
     btnCodeLabel.text  = LanguageManager.GetWord("AwardView.code");
 }
コード例 #51
0
        /// Create a Armor Modification from an XmlNode.
        /// <param name="objXmlArmorNode">XmlNode to create the object from.</param>
        /// <param name="intRating">Rating of the selected ArmorMod.</param>
        /// <param name="lstWeapons">List of Weapons that are created by the Armor.</param>
        /// <param name="objWeaponNodes">List of Weapon Nodes that are created by the Armor.</param>
        /// <param name="blnSkipCost">Whether or not creating the Armor should skip the Variable price dialogue (should only be used by frmSelectArmor).</param>
        public void Create(XmlNode objXmlArmorNode, int intRating, List <Weapon> lstWeapons, bool blnSkipCost = false, bool blnSkipSelectForms = false)
        {
            if (objXmlArmorNode.TryGetStringFieldQuickly("name", ref _strName))
            {
                _objCachedMyXmlNode = null;
            }
            objXmlArmorNode.TryGetStringFieldQuickly("category", ref _strCategory);
            objXmlArmorNode.TryGetStringFieldQuickly("armorcapacity", ref _strArmorCapacity);
            objXmlArmorNode.TryGetStringFieldQuickly("gearcapacity", ref _strGearCapacity);
            _intRating = intRating;
            objXmlArmorNode.TryGetInt32FieldQuickly("armor", ref _intA);
            objXmlArmorNode.TryGetInt32FieldQuickly("maxrating", ref _intMaxRating);
            objXmlArmorNode.TryGetStringFieldQuickly("avail", ref _strAvail);
            objXmlArmorNode.TryGetStringFieldQuickly("source", ref _strSource);
            objXmlArmorNode.TryGetStringFieldQuickly("page", ref _strPage);
            if (!objXmlArmorNode.TryGetStringFieldQuickly("altnotes", ref _strNotes))
            {
                objXmlArmorNode.TryGetStringFieldQuickly("notes", ref _strNotes);
            }
            _nodBonus         = objXmlArmorNode["bonus"];
            _nodWirelessBonus = objXmlArmorNode["wirelessbonus"];
            _blnWirelessOn    = _nodWirelessBonus != null;

            objXmlArmorNode.TryGetStringFieldQuickly("cost", ref _strCost);

            // Check for a Variable Cost.
            if (!blnSkipCost && _strCost.StartsWith("Variable("))
            {
                string strFirstHalf   = _strCost.TrimStart("Variable(", true).TrimEnd(')');
                string strSecondHalf  = string.Empty;
                int    intHyphenIndex = strFirstHalf.IndexOf('-');
                if (intHyphenIndex != -1)
                {
                    if (intHyphenIndex + 1 < strFirstHalf.Length)
                    {
                        strSecondHalf = strFirstHalf.Substring(intHyphenIndex + 1);
                    }
                    strFirstHalf = strFirstHalf.Substring(0, intHyphenIndex);
                }

                if (!blnSkipSelectForms)
                {
                    decimal decMin = decimal.MinValue;
                    decimal decMax = decimal.MaxValue;
                    if (intHyphenIndex != -1)
                    {
                        decMin = Convert.ToDecimal(strFirstHalf, GlobalOptions.InvariantCultureInfo);
                        decMax = Convert.ToDecimal(strSecondHalf, GlobalOptions.InvariantCultureInfo);
                    }
                    else
                    {
                        decMin = Convert.ToDecimal(strFirstHalf.FastEscape('+'), GlobalOptions.InvariantCultureInfo);
                    }

                    if (decMin != decimal.MinValue || decMax != decimal.MaxValue)
                    {
                        string strNuyenFormat   = _objCharacter.Options.NuyenFormat;
                        int    intDecimalPlaces = strNuyenFormat.IndexOf('.');
                        if (intDecimalPlaces == -1)
                        {
                            intDecimalPlaces = 0;
                        }
                        else
                        {
                            intDecimalPlaces = strNuyenFormat.Length - intDecimalPlaces - 1;
                        }
                        frmSelectNumber frmPickNumber = new frmSelectNumber(intDecimalPlaces);
                        if (decMax > 1000000)
                        {
                            decMax = 1000000;
                        }
                        frmPickNumber.Minimum     = decMin;
                        frmPickNumber.Maximum     = decMax;
                        frmPickNumber.Description = LanguageManager.GetString("String_SelectVariableCost", GlobalOptions.Language).Replace("{0}", DisplayNameShort(GlobalOptions.Language));
                        frmPickNumber.AllowCancel = false;
                        frmPickNumber.ShowDialog();
                        _strCost = frmPickNumber.SelectedValue.ToString(GlobalOptions.InvariantCultureInfo);
                    }
                    else
                    {
                        _strCost = strFirstHalf;
                    }
                }
                else
                {
                    _strCost = strFirstHalf;
                }
            }

            if (objXmlArmorNode["bonus"] != null && !blnSkipSelectForms)
            {
                if (!ImprovementManager.CreateImprovements(_objCharacter, Improvement.ImprovementSource.ArmorMod, _guiID.ToString("D"), objXmlArmorNode["bonus"], false, intRating, DisplayNameShort(GlobalOptions.Language)))
                {
                    _guiID = Guid.Empty;
                    return;
                }
                if (!string.IsNullOrEmpty(ImprovementManager.SelectedValue))
                {
                    _strExtra = ImprovementManager.SelectedValue;
                }
            }

            // Add any Gear that comes with the Armor.
            if (objXmlArmorNode["gears"] != null)
            {
                XmlDocument objXmlGearDocument = XmlManager.Load("gear.xml");
                foreach (XmlNode objXmlArmorGear in objXmlArmorNode.SelectNodes("gears/usegear"))
                {
                    intRating = 0;
                    string strForceValue = string.Empty;
                    objXmlArmorGear.TryGetInt32FieldQuickly("rating", ref intRating);
                    objXmlArmorGear.TryGetStringFieldQuickly("select", ref strForceValue);

                    XmlNode objXmlGear = objXmlGearDocument.SelectSingleNode("/chummer/gears/gear[name = \"" + objXmlArmorGear.InnerText + "\"]");
                    Gear    objGear    = new Gear(_objCharacter);

                    objGear.Create(objXmlGear, intRating, lstWeapons, strForceValue, !blnSkipSelectForms);

                    objGear.Capacity      = "[0]";
                    objGear.ArmorCapacity = "[0]";
                    objGear.Cost          = "0";
                    objGear.MaxRating     = objGear.Rating;
                    objGear.MinRating     = objGear.Rating;
                    objGear.ParentID      = InternalId;
                    _lstGear.Add(objGear);
                }
            }

            // Add Weapons if applicable.
            if (objXmlArmorNode.InnerXml.Contains("<addweapon>"))
            {
                XmlDocument objXmlWeaponDocument = XmlManager.Load("weapons.xml");

                // More than one Weapon can be added, so loop through all occurrences.
                foreach (XmlNode objXmlAddWeapon in objXmlArmorNode.SelectNodes("addweapon"))
                {
                    string  strLoopID    = objXmlAddWeapon.InnerText;
                    XmlNode objXmlWeapon = strLoopID.IsGuid()
                        ? objXmlWeaponDocument.SelectSingleNode("/chummer/weapons/weapon[id = \"" + strLoopID + "\"]")
                        : objXmlWeaponDocument.SelectSingleNode("/chummer/weapons/weapon[name = \"" + strLoopID + "\"]");

                    Weapon objGearWeapon = new Weapon(_objCharacter);
                    objGearWeapon.Create(objXmlWeapon, lstWeapons, true, !blnSkipSelectForms, blnSkipCost);
                    objGearWeapon.ParentID = InternalId;
                    lstWeapons.Add(objGearWeapon);

                    _guiWeaponID = Guid.Parse(objGearWeapon.InternalId);
                }
            }
        }
コード例 #52
0
        /// Create a Vehicle Modification from an XmlNode and return the TreeNodes for it.
        /// <param name="objXmlMod">XmlNode to create the object from.</param>
        /// <param name="objNode">TreeNode to populate a TreeView.</param>
        /// <param name="intRating">Selected Rating for the Gear.</param>
        /// <param name="objParent">Vehicle that the mod will be attached to.</param>
        /// <param name="intMarkup">Discount or markup that applies to the base cost of the mod.</param>
        public void Create(XmlNode objXmlMod, TreeNode objNode, int intRating, Vehicle objParent, decimal decMarkup = 0)
        {
            if (objParent == null)
            {
                throw new ArgumentNullException(nameof(objParent));
            }
            Parent = objParent;
            if (objXmlMod == null)
            {
                Utils.BreakIfDebug();
            }
            objXmlMod.TryGetStringFieldQuickly("name", ref _strName);
            objXmlMod.TryGetStringFieldQuickly("category", ref _strCategory);
            objXmlMod.TryGetStringFieldQuickly("limit", ref _strLimit);
            objXmlMod.TryGetStringFieldQuickly("slots", ref _strSlots);
            _intRating = intRating;
            if (objXmlMod["downgrade"] != null)
            {
                _blnDowngrade = true;
            }

            objXmlMod.TryGetStringFieldQuickly("capacity", ref _strCapacity);
            objXmlMod.TryGetStringFieldQuickly("rating", ref _strMaxRating);
            objXmlMod.TryGetInt32FieldQuickly("response", ref _intResponse);
            objXmlMod.TryGetInt32FieldQuickly("system", ref _intSystem);
            objXmlMod.TryGetInt32FieldQuickly("firewall", ref _intFirewall);
            objXmlMod.TryGetInt32FieldQuickly("signal", ref _intSignal);
            objXmlMod.TryGetInt32FieldQuickly("pilot", ref _intPilot);
            objXmlMod.TryGetInt32FieldQuickly("conditionmonitor", ref _intConditionMonitor);
            objXmlMod.TryGetStringFieldQuickly("weaponmountcategories", ref _strWeaponMountCategories);
            // Add Subsytem information if applicable.
            if (objXmlMod.InnerXml.Contains("subsystems"))
            {
                string      strSubsystem     = string.Empty;
                XmlNodeList objXmlSubsystems = objXmlMod.SelectNodes("subsystems/subsystem");
                if (objXmlSubsystems != null)
                {
                    strSubsystem = objXmlSubsystems.Cast <XmlNode>().Aggregate(strSubsystem, (current, objXmlSubsystem) => current + (objXmlSubsystem.InnerText + ","));
                }
                _strSubsystems = strSubsystem;
            }
            objXmlMod.TryGetStringFieldQuickly("avail", ref _strAvail);

            // Check for a Variable Cost.
            if (objXmlMod["cost"] != null)
            {
                _strCost = objXmlMod["cost"].InnerText;
                if (_strCost.StartsWith("Variable"))
                {
                    decimal decMin  = 0;
                    decimal decMax  = decimal.MaxValue;
                    string  strCost = _strCost.TrimStart("Variable", true).Trim("()".ToCharArray());
                    if (strCost.Contains('-'))
                    {
                        string[] strValues = strCost.Split('-');
                        decMin = Convert.ToDecimal(strValues[0], GlobalOptions.InvariantCultureInfo);
                        decMax = Convert.ToDecimal(strValues[1], GlobalOptions.InvariantCultureInfo);
                    }
                    else
                    {
                        decMin = Convert.ToDecimal(strCost.FastEscape('+'), GlobalOptions.InvariantCultureInfo);
                    }

                    if (decMin != 0 || decMax != decimal.MaxValue)
                    {
                        frmSelectNumber frmPickNumber = new frmSelectNumber();
                        if (decMax > 1000000)
                        {
                            decMax = 1000000;
                        }
                        frmPickNumber.Minimum     = decMin;
                        frmPickNumber.Maximum     = decMax;
                        frmPickNumber.Description = LanguageManager.GetString("String_SelectVariableCost").Replace("{0}", DisplayNameShort);
                        frmPickNumber.AllowCancel = false;
                        frmPickNumber.ShowDialog();
                        _strCost = frmPickNumber.SelectedValue.ToString();
                    }
                }
            }
            _decMarkup = decMarkup;

            objXmlMod.TryGetStringFieldQuickly("source", ref _strSource);
            objXmlMod.TryGetStringFieldQuickly("page", ref _strPage);
            _nodBonus         = objXmlMod["bonus"];
            _nodWirelessBonus = objXmlMod["wirelessbonus"];
            _blnWirelessOn    = _nodWirelessBonus != null;

            if (GlobalOptions.Language != GlobalOptions.DefaultLanguage)
            {
                XmlNode objModNode = MyXmlNode;
                if (objModNode != null)
                {
                    objModNode.TryGetStringFieldQuickly("translate", ref _strAltName);
                    objModNode.TryGetStringFieldQuickly("altpage", ref _strAltPage);
                }

                XmlDocument objXmlDocument = XmlManager.Load("vehicles.xml");
                objModNode      = objXmlDocument.SelectSingleNode("/chummer/categories/category[. = \"" + _strCategory + "\"]");
                _strAltCategory = objModNode?.Attributes?["translate"]?.InnerText;
            }

            objNode.Text = DisplayName;
            objNode.Tag  = _guiID.ToString();
        }
コード例 #53
0
ファイル: WeaponAccessory.cs プロジェクト: Yalnix/chummer5a
        /// Create a Weapon Accessory from an XmlNode and return the TreeNodes for it.
        /// <param name="objXmlAccessory">XmlNode to create the object from.</param>
        /// <param name="objNode">TreeNode to populate a TreeView.</param>
        /// <param name="strMount">Mount slot that the Weapon Accessory will consume.</param>
        /// <param name="intRating">Rating of the Weapon Accessory.</param>
        public void Create(XmlNode objXmlAccessory, Tuple <string, string> strMount, int intRating, bool blnSkipCost = false, bool blnCreateChildren = true, bool blnCreateImprovements = true)
        {
            if (objXmlAccessory.TryGetStringFieldQuickly("name", ref _strName))
            {
                _objCachedMyXmlNode = null;
            }
            _strMount      = strMount.Item1;
            _strExtraMount = strMount.Item2;
            _intRating     = intRating;
            objXmlAccessory.TryGetStringFieldQuickly("avail", ref _strAvail);
            // Check for a Variable Cost.
            if (blnSkipCost)
            {
                _strCost = "0";
            }
            else
            {
                _strCost = objXmlAccessory["cost"]?.InnerText ?? "0";
                if (_strCost.StartsWith("Variable("))
                {
                    decimal decMin  = 0;
                    decimal decMax  = decimal.MaxValue;
                    string  strCost = _strCost.TrimStart("Variable(", true).TrimEnd(')');
                    if (strCost.Contains('-'))
                    {
                        string[] strValues = strCost.Split('-');
                        decMin = Convert.ToDecimal(strValues[0], GlobalOptions.InvariantCultureInfo);
                        decMax = Convert.ToDecimal(strValues[1], GlobalOptions.InvariantCultureInfo);
                    }
                    else
                    {
                        decMin = Convert.ToDecimal(strCost.FastEscape('+'), GlobalOptions.InvariantCultureInfo);
                    }

                    if (decMin != 0 || decMax != decimal.MaxValue)
                    {
                        string strNuyenFormat   = _objCharacter.Options.NuyenFormat;
                        int    intDecimalPlaces = strNuyenFormat.IndexOf('.');
                        if (intDecimalPlaces == -1)
                        {
                            intDecimalPlaces = 0;
                        }
                        else
                        {
                            intDecimalPlaces = strNuyenFormat.Length - intDecimalPlaces - 1;
                        }
                        frmSelectNumber frmPickNumber = new frmSelectNumber(intDecimalPlaces);
                        if (decMax > 1000000)
                        {
                            decMax = 1000000;
                        }
                        frmPickNumber.Minimum     = decMin;
                        frmPickNumber.Maximum     = decMax;
                        frmPickNumber.Description = LanguageManager.GetString("String_SelectVariableCost", GlobalOptions.Language).Replace("{0}", DisplayNameShort(GlobalOptions.Language));
                        frmPickNumber.AllowCancel = false;
                        frmPickNumber.ShowDialog();
                        _strCost = frmPickNumber.SelectedValue.ToString(GlobalOptions.InvariantCultureInfo);
                    }
                }
            }

            objXmlAccessory.TryGetStringFieldQuickly("source", ref _strSource);
            objXmlAccessory.TryGetStringFieldQuickly("page", ref _strPage);
            _nodAllowGear = objXmlAccessory["allowgear"];
            if (!objXmlAccessory.TryGetStringFieldQuickly("altnotes", ref _strNotes))
            {
                objXmlAccessory.TryGetStringFieldQuickly("notes", ref _strNotes);
            }
            objXmlAccessory.TryGetStringFieldQuickly("rc", ref _strRC);
            objXmlAccessory.TryGetBoolFieldQuickly("rcdeployable", ref _blnDeployable);
            objXmlAccessory.TryGetInt32FieldQuickly("rcgroup", ref _intRCGroup);
            objXmlAccessory.TryGetStringFieldQuickly("conceal", ref _strConceal);
            objXmlAccessory.TryGetInt32FieldQuickly("ammoslots", ref _intAmmoSlots);
            objXmlAccessory.TryGetStringFieldQuickly("ammoreplace", ref _strAmmoReplace);
            objXmlAccessory.TryGetInt32FieldQuickly("accuracy", ref _intAccuracy);
            objXmlAccessory.TryGetStringFieldQuickly("dicepool", ref _strDicePool);
            objXmlAccessory.TryGetStringFieldQuickly("damagetype", ref _strDamageType);
            objXmlAccessory.TryGetStringFieldQuickly("damage", ref _strDamage);
            objXmlAccessory.TryGetStringFieldQuickly("damagereplace", ref _strDamageReplace);
            objXmlAccessory.TryGetStringFieldQuickly("firemode", ref _strFireMode);
            objXmlAccessory.TryGetStringFieldQuickly("firemodereplace", ref _strFireModeReplace);
            objXmlAccessory.TryGetStringFieldQuickly("ap", ref _strAP);
            objXmlAccessory.TryGetStringFieldQuickly("apreplace", ref _strAPReplace);
            objXmlAccessory.TryGetStringFieldQuickly("addmode", ref _strAddMode);
            objXmlAccessory.TryGetInt32FieldQuickly("fullburst", ref _intFullBurst);
            objXmlAccessory.TryGetInt32FieldQuickly("suppressive", ref _intSuppressive);
            objXmlAccessory.TryGetInt32FieldQuickly("rangebonus", ref _intRangeBonus);
            objXmlAccessory.TryGetStringFieldQuickly("extra", ref _strExtra);
            objXmlAccessory.TryGetInt32FieldQuickly("ammobonus", ref _intAmmoBonus);
            objXmlAccessory.TryGetInt32FieldQuickly("accessorycostmultiplier", ref _intAccessoryCostMultiplier);

            // Add any Gear that comes with the Weapon Accessory.
            if (objXmlAccessory["gears"] != null && blnCreateChildren)
            {
                XmlDocument objXmlGearDocument = XmlManager.Load("gear.xml");
                foreach (XmlNode objXmlAccessoryGear in objXmlAccessory.SelectNodes("gears/usegear"))
                {
                    XmlNode objXmlAccessoryGearName = objXmlAccessoryGear["name"];
                    XmlAttributeCollection objXmlAccessoryGearNameAttributes = objXmlAccessoryGearName.Attributes;
                    int     intGearRating           = 0;
                    decimal decGearQty              = 1;
                    string  strChildForceSource     = objXmlAccessoryGear["source"]?.InnerText ?? string.Empty;
                    string  strChildForcePage       = objXmlAccessoryGear["page"]?.InnerText ?? string.Empty;
                    string  strChildForceValue      = objXmlAccessoryGearNameAttributes?["select"]?.InnerText ?? string.Empty;
                    bool    blnStartCollapsed       = objXmlAccessoryGearNameAttributes?["startcollapsed"]?.InnerText == bool.TrueString;
                    bool    blnChildCreateChildren  = objXmlAccessoryGearNameAttributes?["createchildren"]?.InnerText != bool.FalseString;
                    bool    blnAddChildImprovements = objXmlAccessoryGearNameAttributes?["addimprovements"]?.InnerText == bool.FalseString ? false : blnCreateImprovements;
                    if (objXmlAccessoryGear["rating"] != null)
                    {
                        intGearRating = Convert.ToInt32(objXmlAccessoryGear["rating"].InnerText);
                    }
                    if (objXmlAccessoryGearNameAttributes?["qty"] != null)
                    {
                        decGearQty = Convert.ToDecimal(objXmlAccessoryGearNameAttributes["qty"].InnerText, GlobalOptions.InvariantCultureInfo);
                    }

                    XmlNode objXmlGear = objXmlGearDocument.SelectSingleNode("/chummer/gears/gear[name = \"" + objXmlAccessoryGearName.InnerText + "\" and category = \"" + objXmlAccessoryGear["category"].InnerText + "\"]");
                    Gear    objGear    = new Gear(_objCharacter);

                    List <Weapon> lstWeapons = new List <Weapon>();

                    objGear.Create(objXmlGear, intGearRating, lstWeapons, strChildForceValue, blnAddChildImprovements, blnChildCreateChildren);

                    objGear.Quantity  = decGearQty;
                    objGear.Cost      = "0";
                    objGear.MinRating = intGearRating;
                    objGear.MaxRating = intGearRating;
                    objGear.ParentID  = InternalId;
                    if (!string.IsNullOrEmpty(strChildForceSource))
                    {
                        objGear.Source = strChildForceSource;
                    }
                    if (!string.IsNullOrEmpty(strChildForcePage))
                    {
                        objGear.Page = strChildForcePage;
                    }
                    _lstGear.Add(objGear);

                    // Change the Capacity of the child if necessary.
                    if (objXmlAccessoryGear["capacity"] != null)
                    {
                        objGear.Capacity = '[' + objXmlAccessoryGear["capacity"].InnerText + ']';
                    }
                }
            }
        }
コード例 #54
0
        public override void BuildPacket()
        {
            PushIntoStack(idolInfo == null ? LanguageManager.GetLang().shortInt : idolInfo.IdolLv);
            PushIntoStack(idolInfo == null ? 0 : idolInfo.CurrExperience);
            PushIntoStack(maxAura);
            PushIntoStack(guildLogArray.Count);
            foreach (MemberLog log in guildLogArray)
            {
                GameUser gameUser = new GameDataCacheSet <GameUser>().FindKey(log.UserID);
                if (gameUser == null)
                {
                    gameUser = UserCacheGlobal.CheckLoadUser(log.UserID);
                }
                DataStruct dsItem = new DataStruct();
                dsItem.PushIntoStack(log.UserID);
                dsItem.PushIntoStack(gameUser == null ? string.Empty : gameUser.NickName.ToNotNullString());
                dsItem.PushIntoStack(log.LogType);
                dsItem.PushIntoStack(log.GainAura);
                dsItem.PushIntoStack(GetGainDate(log.InsertDate));
                dsItem.PushIntoStack(log.IdolID);
                PushIntoStack(dsItem);
            }
            PushIntoStack(idolInfoArray.Count);
            foreach (GuildIdolInfo guildIdol in idolInfoArray)
            {
                if (isXs == 2)
                {
                    isShow = 2;
                }
                else
                {
                    if (guildIdol.IdolID == 1)
                    {
                        isShow = 1;
                    }
                    if (guildIdol.IdolID == 2 && VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.GuildMemberShangSuHeXiang))
                    {
                        isShow = 1;
                    }
                    else if (guildIdol.IdolID == 2)
                    {
                        isShow = 2;
                    }
                    if (guildIdol.IdolID == 3 && VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.GuildMemberShangTianMuXiang))
                    {
                        isShow = 1;
                    }
                    else if (guildIdol.IdolID == 3)
                    {
                        isShow = 2;
                    }
                }
                DataStruct dsItem = new DataStruct();
                dsItem.PushIntoStack((short)guildIdol.IdolID);
                dsItem.PushIntoStack(guildIdol.GainObtion);
                dsItem.PushIntoStack(guildIdol.GainBlessing);
                dsItem.PushIntoStack(guildIdol.GainAura);
                dsItem.PushIntoStack(guildIdol.UseExpNum);
                dsItem.PushIntoStack(guildIdol.UseGold);
                dsItem.PushIntoStack(isShow);

                PushIntoStack(dsItem);
            }
        }
コード例 #55
0
ファイル: MainViewModel.cs プロジェクト: mchampaneri/Captura
        public MainViewModel(AudioSource AudioSource,
                             VideoViewModel VideoViewModel,
                             ISystemTray SystemTray,
                             IRegionProvider RegionProvider,
                             IWebCamProvider WebCamProvider,
                             WebcamOverlay WebcamOverlay,
                             IMainWindow MainWindow,
                             Settings Settings,
                             RecentViewModel RecentViewModel,
                             LanguageManager LanguageManager,
                             HotKeyManager HotKeyManager,
                             CustomOverlaysViewModel CustomOverlays,
                             CustomImageOverlaysViewModel CustomImageOverlays) : base(Settings, LanguageManager)
        {
            this.AudioSource         = AudioSource;
            this.VideoViewModel      = VideoViewModel;
            _systemTray              = SystemTray;
            _regionProvider          = RegionProvider;
            this.WebCamProvider      = WebCamProvider;
            _webcamOverlay           = WebcamOverlay;
            _mainWindow              = MainWindow;
            this.RecentViewModel     = RecentViewModel;
            this.HotKeyManager       = HotKeyManager;
            this.CustomOverlays      = CustomOverlays;
            this.CustomImageOverlays = CustomImageOverlays;

            #region Commands
            ScreenShotCommand = new DelegateCommand(() => CaptureScreenShot());

            ScreenShotActiveCommand = new DelegateCommand(() => SaveScreenShot(ScreenShotWindow(Window.ForegroundWindow)));

            ScreenShotDesktopCommand = new DelegateCommand(() => SaveScreenShot(ScreenShotWindow(Window.DesktopWindow)));

            RecordCommand = new DelegateCommand(OnRecordExecute);

            RefreshCommand = new DelegateCommand(OnRefresh);

            PauseCommand = new DelegateCommand(OnPauseExecute, false);

            OpenOutputFolderCommand = new DelegateCommand(OpenOutputFolder);

            SelectOutputFolderCommand = new DelegateCommand(SelectOutputFolder);

            ResetFFMpegFolderCommand = new DelegateCommand(() => Settings.FFMpeg.FolderPath = "");
            #endregion

            SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;

            AudioSource.PropertyChanged += (Sender, Args) =>
            {
                switch (Args.PropertyName)
                {
                case nameof(AudioSource.SelectedRecordingSource):
                case nameof(AudioSource.SelectedLoopbackSource):
                case null:
                case "":
                    CheckFunctionalityAvailability();
                    break;
                }
            };

            VideoViewModel.PropertyChanged += (Sender, Args) =>
            {
                switch (Args.PropertyName)
                {
                case nameof(VideoViewModel.SelectedVideoSourceKind):
                case nameof(VideoViewModel.SelectedVideoSource):
                case null:
                case "":
                    CheckFunctionalityAvailability();
                    break;
                }
            };

            // If Output Dircetory is not set. Set it to Documents\Captura\
            if (string.IsNullOrWhiteSpace(Settings.OutPath))
            {
                Settings.OutPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Captura");
            }

            // Create the Output Directory if it does not exist
            Settings.EnsureOutPath();

            // Handle Hoykeys
            HotKeyManager.HotkeyPressed += Service =>
            {
                switch (Service)
                {
                case ServiceName.Recording:
                    RecordCommand?.ExecuteIfCan();
                    break;

                case ServiceName.Pause:
                    PauseCommand?.ExecuteIfCan();
                    break;

                case ServiceName.ScreenShot:
                    ScreenShotCommand?.ExecuteIfCan();
                    break;

                case ServiceName.ActiveScreenShot:
                    ScreenShotActiveCommand?.ExecuteIfCan();
                    break;

                case ServiceName.DesktopScreenShot:
                    ScreenShotDesktopCommand?.ExecuteIfCan();
                    break;

                case ServiceName.ToggleMouseClicks:
                    Settings.Clicks.Display = !Settings.Clicks.Display;
                    break;

                case ServiceName.ToggleKeystrokes:
                    Settings.Keystrokes.Display = !Settings.Keystrokes.Display;
                    break;
                }
            };
        }
コード例 #56
0
 public PowersTabUserControl()
 {
     InitializeComponent();
     LanguageManager.TranslateWinForm(GlobalOptions.Language, this);
 }
コード例 #57
0
ファイル: Platform.cs プロジェクト: DAStass/Eddie
        public override void OnReport(Report report)
        {
            base.OnReport(report);

            report.Add("ifconfig", (LocateExecutable("ifconfig") != "") ? SystemShell.Shell0(LocateExecutable("ifconfig")) : "'ifconfig' " + LanguageManager.GetText("NotFound"));
        }
コード例 #58
0
 /// <summary>
 /// Calculate the number of Adept Power Points used.
 /// </summary>
 public void CalculatePowerPoints()
 {
     lblPowerPoints.Text = string.Format("{1} ({0} " + LanguageManager.GetString("String_Remaining", GlobalOptions.Language) + ")", PowerPointsRemaining, PowerPointsTotal);
     ValidateVisibility();
 }
コード例 #59
0
        public override bool TakeAction()
        {
            BossCombat   bossCombat   = new BossCombat(_activeId);
            GameActive   gameActive   = bossCombat.GameActive;
            CombatStatus combatStatus = gameActive.RefreshStatus();

            if (combatStatus == CombatStatus.Killed || CombatHelper.IsBossKill(_activeId))
            {
                this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                this.ErrorInfo = LanguageManager.GetLang().St5405_BossKilled;
                return(false);
            }
            else if (combatStatus == CombatStatus.Wait)
            {
                this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                this.ErrorInfo = LanguageManager.GetLang().St5405_CombatWait;
                return(false);
            }
            else if (combatStatus == CombatStatus.Over)
            {
                this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                this.ErrorInfo = LanguageManager.GetLang().St5405_CombatOver;
                return(false);
            }
            else if (combatStatus == CombatStatus.Combat)
            {
                var cuser = bossCombat.GetCombatUser(Uid);
                if (cuser != null && cuser.CodeTime > 0)
                {
                    this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                    this.ErrorInfo = LanguageManager.GetLang().St5402_IsReliveError;
                    return(false);
                }
                var boss = bossCombat.Boss;
                if (boss.IsOver)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St5405_BossKilled;
                    return(false);
                }
                lock (thisLock)
                {
                    if (boss.IsOver)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St5405_BossKilled;
                        return(false);
                    }
                    IsWin = bossCombat.Combat(ContextUser, bossProcess);
                }
                _userTalPriority = CombatHelper.TotalPriorityNum(ContextUser.UserID, 0);
                _npcTalPriority  = 0;
            }
            else
            {
                this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                this.ErrorInfo = LanguageManager.GetLang().St5402_CombatNoStart;
                return(false);
            }
            selfAbilityEffectList = UserAbilityHelper.GetSelfAbilityEffectList(ContextUser.UserID, 0);
            return(true);
        }
コード例 #60
0
ファイル: Action7006.cs プロジェクト: zxx0367/Scut-samples
        public override bool TakeAction()
        {
            var package      = UserItemPackage.Get(Uid);
            var userItemList = package.ItemPackage.FindAll(m => !m.IsRemove && m.UserItemID.Equals(_userItemId));

            if (userItemList.Count == 0)
            {
                return(false);
            }
            //原因:卖出装备,装备上有灵件时提示
            int currNum = ContextUser.SparePartList.FindAll(m => m.UserItemID.Equals(_userItemId)).Count;

            if (currNum > 0)
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St7006_UserItemHaveSpare;
                return(false);
            }
            foreach (var userItem in userItemList)
            {
                if (ItemCheck.check(_userItemId))
                {
                    continue;
                }
                if (userItem.ItemStatus == ItemStatus.Sell)
                {
                    package.RemoveItem(userItem);
                    continue;
                }
                if (userItem.ItemStatus != ItemStatus.Sell && userItem.SoldDate > MathUtils.SqlMinDate)
                {
                    userItem.SoldDate = MathUtils.SqlMinDate;
                    //package.Update();
                    continue;
                }
                ItemBaseInfo itemInfo = new ConfigCacheSet <ItemBaseInfo>().FindKey(userItem.ItemID);
                if (itemInfo != null)
                {
                    int salePrice;
                    if (itemInfo.ItemType == ItemType.ZhuangBei)
                    {
                        salePrice = UserHelper.StrongEquPayPrice(Uid, userItem.UserItemID);
                    }
                    else
                    {
                        salePrice = (itemInfo.SalePrice * userItem.Num);
                    }
                    _salePrice = salePrice;
                    if (userItem.ItemStatus != ItemStatus.Sell)
                    {
                        ItemCheck.add(_userItemId);
                        UserItemHelper.AddItemLog(ContextUser.UserID, userItem.ItemID, userItem.Num, userItem.ItemLv, 3, userItem.UserItemID);
                        //package.RemoveItem(userItem);
                        package.ItemPackage.Remove(userItem);
                        ContextUser.GameCoin = MathUtils.Addition(ContextUser.GameCoin, salePrice, int.MaxValue);
                        //ContextUser.Update();
                    }
                }
            }
            return(true);
        }