Example #1
0
 private static void popup_test()
 {
     GameUI.ShowMessage(ScreenMessageLocation.TOP_LEFT, "hey", 5f);
     PopUpMessage.DisplayOkOnly("ok only", null);
     PopUpMessage.Display("ok and cancel", null);
     PopUpMessage.Display("ok and cancel", null, () => {});
     PopUpWarning.Display("PopUpWarning");
     PopUpTwoChoices.Display(
         "PopUpTwoChoices",
         "aaa",
         "bbb",
         () =>
     {
         return;
     },
         () =>
     {
         return;
     });
     PopupInputField.Display(
         "PopUpInputField",
         "default",
         (result) =>
     {
         uConsole.Log("You typed: " + result);
     }
         );
 }
Example #2
0
        private static void toggleCheat()
        {
            bool val = uConsole.GetBool();

            PolyTechMain.setCheat(instance, val);
            PopUpMessage.DisplayOkOnly("Set Console mod cheat? to " + val.ToString(), null);
        }
Example #3
0
        public void RemoveCampaignCommand()
        {
            if (!instance.CheckForCheating())
            {
                uConsole.Log("Campaign Mod is not enabled!");
                return;
            }
            int Args = uConsole.GetNumParameters();

            if (Args != 1)
            {
                uConsole.Log("Usage: remove_campaign <name>");
            }
            else
            {
                string Name  = uConsole.GetString();
                string cPath = MainPath + "Campaigns/" + Name;
                if (!Directory.Exists(cPath))
                {
                    uConsole.Log(Name + " does not exist!");
                    return;
                }

                PopUpMessage.Display("Delete campaign " + Name + "?", delegate {
                    Directory.Delete(cPath, true);
                    uConsole.Log("Removed campaign " + Name);
                });
            }
        }
Example #4
0
    public static GameObject MsgBox(
        string prefab
        , string message
        , PopupButtonMessageDelegate okDelegate
        , PopupButtonMessageDelegate retryDelegate
        , PopupButtonMessageDelegate cancelDelegate
        , TPOPUP popupType)
    {
        GameObject   go    = GameObject.Instantiate(Resources.Load(prefab) as GameObject) as GameObject;
        PopUpMessage popUp = go.GetComponent <PopUpMessage>();

        popUp.onOk     = okDelegate;
        popUp.onCancel = cancelDelegate;
        popUp.onRetry  = retryDelegate;

        popUp.textMesh.text     = message;
        popUp.textMesh.maxChars = message.Length;
        popUp.textMesh.Commit();

        popUp.popupType = popupType;
        popUp.InitializeButtons();

        PopupVisible = true;
        return(go);
    }
 void missingMod(string name, string version, string settings, PolyTechMod currMod)
 {
     ptfInstance.ptfLogger.LogWarning("Mod in layout not present.");
     PopUpMessage.Display(
         $"Mod ({name}) in layout not present.",
         () => {}
         );
 }
 void wrongVersion(string name, string version, string settings, PolyTechMod currMod)
 {
     ptfInstance.ptfLogger.LogWarning("Mod in layout present, but not the correct version.");
     PopUpMessage.Display(
         $"Mod ({name}) in layout present, but not the correct version. (Made with {version}, Currently has {cheatMods.Where(p => p.Info.Metadata.Name == name).First().Info.Metadata.Version.ToString()})",
         () => checkMods(2, name, version, settings, currMod)
         );
 }
Example #7
0
        private void ShowPopUp(string message)
        {
            var popup = new PopUpMessage(message);

            popup.SetTimeOut(3000);
            popup.SetHeight(50);
            popup.Show(this);
        }
 public static bool PopupMessageCancelButtonFix(
     string message,
     Panel_PopUpMessage.OnChoiceDelegate okDelegate
     )
 {
     PopUpMessage.Display(message, okDelegate, () => {}, PopUpWarningCategory.NONE);
     GameUI.m_Instance.m_PopUpMessage.m_NeverShowAgainToggle.transform.parent.gameObject.SetActive(false);
     return(false);
 }
 public void Display()
 {
     PopUpMessage.Display(message, okDelegate, cancelDelegate, warningCategory);
     GameUI.m_Instance.m_PopUpMessage.m_NeverShowAgainToggle.transform.parent.gameObject.SetActive(false);
     if (cancelDelegate == null)
     {
         GameUI.m_Instance.m_PopUpMessage.m_CancelButton.gameObject.SetActive(false);
     }
 }
Example #10
0
    protected void InitializeHUD()
    {
        _hud          = (HUD)GetNode("HUD");
        _miniMap      = (MiniMap)_hud.GetNode("controlGame/MiniMap");
        _popUpMessage = (PopUpMessage)_hud.GetNode("PopUpMessage");

        _miniMap.Iniitialize(CapaturableBaseManager);

        _postProcess = (PostProcess)GetNode("PostProcess");
    }
Example #11
0
 public void Exchange()
 {
     if (gemsAmount > 0)
     {
         PopUpMessage.MsgBoxOkCancel("Prefabs/Hud/GemsStatusMessage", exchangeMessageString1.text + gemsAmount.ToString() + exchangeMessageString2.text + coinsAmount.ToString() + exchangeMessageString3.text, doExchange, delegate(){});
     }
     else
     {
         PopUpMessage.MsgBoxOk("Prefabs/Hud/GemsStatusMessage", amountNotValidString.text, delegate(){});
     }
 }
Example #12
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(this);
     }
 }
