Exemplo n.º 1
0
        private bool isApplicableContext(LevelVariable lvRequestedContext)
        {
            LevelVariableContext selectedContext = this.GetSelectedContext();

            bool returnIsApplicableContext = false;

            if (lvRequestedContext.Context.CompareTo(selectedContext) == 0)
            {
                returnIsApplicableContext = true;
            }
            else if (lvRequestedContext.Context.ContextType == LevelVariableContextType.All)
            {
                returnIsApplicableContext = true;
            }
            else if (lvRequestedContext.Context.ContextType == LevelVariableContextType.GameMode &&
                     selectedContext.ContextType == LevelVariableContextType.Level)
            {
                string targetPlaylist = this.Client.GetPlaylistByMapname(selectedContext.ContextTarget);

                if (String.Compare(lvRequestedContext.Context.ContextTarget, targetPlaylist, true) == 0)
                {
                    returnIsApplicableContext = true;
                }
            }

            return(returnIsApplicableContext);
        }
        private void ValidateAddLevelVariablesToEffects(LevelVariable lvRequestedContext, List <LevelVariable> lstReturnedValues)
        {
            this.InvokeIfRequired(() =>
            {
                LevelVariableContext selectedContext = this.GetSelectedContext();

                if (this.isApplicableContext(lvRequestedContext) == true)
                {
                    this.AddLevelVariablesToEffects(lvRequestedContext, lstReturnedValues);

                    if (lvRequestedContext.Context.CompareTo(selectedContext) == 0)
                    {
                        if (this.lsvEvaluatedEffect.Items.ContainsKey("totalEvaluatedEffects") == false)
                        {
                            this.lsvEvaluatedEffect.Items.Add(this.CreateVariableEffectItem("totalEvaluatedEffects", this.Language.GetLocalized("uscServerSettingsPanel.lsvEvaluatedEffect.items.totalEvaluatedEffects"), new Font(this.Font, FontStyle.Bold)));
                        }

                        this.UpdateTotalEffects();
                    }
                }

                foreach (ColumnHeader col in this.lsvEvaluatedEffect.Columns)
                {
                    col.Width = -2;
                }
            });
        }
        private void GetSelectedLevelVariables()
        {
            this.InvokeIfRequired(() =>
            {
                LevelVariableContext selectedContext = this.GetSelectedContext();

                this.lsvEvaluatedEffect.Items.Clear();

                // If we just got a gamemode or level
                if (selectedContext.ContextType == LevelVariableContextType.GameMode || selectedContext.ContextType == LevelVariableContextType.Level)
                {
                    // Then we need the context of "all" to evaluate the effect.
                    this.GetLevelVariablesByContext(new LevelVariableContext(LevelVariableContextType.All, String.Empty));

                    // If we just got a level
                    if (selectedContext.ContextType == LevelVariableContextType.Level && this.cboSettingsLevels.SelectedItem != null)
                    {
                        // Then we need the context of the levels gamemode to evaluate the effect.
                        this.GetLevelVariablesByContext(new LevelVariableContext(LevelVariableContextType.GameMode, ((CMap)this.cboSettingsLevels.SelectedItem).PlayList));
                    }
                }

                this.GetLevelVariablesByContext(selectedContext);
            });
        }
Exemplo n.º 4
0
        private void m_prcClient_LevelVariablesClear(FrostbiteClient sender, LevelVariable lvRequestedContext)
        {
            LevelVariableContext selectedContext = this.GetSelectedContext();

            if (selectedContext.CompareTo(lvRequestedContext.Context) == 0)
            {
                this.GetSelectedLevelVariables();

                this.OnSettingResponse("levelvars.clear", true, true);
            }
        }
Exemplo n.º 5
0
        private void m_prcClient_LevelVariablesList(FrostbiteClient sender, LevelVariable lvRequestedContext, List <LevelVariable> lstReturnedValues)
        {
            LevelVariableContext selectedContext = this.GetSelectedContext();

            if (selectedContext.CompareTo(lvRequestedContext.Context) == 0)
            {
                this.SetCurrentSelectedLevelVariables(lstReturnedValues);
            }

            this.ValidateAddLevelVariablesToEffects(lvRequestedContext, lstReturnedValues);
        }
Exemplo n.º 6
0
        private void SetLevelVariablesByContext(LevelVariableContext context, string variable, string value)
        {
            if (this.Client != null && this.Client.Game != null)
            {
                this.Client.Game.SendLevelVarsSetPacket(context, variable, value);
            }

            //if (context.ContextTarget.Length > 0) {
            //    this.SendCommand("levelVars.set", context.ContextType.ToString().ToLower(), context.ContextTarget, variable, value);
            //}
            //else {
            //    this.SendCommand("levelVars.set", context.ContextType.ToString().ToLower(), variable, value);
            //}
        }