Example #13
0
    public void Unregister(PopUpMessage message)
    {
        if (GameManager.Instance().inGame)
        {
            uiHolder.WriteText(message.afterMessage);
            ObjectHolder.Instance().player.enabled = true;
        }
        if (message.gotTheMessage != null)
            message.gotTheMessage.Invoke();

        messageList.Remove(message);
    }
Example #14
0
        internal static MenuItem GetMenuItem(String name, Bitmap bitmap)
        {
            MenuItem menuItem = new MenuItem(name);

            menuItem.SetStyle(StyleFactory.GetMenuItemStyle());
            menuItem.SetTextMargin(new Indents(25, 0, 0, 0));


            // Optionally: set an event on click
            menuItem.EventMouseClick += (sender, args) =>
            {
                PopUpMessage popUpInfo = new PopUpMessage("You choosed a function:\n" + menuItem.GetText());
                popUpInfo.SetStyle(StyleFactory.GetBluePopUpStyle());
                popUpInfo.SetTimeOut(2000);
                popUpInfo.Show(menuItem.GetHandler());
            };

            // Optionally: add an image into MenuItem
            ImageItem img = new ImageItem(bitmap, false);

            img.SetSizePolicy(SizePolicy.Fixed, SizePolicy.Fixed);
            img.SetSize(20, 20);
            img.SetAlignment(ItemAlignment.Left, ItemAlignment.VCenter);
            img.KeepAspectRatio(true);
            menuItem.AddItem(img);


            // Optionally: add a button into MenuItem
            ButtonCore infoBtn = new ButtonCore("?");

            infoBtn.SetBackground(40, 40, 40);
            infoBtn.SetWidth(20);
            infoBtn.SetSizePolicy(SizePolicy.Fixed, SizePolicy.Expand);
            infoBtn.SetFontStyle(FontStyle.Bold);
            infoBtn.SetForeground(210, 210, 210);
            infoBtn.SetAlignment(ItemAlignment.VCenter, ItemAlignment.Right);
            infoBtn.SetMargin(0, 0, 10, 0);
            infoBtn.SetBorderRadius(3);
            infoBtn.AddItemState(ItemStateType.Hovered, new ItemState(Color.FromArgb(0, 140, 210)));
            infoBtn.SetPassEvents(false, InputEventType.MousePress, InputEventType.MouseRelease, InputEventType.MouseDoubleClick);
            infoBtn.IsFocusable      = false; // prevent focus this button
            infoBtn.EventMouseClick += (sender, args) =>
            {
                PopUpMessage popUpInfo = new PopUpMessage("This is decorated MenuItem:\n" + menuItem.GetText());
                popUpInfo.SetStyle(StyleFactory.GetDarkPopUpStyle());
                popUpInfo.SetTimeOut(2000);
                popUpInfo.Show(infoBtn.GetHandler());
            };
            menuItem.AddItem(infoBtn);

            return(menuItem);
        }
Example #15
0
        public void ImportCampaignCommand()
        {
            if (!instance.CheckForCheating())
            {
                uConsole.Log("Campaign Mod is not enabled!");
                return;
            }
            int Args = uConsole.GetNumParameters();

            if (Args != 1)
            {
                uConsole.Log("Usage: import_campaign <campaign>");
            }
            else
            {
                string Name  = uConsole.GetString();
                string cPath = MainPath + "Campaigns/" + Name;

                if (!File.Exists(MainPath + "Exports/" + Name + ".campaign"))
                {
                    uConsole.Log("That campaign doesn't exist!");
                    return;
                }

                byte[] cBytes = Utils.UnZipPayload(File.ReadAllBytes(MainPath + "Exports/" + Name + ".campaign"));
                int    offset = 0;

                string             cDataJson = ByteSerializer.DeserializeString(cBytes, ref offset);
                CampaignLayoutData cData     = JsonUtility.FromJson <CampaignLayoutData>(cDataJson);
                List <KeyValuePair <string, byte[]> > LevelBytes = new List <KeyValuePair <string, byte[]> >();

                for (int i = 0; i < cData.m_ItemIds.Count; i++)
                {
                    string lName = ByteSerializer.DeserializeString(cBytes, ref offset);
                    byte[] lData = ByteSerializer.DeserializeByteArray(cBytes, ref offset);
                    LevelBytes.Add(new KeyValuePair <string, byte[]>(lName, lData));
                }

                if (Directory.Exists(cPath))
                {
                    PopUpMessage.Display("Campaign already exists!\nOverwite it?", delegate {
                        Directory.Delete(cPath, true);
                        ImportCampaign(cPath, cDataJson, LevelBytes);
                    });
                }
                else
                {
                    ImportCampaign(cPath, cDataJson, LevelBytes);
                }
            }
        }
        public static bool uploadScorePatch(
            LeaderboardsUploadBody body,
            string levelID,
            bool didBreak,
            LeaderboardUploadScore.OnUploadScoreDelegate callback,
            Queue <LeaderboardUploadScore> ___m_ScoresToUpload
            )
        {
            int  score         = body.m_Value;
            int  minScore      = leaderboardProtMin.Value;
            bool allowedBudget = score >= minScore;

            if (leaderboardBlock.Value)
            {
                if (allowedBudget)
                {
                    PopUpWarning.Display($"Your score would be {score}, however you have blocked all scores from being uploaded in the PTF settings.");
                }
                else
                {
                    PopUpWarning.Display($"Your score ({score}) was below the minimum set in the PTF settings ({minScore}).");
                }
                GameUI.m_Instance.m_LevelComplete.m_LeaderboardPanel.ForceRefresh();
                return(false);
            }

            if (!allowedBudget)
            {
                PopUpWarning.Display($"Your score {score} was below the minimum budget {minScore} and as such will not be submitted.");
                GameUI.m_Instance.m_LevelComplete.m_LeaderboardPanel.ForceRefresh();
                return(false);
            }
            //PopUpMessage.Display($"Your score {score} was above or equal to the minimum budget {leaderboardProtMin.Value}.", () => {});

            if (leaderboardCheck.Value)
            {
                PopUpMessage.Display($"Would you like to upload your score of {score} to the leaderboard?",
                                     () => {
                    // On Yes
                    LeaderboardUploadScore item = new LeaderboardUploadScore(body, didBreak, levelID, callback);
                    ___m_ScoresToUpload.Enqueue(item);
                },
                                     () => {
                    // On No
                    GameUI.m_Instance.m_LevelComplete.m_LeaderboardPanel.ForceRefresh();
                });
                return(false);
            }
            return(true);
        }
Example #17
0
        public void InitEvents()
        {
            _remove.EventMouseClick += (sender, args) =>
            {
                _sender.GetParent().RemoveItem(_sender);
            };

            _call.EventMouseClick += (sender, args) =>
            {
                _radialMenu.Hide();
                PopUpMessage pop = new PopUpMessage("Calling to " + _sender.GetName());
                pop.Show(_menu.GetHandler());
            };
        }
Example #18
0
        private void InitController()
        {
            FillListBox(_model.GetListOfNames((int)_mw.NumberCount.GetValue()));
            if (_mw.ItemList.GetListContent().Count > 0)
            {
                _mw.ItemList.SetSelection(0);
            }

            _mw.ItemList.GetArea().SetFocus();

            _mw.BtnGenerate.EventMouseClick += (sender, args) =>
            {
                _mw.BtnGenerate.SetDisabled(true);
                Thread fillThread = new Thread(() =>
                {
                    _mw.ItemList.Clear();
                    FillListBox(_model.GetListOfNames((int)_mw.NumberCount.GetValue()));
                    _mw.BtnGenerate.SetDisabled(false);
                });
                fillThread.Start();
            };

            _mw.BtnSave.EventMouseClick += (sender, args) =>
            {
                OpenEntryDialog opd = new OpenEntryDialog("Save File:", FileSystemEntryType.File, OpenDialogType.Save);
                opd.AddFilterExtensions("Text files (*.txt);*.txt");
                opd.OnCloseDialog += () =>
                {
                    if (opd.GetResult() != null)
                    {
                        if (_model.WriteFile(opd.GetResult(), _mw.ItemText.GetText()))
                        {
                            PopUpMessage popUpInfo = new PopUpMessage("Character save successfully!");
                            popUpInfo.SetBackground(188, 188, 188);
                            popUpInfo.SetForeground(Color.Black);
                            popUpInfo.Show(_mw);
                        }
                        else
                        {
                            PopUpMessage popUpInfo = new PopUpMessage("Character save failed!");
                            popUpInfo.SetBackground(188, 188, 188);
                            popUpInfo.SetForeground(Color.Black);
                            popUpInfo.Show(_mw);
                        }
                    }
                };
                opd.Show(_mw);
            };
        }
Example #19
0
        private void Report_NotificationEvent(Messages.Message msg)
        {
#if NETFRAMEWORK
            var dict = new Dictionary <Status, MessageBoxIcon>()
            {
                { Status.Error, MessageBoxIcon.Error },
                { Status.Info, MessageBoxIcon.Information },
                { Status.Success, MessageBoxIcon.Information },
                { Status.Warning, MessageBoxIcon.Warning },
            };
            MessageBox.Show(text: $"{msg.Head}{Environment.NewLine}{msg.Text}", caption: msg.Caption, icon: dict[msg.Status], buttons: MessageBoxButtons.OK);
#else
            PopUpMessage.Show(msg, Settings <IrradiationSettings> .CurrentSettings.DefaultPopUpMessageTimeoutSeconds);
#endif
        }
Example #20
0
        public LoginForm()
        {
            try
            {
                InitializeComponent();
                textBoxLoginFormUser.Focus();
#if NET5_0_OR_GREATER
                Report.NotificationEvent += (msg) => { PopUpMessage.Show(msg, 5); };
#endif
                _sqlcs = new SqlConnectionStringBuilder(CredentialManager.GetCredentials(GlobalSettings.Targets.DB).Password);

                if (System.Diagnostics.Process.GetProcesses().Count(p => p.ProcessName == System.Diagnostics.Process.GetCurrentProcess().ProcessName) >= 2)
                {
                    _msg.Status = Status.Warning;
                    _msg.Head   = "Process already exists";
                    _msg.Text   = "You try to open already opened application.";
                    Report.Notify(_msg);
                    throw new InvalidOperationException("Process has already opened");
                }
            }
            catch (NullReferenceException)
            {
                _msg.Status = Status.Error;
                _msg.Head   = "DB target was not found";
                _msg.Text   = "Before using regata application you have to add target in Windows Credential Manager";
                Report.Notify(_msg);
            }
            catch (Exception ex)
            {
                _msg.Status       = Status.Error;
                _msg.Head         = "Unregistred error in Regata login system";
                _msg.Text         = ex.Message;
                _msg.DetailedText = ex.ToString();
                Report.Notify(_msg);
            }
        }