Exemplo n.º 7
0
        private void GetLevelVariablesByContext(LevelVariableContext context)
        {
            if (this.Client != null && this.Client.Game != null)
            {
                this.Client.Game.SendLevelVarsListPacket(context);
            }

            //if (context.ContextTarget.Length > 0) {
            //    this.SendCommand("levelVars.list", context.ContextType.ToString().ToLower(), context.ContextTarget);
            //}
            //else {
            //    this.SendCommand("levelVars.list", context.ContextType.ToString().ToLower());
            //}
        }
Exemplo n.º 8
0
        private void btnClearLevelSettings_Click(object sender, EventArgs e)
        {
            this.WaitForSettingResponse("levelvars.clear", null);

            LevelVariableContext selectedContext = this.GetSelectedContext();

            if (this.Client != null && this.Client.Game != null)
            {
                this.Client.Game.SendLevelVarsClearPacket(selectedContext);

                //if (selectedContext.ContextTarget.Length > 0) {
                //    this.SendCommand("levelVars.clear", selectedContext.ContextType.ToString().ToLower(), selectedContext.ContextTarget);
                //}
                //else {
                //    this.SendCommand("levelVars.clear", selectedContext.ContextType.ToString().ToLower());
                //}
            }
        }
Exemplo n.º 9
0
        private void m_prcClient_LevelVariablesSet(FrostbiteClient sender, LevelVariable lvRequestedContext)
        {
            LevelVariableContext selectedContext = this.GetSelectedContext();

            // If they are an exact match (we or another account is editing what we are editing)
            if (selectedContext.CompareTo(lvRequestedContext.Context) == 0)
            {
                this.SetLevelVariable(lvRequestedContext);
            }

            // If the variable applies to our currently editing context.
            if (this.isApplicableContext(lvRequestedContext) == true)
            {
                this.SetLevelVariablesToEffects(lvRequestedContext, new List <LevelVariable>()
                {
                    lvRequestedContext
                });
            }
        }
Exemplo n.º 10
0
 public virtual void SendLevelVarsClearPacket(LevelVariableContext context) {
     if (IsLoggedIn == true) {
         if (context.ContextTarget.Length > 0) {
             BuildSendPacket("levelVars.clear", context.ContextType.ToString().ToLower(), context.ContextTarget);
         }
         else {
             BuildSendPacket("levelVars.clear", context.ContextType.ToString().ToLower());
         }
     }
 }
Exemplo n.º 11
0
 public virtual void SendLevelVarsSetPacket(LevelVariableContext context, string variable, string value) {
     if (IsLoggedIn == true) {
         if (context.ContextTarget.Length > 0) {
             BuildSendPacket("levelVars.set", context.ContextType.ToString().ToLower(), context.ContextTarget, variable, value);
         }
         else {
             BuildSendPacket("levelVars.set", context.ContextType.ToString().ToLower(), variable, value);
         }
     }
 }
Exemplo n.º 12
0
 public override void SendLevelVarsListPacket(LevelVariableContext context) {
     // Do nothing!
 }
        private void SetLevelVariablesByContext(LevelVariableContext context, string variable, string value) {
            if (this.Client != null && this.Client.Game != null) {
                this.Client.Game.SendLevelVarsSetPacket(context, variable, value);
            }

            //if (context.ContextTarget.Length > 0) {
            //    this.SendCommand("levelVars.set", context.ContextType.ToString().ToLower(), context.ContextTarget, variable, value);
            //}
            //else {
            //    this.SendCommand("levelVars.set", context.ContextType.ToString().ToLower(), variable, value);
            //}
        }
        private void GetLevelVariablesByContext(LevelVariableContext context) {
            if (this.Client != null && this.Client.Game != null) {
                this.Client.Game.SendLevelVarsListPacket(context);
            }

            //if (context.ContextTarget.Length > 0) {
            //    this.SendCommand("levelVars.list", context.ContextType.ToString().ToLower(), context.ContextTarget);
            //}
            //else {
            //    this.SendCommand("levelVars.list", context.ContextType.ToString().ToLower());
            //}
        }
Exemplo n.º 15
0
 public virtual void SendLevelVarsListPacket(LevelVariableContext context)
 {
     if (this.IsLoggedIn == true) {
         if (context.ContextTarget.Length > 0) {
             this.BuildSendPacket("levelVars.list", context.ContextType.ToString().ToLower(), context.ContextTarget);
         }
         else {
             this.BuildSendPacket("levelVars.list", context.ContextType.ToString().ToLower());
         }
     }
 }
Exemplo n.º 16
0
 public override void SendLevelVarsListPacket(LevelVariableContext context)
 {
     // Do nothing!
 }