Example #21
0
        void InitContactMenu(CoreWindow handler)
        {
            cm = new ContextMenu(GetHandler());
            cm.SetBorderRadius(5);
            cm.SetBorderThickness(1);
            cm.SetBorderFill(32, 32, 32);
            cm.SetBackground(60, 60, 60);
            cm.ItemList.SetSelectionVisible(false);
            cm.ActiveButton = MouseButton.ButtonRight;
            cm.ReturnFocus  = _input;

            Call.SetForeground(Color.LightGray);
            Call.EventMouseClick += (sender, args) =>
            {
                PopUpMessage pop = new PopUpMessage("Calling " + contact.GetText() + "...");
                pop.AddItemState(ItemStateType.Hovered, new ItemState(Color.FromArgb(42, 44, 49)));
                pop.SetBorderRadius(new CornerRadius(6, 6, 6, 6));
                pop.SetFont(DefaultsService.GetDefaultFont(18));
                pop.SetShadow(5, 3, 3, Color.FromArgb(200, 0, 0, 0));
                pop.Show(handler);
            };
            SendMessage.SetForeground(Color.LightGray);

            RemoveFriend.SetForeground(Color.LightGray);
            RemoveFriend.EventMouseClick += (sender, args) =>
            {
                DisposeSelf();
            };

            //add menuitems
            cm.AddItems(
                Call,
                SendMessage,
                RemoveFriend
                );
        }
Example #22
0
        public void ExportCampaignCommand()
        {
            if (!instance.CheckForCheating())
            {
                uConsole.Log("Campaign Mod is not enabled!");
                return;
            }
            int Args = uConsole.GetNumParameters();

            if (Args != 1)
            {
                uConsole.Log("Usage: export_campaign <campaign>");
            }
            else
            {
                string Name  = uConsole.GetString();
                string cPath = MainPath + "Campaigns/" + Name;
                if (!Directory.Exists(cPath))
                {
                    uConsole.Log(Name + " does not exist!");
                    return;
                }
                else if (!File.Exists(cPath + "/CampaignData.json"))
                {
                    uConsole.Log(Name + " is missing CampaignData.json!");
                    return;
                }

                List <byte> cBytes = new List <byte>();

                CampaignLayoutData cData = JsonUtility.FromJson <CampaignLayoutData>(File.ReadAllText(cPath + "/CampaignData.json"));

                cBytes.AddRange(ByteSerializer.SerializeString(File.ReadAllText(cPath + "/CampaignData.json")));

                List <LevelData> levelDatas = new List <LevelData>();
                foreach (string id in cData.m_ItemIds)
                {
                    if (!File.Exists(cPath + "/" + id.Replace("CampaignMod", "") + ".level"))
                    {
                        uConsole.Log(Name + " tried to export " + id.Replace("CampaignMod", "") + " but it doesn't exist!");
                        return;
                    }

                    cBytes.AddRange(ByteSerializer.SerializeString(id.Replace("CampaignMod", "")));
                    cBytes.AddRange(ByteSerializer.SerializeByteArray(File.ReadAllBytes(cPath + "/" + id.Replace("CampaignMod", "") + ".level")));
                }

                if (File.Exists(MainPath + "Exports/" + Name + ".campaign"))
                {
                    PopUpMessage.Display("an export of " + Name + "already exists\noverwrite it?", delegate {
                        File.WriteAllBytes(MainPath + "Exports/" + Name + ".campaign", Utils.ZipPayload(cBytes.ToArray()));
                        uConsole.Log("Export created at '" + MainPath + "Exports/" + Name + ".campaign'");
                    });
                }
                else
                {
                    File.WriteAllBytes(MainPath + "Exports/" + Name + ".campaign", Utils.ZipPayload(cBytes.ToArray()));
                    uConsole.Log("Export created at '" + MainPath + "Exports/" + Name + ".campaign'");
                }
            }
        }
    /// <summary>
    /// Method responsible for handling server messages
    /// </summary>
    /// <param name="msg">Message.</param>
    public void HandleMessage(byte[] msg)
    {
        //Debug.Log("<CLIENT> <RECV>: " + msg);

        // Deserializing message from the server
        int offset  = 0;
        var message = new MessageModel(msg, ref offset);

        // Picking correct method for message handling
        if (message.metadata == "server_closed")
        {
            MultiplayerMod.MultiplayerMod.Disconnect();
        }
        if (message.metadata == "owner")
        {
            isOwner = true;
        }
        if (message.metadata == "connected")
        {
            MultiplayerMod.MultiplayerMod.syncLayout();
        }
        offset = 0;
        //Debug.Log(message.type);
        switch (message.type)
        {
        case LobbyMessaging.BridgeAction:
            Lobby.OnBridgeAction?.Invoke(new BridgeActionModel(message.content, ref offset));
            break;

        case "ConnectionResponse":
            MultiplayerMod.MultiplayerMod.GUIValues.ConnectionResponse = MultiplayerMod.MultiplayerMod.GetJustStringFromBytes(message.content);
            break;

        case LobbyMessaging.ServerInfo:
            MultiplayerMod.MultiplayerMod.instance.serverInfo = new ServerInfoModel(message.content, ref offset);
            MultiplayerMod.MultiplayerMod.RemoveDisconnectedUsersFromMousePositions();
            break;

        case LobbyMessaging.KickUser:
            MultiplayerMod.MultiplayerMod.GUIValues.kickResponse = MultiplayerMod.MultiplayerMod.GetJustStringFromBytes(message.content);
            break;

        case LobbyMessaging.ServerConfig:
            MultiplayerMod.MultiplayerMod.GUIValues.ConfigResponse = MultiplayerMod.MultiplayerMod.GetJustStringFromBytes(message.content);
            break;

        case LobbyMessaging.CreateInvite:
            MultiplayerMod.MultiplayerMod.GUIValues.InviteResponse = MultiplayerMod.MultiplayerMod.GetJustStringFromBytes(message.content);
            break;

        case LobbyMessaging.MousePosition:
            MousePositionModel mousePosition = new MousePositionModel(message.content, ref offset);
            mousePosition.position.z = -1.1f;
            MultiplayerMod.MultiplayerMod.instance.HandleMousePositionRecieved(mousePosition);
            break;

        case LobbyMessaging.PopupMessage:
            PopUpMessage.DisplayOkOnly(MultiplayerMod.MultiplayerMod.GetJustStringFromBytes(message.content), null);
            if (isOwner)
            {
                MultiplayerMod.MultiplayerMod.ActionLog($"Popup Message - {message.content}");
            }
            break;

        case LobbyMessaging.TopLeftMessage:
            GameUI.ShowMessage(ScreenMessageLocation.TOP_LEFT, MultiplayerMod.MultiplayerMod.GetJustStringFromBytes(message.content), 3f);
            if (isOwner)
            {
                MultiplayerMod.MultiplayerMod.ActionLog($"Info Message - {message.content}");
            }
            break;

        case LobbyMessaging.ChatMessage:
            ChatMessageModel chatMessage = new ChatMessageModel(message.content, ref offset);
            string           color       = "#" + ColorUtility.ToHtmlStringRGB(chatMessage.nameColor);
            chatMessage.message = chatMessage.message.Replace("<", "<<i></i>");
            MultiplayerMod.MultiplayerMod.ChatValues.chatLog += $"<color={color}>{chatMessage.username}</color>: {chatMessage.message}\n";
            break;

        default:
            Debug.LogError("Unknown type of method: " + message.type);
            break;
        }
    }
Example #24
0
        private void DefaultRegister_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            ObjectSpace objectSpace = Application.CreateObjectSpace();

            dicStudentRegDetail = new Dictionary <string, List <string> >();
            Student currentStudent;
            Lesson  curLesson;
            Dictionary <string, List <string> > errorstudent           = new Dictionary <string, List <string> >();
            Dictionary <string, int>            dicLessonCurrentRegNum = new Dictionary <string, int>();
            int     numregok = 0;
            Vacancy vc;
            bool    isConflictTKB = false;

            using (XPCollection <Lesson> newCollectionSource = new XPCollection <Lesson>(objectSpace.Session))
            {
                objectSpace.Session.BeginTransaction();
                foreach (StudentClass studentClass in View.SelectedObjects)
                {
                    newCollectionSource.Criteria = CriteriaOperator.Parse(
                        "ClassIDs like ?", string.Format("%{0}%", studentClass.ClassCode));

                    foreach (Student student in studentClass.Students)
                    {
                        listVacancies  = new List <Vacancy>();
                        currentStudent = objectSpace.FindObject <Student>(
                            new BinaryOperator("StudentCode", student.StudentCode));

                        foreach (Lesson lesson in newCollectionSource)
                        {
                            isConflictTKB = false;
                            if (!dicLessonCurrentRegNum.ContainsKey(lesson.LessonName))
                            {
                                dicLessonCurrentRegNum[lesson.LessonName] = 0;
                            }
                            foreach (TkbSemester tkbsem in lesson.TKBSemesters)
                            {
                                vc = new Vacancy(tkbsem.Day, tkbsem.Period, tkbsem.Weeks, (tkbsem.Classroom == null ? "" : tkbsem.Classroom.ClassroomCode));
                                if (Utils.IsConfictTKB(listVacancies, vc))
                                {
                                    isConflictTKB = true;
                                    break;
                                }
                            }

                            if (isConflictTKB)
                            {
                                if (!errorstudent.ContainsKey(currentStudent.StudentCode))
                                {
                                    errorstudent.Add(currentStudent.StudentCode, new List <string>());
                                }
                                if (!errorstudent[currentStudent.StudentCode].Contains(lesson.Subject.SubjectCode))
                                {
                                    errorstudent[currentStudent.StudentCode].Add(lesson.Subject.SubjectCode + "{T}");
                                }
                            }
                            else
                            {
                                //si so chon chua vuot qua
                                if (lesson.NumExpectation > dicLessonCurrentRegNum[lesson.LessonName] + lesson.NumRegistration)
                                {
                                    curLesson = objectSpace.FindObject <Lesson>(
                                        new BinaryOperator("Oid", lesson.Oid));
                                    RegisterDetail regdetail = new RegisterDetail(objectSpace.Session)
                                    {
                                        Student       = currentStudent,
                                        Lesson        = curLesson,
                                        RegisterState = objectSpace.FindObject <RegisterState>(
                                            new BinaryOperator("Code", "SELECTED")),
                                        CheckState = objectSpace.FindObject <RegisterState>(
                                            new BinaryOperator("Code", "NOTCHECKED"))
                                    };
                                    RuleSet ruleSet = new RuleSet();

                                    RuleSetValidationResult result = ruleSet.ValidateTarget(regdetail, DefaultContexts.Save);
                                    if (ValidationState.Invalid ==
                                        result.GetResultItem("RegisterDetail.StudentRegLessonSemester").State)
                                    {
                                        if (!errorstudent.ContainsKey(currentStudent.StudentCode))
                                        {
                                            errorstudent.Add(currentStudent.StudentCode, new List <string>());
                                        }
                                        if (!errorstudent[currentStudent.StudentCode].Contains(curLesson.Subject.SubjectCode))
                                        {
                                            errorstudent[currentStudent.StudentCode].Add(curLesson.Subject.SubjectCode + "{D}");
                                        }
                                        regdetail.Delete();
                                        //regdetail.Reload();
                                    }
                                    else
                                    {
                                        numregok++;
                                        if (!dicStudentRegDetail.ContainsKey(student.StudentCode))
                                        {
                                            dicStudentRegDetail.Add(student.StudentCode, new List <string>());
                                        }
                                        dicStudentRegDetail[student.StudentCode].Add(curLesson.LessonName);

                                        dicLessonCurrentRegNum[lesson.LessonName]++;
                                        foreach (TkbSemester tkbsem in curLesson.TKBSemesters)
                                        {
                                            vc = new Vacancy(tkbsem.Day, tkbsem.Period, tkbsem.Weeks, (tkbsem.Classroom == null ? "" : tkbsem.Classroom.ClassroomCode));
                                            listVacancies.Add(vc);
                                        }
                                        regdetail.Save();
                                    }
                                }
                                else
                                {
                                    if (!errorstudent.ContainsKey(currentStudent.StudentCode))
                                    {
                                        errorstudent.Add(currentStudent.StudentCode, new List <string>());
                                    }
                                    if (!errorstudent[currentStudent.StudentCode].Contains(lesson.Subject.SubjectCode))
                                    {
                                        errorstudent[currentStudent.StudentCode].Add(lesson.Subject.SubjectCode + "{H}");
                                    }
                                }
                            }
                        }
                    }
                }
                objectSpace.Session.CommitTransaction();
                PopUpMessage ms = objectSpace.CreateObject <PopUpMessage>();
                if (errorstudent.Count > 0)
                {
                    ms.Title   = "Có lỗi khi chọn nhóm MH đăng ký!";
                    ms.Message = string.Format("Đã chọn được cho {0} sinh viên với {1} lượt nhóm MH\r\n", dicStudentRegDetail.Count, numregok);
                    string strmessage = "Không chọn được nhóm môn học do trùng môn đã đăng ký, trùng lịch hoặc hết chỗ: ";
                    foreach (KeyValuePair <string, List <string> > keypair in errorstudent)
                    {
                        strmessage += string.Format("Sinh viên:[{0}] - Môn:[", keypair.Key);
                        foreach (string str in keypair.Value)
                        {
                            strmessage += str + ",";
                        }
                        strmessage  = strmessage.TrimEnd(',');
                        strmessage += "]\r\n";
                    }
                    ms.Message += strmessage;
                }
                else
                {
                    ms.Title   = "Chọn nhóm MH thành công";
                    ms.Message = string.Format("Chọn nhóm MH thành công cho {0} sinh viên với {1} lượt nhóm MH\r\n", dicStudentRegDetail.Count, numregok);
                }
                ShowViewParameters svp = new ShowViewParameters();
                svp.CreatedView = Application.CreateDetailView(
                    objectSpace, ms);
                svp.TargetWindow        = TargetWindow.NewModalWindow;
                svp.CreatedView.Caption = "Thông báo";
                DialogController dc = Application.CreateController <DialogController>();
                svp.Controllers.Add(dc);

                dc.SaveOnAccept = false;
                Application.ShowViewStrategy.ShowView(svp, new ShowViewSource(null, null));
            }
        }
Example #25
0
 private void Report_NotificationEvent(Core.Messages.Message msg)
 {
     PopUpMessage.Show(msg, Settings <MeasurementsSettings> .CurrentSettings.DefaultPopUpMessageTimeoutSeconds);
 }
 public static bool PopupIsActive()
 {
     return(GameUI.m_Instance.m_PopUpMessage.m_Animator.isActiveAndEnabled || PopUpMessage.IsActive() ||
            GameUI.m_Instance.m_PopUpInputField.m_Animator.isActiveAndEnabled || PopupInputField.IsActive() ||
            GameUI.m_Instance.m_PopUpTwoChoices.m_Animator.isActiveAndEnabled || PopUpTwoChoices.IsActive() ||
            GameUI.m_Instance.m_PopUpWarning.m_Animator.isActiveAndEnabled || PopUpWarning.IsActive());
 }
 private static void modUpdatePopup(ModUpdate modUpdate)
 {
     ptfInstance.ptfLogger.LogInfo($"\n------------------------\n{modUpdate.mod.Info.Metadata.Name} has an update available!\n{modUpdate.old_version} -> {modUpdate.new_version}\n------------------------\n");
     PopUpMessage.Display($"{modUpdate.mod.Info.Metadata.Name} has an update available!\n{modUpdate.old_version} -> {modUpdate.new_version}", () => System.Diagnostics.Process.Start(modUpdate.latest_release.html_url));
 }
        void selectAcception_AcceptingAdmin(object sender, DialogControllerAcceptingEventArgs e)
        {
            Dictionary <string, int> dicLessonCurrentRegNum = new Dictionary <string, int>();
            ObjectSpace         objectSpace = Application.CreateObjectSpace();
            ListView            lv          = ((ListView)((WindowController)sender).Window.View);
            User                u           = (User)SecuritySystem.CurrentUser;
            XPCollection <Role> xpc         = new XPCollection <Role>(u.Roles,
                                                                      new BinaryOperator("Name", "Administrators"));
            XPCollection <Role> xpc2 = new XPCollection <Role>(u.Roles,
                                                               new BinaryOperator("Name", "DataAdmins"));

            if (xpc.Count + xpc2.Count > 0)
            {
                objectSpace.Session.BeginTransaction();

                Student currentStudent;
                Lesson  curLesson;
                Dictionary <string, List <string> > errorstudent = new Dictionary <string, List <string> >();
                int numregok = 0;
                foreach (string studentCode in dicStudentRegDetail.Keys)
                {
                    currentStudent = objectSpace.FindObject <Student>(
                        new BinaryOperator("StudentCode", studentCode));
                    foreach (Lesson lesson in lv.SelectedObjects)
                    {
                        if (!dicLessonCurrentRegNum.ContainsKey(lesson.LessonName))
                        {
                            dicLessonCurrentRegNum[lesson.LessonName] = 0;
                        }
                        //si so chon chua vuot qua
                        if (lesson.NumExpectation > dicLessonCurrentRegNum[lesson.LessonName] + lesson.NumRegistration)
                        {
                            curLesson = objectSpace.FindObject <Lesson>(
                                new BinaryOperator("Oid", lesson.Oid));
                            RegisterDetail regdetail = new RegisterDetail(objectSpace.Session)
                            {
                                Student       = currentStudent,
                                Lesson        = curLesson,
                                RegisterState = objectSpace.FindObject <RegisterState>(
                                    new BinaryOperator("Code", "SELECTED")),
                                CheckState = objectSpace.FindObject <RegisterState>(
                                    new BinaryOperator("Code", "NOTCHECKED"))
                            };
                            RuleSet ruleSet = new RuleSet();

                            RuleSetValidationResult result = ruleSet.ValidateTarget(regdetail, DefaultContexts.Save);
                            if (ValidationState.Invalid ==
                                result.GetResultItem("RegisterDetail.StudentRegLessonSemester").State)
                            {
                                if (!errorstudent.ContainsKey(currentStudent.StudentCode))
                                {
                                    errorstudent.Add(currentStudent.StudentCode, new List <string>());
                                }
                                if (!errorstudent[currentStudent.StudentCode].Contains(curLesson.Subject.SubjectCode))
                                {
                                    errorstudent[currentStudent.StudentCode].Add(curLesson.Subject.SubjectCode);
                                }
                                regdetail.Delete();
                            }
                            else
                            {
                                numregok++;
                                dicLessonCurrentRegNum[lesson.LessonName]++;
                                regdetail.Save();
                            }
                        }
                        else
                        {
                            if (!errorstudent.ContainsKey(currentStudent.StudentCode))
                            {
                                errorstudent.Add(currentStudent.StudentCode, new List <string>());
                            }
                            if (!errorstudent[currentStudent.StudentCode].Contains(lesson.Subject.SubjectCode))
                            {
                                errorstudent[currentStudent.StudentCode].Add(lesson.Subject.SubjectCode);
                            }
                        }
                    }
                }
                objectSpace.Session.CommitTransaction();
                PopUpMessage ms = objectSpace.CreateObject <PopUpMessage>();
                if (errorstudent.Count > 0)
                {
                    ms.Title   = "Có lỗi khi chọn nhóm MH đăng ký!";
                    ms.Message = string.Format("Đã chọn được cho {0} sinh viên với {1} lượt nhóm MH\r\n", dicStudentRegDetail.Count, numregok);
                    string strmessage = "Không chọn được nhóm môn học do trùng môn đã đăng ký hoặc hết chỗ: ";
                    foreach (KeyValuePair <string, List <string> > keypair in errorstudent)
                    {
                        strmessage += string.Format("Sinh viên:[{0}] - Môn:[", keypair.Key);
                        foreach (string str in keypair.Value)
                        {
                            strmessage += str + ",";
                        }
                        strmessage  = strmessage.TrimEnd(',');
                        strmessage += "]\r\n";
                    }
                    ms.Message += strmessage;
                }
                else
                {
                    ms.Title   = "Chọn nhóm MH thành công";
                    ms.Message = string.Format("Chọn nhóm MH thành công cho {0} sinh viên với {1} lượt nhóm MH\r\n", dicStudentRegDetail.Count, numregok);
                }
                ShowViewParameters svp = new ShowViewParameters();
                svp.CreatedView = Application.CreateDetailView(
                    objectSpace, ms);
                svp.TargetWindow        = TargetWindow.NewModalWindow;
                svp.CreatedView.Caption = "Thông báo";
                DialogController dc = Application.CreateController <DialogController>();
                svp.Controllers.Add(dc);

                dc.SaveOnAccept = false;
                Application.ShowViewStrategy.ShowView(svp, new ShowViewSource(null, null));
            }
        }
Example #29
0
        public void AddThisLevelCommand()
        {
            if (!instance.CheckForCheating())
            {
                uConsole.Log("Campaign Mod is not enabled!");
                return;
            }
            if (GameStateManager.GetState() != GameState.SANDBOX)
            {
                uConsole.Log("You have to be in sandbox mode to use this command!");
                return;
            }
            int Args = uConsole.GetNumParameters();

            if (Args == 0)
            {
                uConsole.Log("Usage: add_this_level <campaign> [num]");
            }
            else
            {
                string Name  = uConsole.GetString();
                string cPath = MainPath + "Campaigns/" + Name;

                if (!Directory.Exists(cPath))
                {
                    uConsole.Log(Name + " does not exist!");
                    return;
                }
                else if (!File.Exists(cPath + "/CampaignData.json"))
                {
                    uConsole.Log(Name + " is missing CampaignData.json!");
                    return;
                }
                else if (mName.Value.IsNullOrWhiteSpace())
                {
                    uConsole.Log("Your name can't be empty!");
                    return;
                }

                GameUI.m_Instance.m_WorkshopSubmit.gameObject.SetActive(true);
                GameUI.m_Instance.m_WorkshopSubmit.gameObject.SetActive(false);

                SandboxLayoutData data  = SandboxLayout.SerializeToProxies();
                string            Title = data.m_Workshop.m_Title;
                if (Title.IsNullOrWhiteSpace())
                {
                    uConsole.Log("Level doesn't have a name!");
                    return;
                }
                else
                if (Title.Contains("/") || Title.Contains("\\") || Title.Contains("?") || Title.Contains("%") || Title.Contains("*") ||
                    Title.Contains(":") || Title.Contains("|") || Title.Contains("\"") || Title.Contains("<") || Title.Contains(">") ||
                    Title.Contains(".") || Title.Contains(",") || Title.Contains(";") || Title.Contains("="))
                {
                    uConsole.Log("Level title contains prhobited characters!");
                    return;
                }

                CampaignLayoutData cData = JsonUtility.FromJson <CampaignLayoutData>(File.ReadAllText(cPath + "/CampaignData.json"));
                if (cData.m_ItemIds.Count >= 16)
                {
                    uConsole.Log("Campaign already has max levels");
                    return;
                }

                int num = -1;
                if (Args > 1)
                {
                    num = uConsole.GetInt();
                    if (num < 1 || num > 16)
                    {
                        uConsole.Log("Position has to be within 1 and 16!");
                        return;
                    }
                }

                if (File.Exists(cPath + "/" + Title + ".level"))
                {
                    PopUpMessage.Display("Level already exists!\nOverwrite level?", delegate { AddThisLevel(cPath, data, cData, num); });
                }
                else
                {
                    AddThisLevel(cPath, data, cData, num);
                }
            }
        }
Example #30
0
        public override void InitElements()
        {
            ImageItem _race = new ImageItem(DefaultsService.GetDefaultImage(
                                                EmbeddedImage.User,
                                                EmbeddedImageSize.Size32x32), false);

            _race.KeepAspectRatio(true);
            _race.SetWidthPolicy(SizePolicy.Fixed);
            _race.SetWidth(20);
            _race.SetAlignment(ItemAlignment.Left, ItemAlignment.VCenter);

            switch (_characterInfo.Race)
            {
            case CharacterRace.Human:
                _race.SetColorOverlay(Color.FromArgb(0, 162, 232));
                break;

            case CharacterRace.Elf:
                _race.SetColorOverlay(Color.FromArgb(35, 201, 109));
                break;

            case CharacterRace.Dwarf:
                _race.SetColorOverlay(Color.FromArgb(255, 127, 39));
                break;
            }

            _name.SetMargin(30, 0, 30, 0);

            ButtonCore infoBtn = new ButtonCore("?");

            infoBtn.SetBackground(Color.FromArgb(255, 40, 40, 40));
            infoBtn.SetWidth(20);
            infoBtn.SetSizePolicy(SizePolicy.Fixed, SizePolicy.Expand);
            infoBtn.SetFontStyle(FontStyle.Bold);
            infoBtn.SetForeground(210, 210, 210);
            infoBtn.SetAlignment(ItemAlignment.VCenter, ItemAlignment.Right);
            infoBtn.SetMargin(0, 0, 20, 0);
            infoBtn.AddItemState(ItemStateType.Hovered, new ItemState(Color.FromArgb(0, 140, 210)));

            infoBtn.SetPassEvents(false);

            infoBtn.EventMouseHover += (sender, args) =>
            {
                SetMouseHover(true);
            };

            infoBtn.EventMouseClick += (sender, args) =>
            {
                ImageItem race = new ImageItem(DefaultsService.GetDefaultImage(EmbeddedImage.User, EmbeddedImageSize.Size32x32), false);
                race.SetSizePolicy(SizePolicy.Fixed, SizePolicy.Fixed);
                race.SetSize(32, 32);
                race.SetAlignment(ItemAlignment.Left, ItemAlignment.Top);
                race.SetColorOverlay(_race.GetColorOverlay());

                PopUpMessage popUpInfo = new PopUpMessage(
                    _characterInfo.Name + "\n" +
                    "Age: " + _characterInfo.Age + "\n" +
                    "Sex: " + _characterInfo.Sex + "\n" +
                    "Race: " + _characterInfo.Race + "\n" +
                    "Class: " + _characterInfo.Class
                    );
                popUpInfo.SetTimeOut(3000);
                popUpInfo.SetHeight(200);
                popUpInfo.Show(GetHandler());
                popUpInfo.AddItem(race);
            };

            //close
            ButtonCore removeBtn = new ButtonCore();

            removeBtn.SetBackground(Color.FromArgb(255, 40, 40, 40));
            removeBtn.SetSizePolicy(SizePolicy.Fixed, SizePolicy.Fixed);
            removeBtn.SetSize(10, 10);
            removeBtn.SetAlignment(ItemAlignment.VCenter, ItemAlignment.Right);
            removeBtn.SetCustomFigure(new CustomFigure(false, GraphicsMathService.GetCross(10, 10, 2, 45)));
            removeBtn.AddItemState(ItemStateType.Hovered, new ItemState(Color.FromArgb(200, 95, 97)));

            //close event
            removeBtn.EventMouseClick += (sender, args) =>
            {
                RemoveSelf();
            };

            //adding
            AddItems(_race, _name, infoBtn, removeBtn);
        }
Example #31
0
 private void Popup(PopUpMessage m)
 {
     modalPanelObject.SetActive(true);
     this.question.color = new Color(0, 0, 0, 0);
     this.question.text = m.message;
     if (m.fadeIn)
     {
         StartCoroutine(FadeIn());
     }
     else
         this.question.color = new Color(0, 0, 0, 255);
 }
Example #32
0
 // Use this for initialization
 void Start()
 {
     popUpMessage = this;
     Invoke("DisplayText", 2);
 }
Example #33
0
 public void Register(PopUpMessage message)
 {
     messageList.Add(message);
 }