public LoginPanelMediator(UIBase viewComponent)
        : base(NAME, viewComponent)
    {
        dialog = (LoginPanel)viewComponent;
        dialog.Login += new EventHandler(Login);
        dialog.Signup += new EventHandler(Signup);
	}
    public void DisableOtherUI(UIBase currentUI)
    {
        foreach (UIBase uis in allInterfaces)
        {
            if (uis == currentUI)
                continue;

            uis.DisableUI();
        }
    }
Esempio n. 3
0
        /// <summary>
        /// 添加一个Hud
        /// </summary>
        public void AddHud(string name, UIBase hud, Vector2 offset)
        {
            if (hudInfoDict.ContainsKey(name))
            {
                Log.Error("重复添加的Hud! name:", name, "hud:", hud);
                return;
            }

            HudInfo hudInfo = new HudInfo();
            hudInfo.Hud = hud;
            hudInfo.Offset = offset;
            hudInfoDict[name] = hudInfo;
        }
Esempio n. 4
0
    public void CloseCurrentUI()
    {
        if(IsCloseChildUIWithHide)
        {
            for(int i = 0; i < m_pCurrentTransform.childCount; i++)
            {
                m_pCurrentTransform.GetChild(i).GetComponent<UIProperty>().CloseCurrentUI();
            }
        }
        if(TargetUI)
        {
            TargetUI = null;
            this.SendEvent(GameEvent.UIEvent.EVENT_UI_HIDEUI, this.name);
        }

        if(!IsFatherUITouchEnable)
        {
            if(m_pCurrentTransform.parent && m_pCurrentTransform.parent.name != "UIRelation")
                this.SendEvent(GameEvent.UIEvent.EVENT_UI_COULD_TOUCH, m_pCurrentTransform.parent.name);
        }
    }
Esempio n. 5
0
 public static void ShowMe()
 {
     UIBase.AsyncLoad(UIASSETS_ID.UIASSETS_MoreSelfActivity);
 }
Esempio n. 6
0
 public void SetCurrentUI(UIBase CurrentUI)
 {
     TargetUI = CurrentUI;
 }
Esempio n. 7
0
 public static void ShowMe()
 {
     UIBase.AsyncLoad(UIASSETS_ID.UIASSETS_ExchangePanel);
 }
Esempio n. 8
0
 public override void OnClickInternal(UIMouseEventParameter p)
 {
     UIBase.GetTrafficManagerTool().SetToolMode(Active ? ToolMode.None : ToolMode);
 }
Esempio n. 9
0
 public static void SwithShowMe()
 {
     UIBase.SwitchShowPanelByName(UIASSETS_ID.UIASSETS_ExchangePanel);
 }
Esempio n. 10
0
 public static void HideMe()
 {
     UIBase.HidePanelByName(UIASSETS_ID.UIASSETS_FamilinfoPanel);
 }
Esempio n. 11
0
 public static void ShowUI()
 {
     UIBase.ShowUI(UIType.LoadingUI, UILayer.Prepose);
 }
Esempio n. 12
0
 public UISorter(UIBase ui, int moveTop, int index)
 {
     this.ui      = ui;
     this.moveTop = moveTop;
     this.index   = index;
 }
Esempio n. 13
0
 public static void ShowMe()
 {
     UIBase.AsyncLoad(UIASSETS_ID.UIASSETS_FamilinfoPanel);
 }
Esempio n. 14
0
 public static void SwithShowMe()
 {
     UIBase.SwitchShowPanelByName(UIASSETS_ID.UIASSETS_MoreSelfActivity);
 }
Esempio n. 15
0
 public static void HideMe()
 {
     UIBase.HidePanelByName(UIASSETS_ID.UIASSETS_QuickBuyPanel);
 }
Esempio n. 16
0
 public static void HideMe()
 {
     UIBase.HidePanelByName(UIASSETS_ID.UIASSETS_HundredUI);
 }
Esempio n. 17
0
 public static void ShowMe()
 {
     UIBase.AsyncLoad(UIASSETS_ID.UIASSETS_HundredUI);
 }
Esempio n. 18
0
 public static void SwithShowMe()
 {
     UIBase.SwitchShowPanelByName(UIASSETS_ID.UIASSETS_HundredUI);
 }
Esempio n. 19
0
 public void Awake()
 {
     UIBase ui = UIManager.Instance.Open("UIInfo");
 }
Esempio n. 20
0
 public static void HideMe()
 {
     UIBase.HidePanelByName(UIASSETS_ID.UIASSETS_ExchangePanel);
 }
Esempio n. 21
0
    //TODO 需要添加一个时间监听,当游戏关闭时候 清空俩个俩个堆栈,以防关闭报错

    public void RemoveCloseUIDic(UIBase ui)
    {
        closeUIStroe.Remove(ui);
    }
Esempio n. 22
0
 public static void HideMe()
 {
     UIBase.HidePanelByName(UIASSETS_ID.UIASSETS_MoreSelfActivity);
 }
Esempio n. 23
0
        private void pmInitGridProp()
        {
            //this.grdBrowView.SetDataBinding(this.dtsDataEnv.Tables[this.mstrAlias], "");
            //this.grdBrowView.RetrieveStructure();

            System.Data.DataView dvBrow = this.dtsDataEnv.Tables[this.mstrAlias].DefaultView;
            //dvBrow.Sort = "dDate, cRefNo";

            this.grdBrowView.DataSource = this.dtsDataEnv.Tables[this.mstrAlias];

            for (int intCnt = 0; intCnt < this.gridView1.Columns.Count; intCnt++)
            {
                this.gridView1.Columns[intCnt].Visible = false;
            }

            int i = 0;

            this.gridView1.Columns["cCode"].Group();

            this.gridView1.Columns["cCode"].VisibleIndex     = i++;
            this.gridView1.Columns["cRefNo"].VisibleIndex    = i++;
            this.gridView1.Columns["cRefNo_MO"].VisibleIndex = i++;
            this.gridView1.Columns["cQcCoor"].VisibleIndex   = i++;
            //this.gridView1.Columns["cQnCoor"].VisibleIndex = i++;
            this.gridView1.Columns["cQcProd"].VisibleIndex = i++;
            //this.gridView1.Columns["cQnProd"].VisibleIndex = i++;
            this.gridView1.Columns["nBakQty_MO"].VisibleIndex = i++;
            this.gridView1.Columns["nBakQty_PR"].VisibleIndex = i++;
            this.gridView1.Columns["nBakQty_PO"].VisibleIndex = i++;
            this.gridView1.Columns["nStkQty"].VisibleIndex    = i++;
            this.gridView1.Columns["nIssueQty"].VisibleIndex  = i++;
            this.gridView1.Columns["nRefQty"].VisibleIndex    = i++;
            this.gridView1.Columns["nQty"].VisibleIndex       = i++;
            this.gridView1.Columns["nPrice"].VisibleIndex     = i++;

            this.gridView1.Columns["cCode"].Caption      = UIBase.GetAppUIText(new string[] { "เลขที่ภายใน", "Document Code" });
            this.gridView1.Columns["cRefNo"].Caption     = UIBase.GetAppUIText(new string[] { "เลขที่อ้างอิง", "#Ref. No." });
            this.gridView1.Columns["cRefNo_MO"].Caption  = UIBase.GetAppUIText(new string[] { "เลขที่อ้างอิง MO", "#MO Ref. No." });
            this.gridView1.Columns["cQcCoor"].Caption    = UIBase.GetAppUIText(new string[] { "รหัสผู้จำหน่าย", "Supplier Code" });
            this.gridView1.Columns["cQnCoor"].Caption    = UIBase.GetAppUIText(new string[] { "ชื่อผู้จำหน่าย", "Supplier Name" });
            this.gridView1.Columns["cQcProd"].Caption    = UIBase.GetAppUIText(new string[] { "รหัสสินค้า", "Product Code" });
            this.gridView1.Columns["cQnProd"].Caption    = UIBase.GetAppUIText(new string[] { "ชื่อสินค้า", "Product Name" });
            this.gridView1.Columns["nBakQty_MO"].Caption = UIBase.GetAppUIText(new string[] { "ยอดจอง MO", "Booking\r\nM/O. Qty." });
            this.gridView1.Columns["nBakQty_PR"].Caption = UIBase.GetAppUIText(new string[] { "PR ค้างสั่ง", "Outstanding\r\nP/R. Qty." });
            this.gridView1.Columns["nBakQty_PO"].Caption = UIBase.GetAppUIText(new string[] { "PO ค้างรับ", "Outstanding\r\nP/O. Qty" });
            this.gridView1.Columns["nStkQty"].Caption    = UIBase.GetAppUIText(new string[] { "สินค้าคงหลือ", "Stock\r\nQty." });
            this.gridView1.Columns["nIssueQty"].Caption  = UIBase.GetAppUIText(new string[] { "เบิก/รับคืน", "Issue\r\nQty." });
            this.gridView1.Columns["nRefQty"].Caption    = UIBase.GetAppUIText(new string[] { "จำนวน", "M/O\r\nQty." });
            this.gridView1.Columns["nQty"].Caption       = UIBase.GetAppUIText(new string[] { "จำนวน ญฑ", "Gen P/R\r\nQty." });
            this.gridView1.Columns["nPrice"].Caption     = UIBase.GetAppUIText(new string[] { "ราคา", "Price" });


            this.gridView1.OptionsView.ColumnAutoWidth = false;
            this.gridView1.Columns["cRefNo"].Width     = 120;
            this.gridView1.Columns["cRefNo_MO"].Width  = 120;
            this.gridView1.Columns["cQcCoor"].Width    = 90;
            //this.gridView1.Columns["cQnCoor"].Width = 40;
            this.gridView1.Columns["cQcProd"].Width    = 100;
            this.gridView1.Columns["nQty"].Width       = 80;
            this.gridView1.Columns["nBakQty_MO"].Width = 80;
            this.gridView1.Columns["nBakQty_PR"].Width = 80;
            this.gridView1.Columns["nStkQty"].Width    = 80;
            this.gridView1.Columns["nIssueQty"].Width  = 80;
            this.gridView1.Columns["nQty"].Width       = 80;
            this.gridView1.Columns["nRefQty"].Width    = 80;
            this.gridView1.Columns["nPrice"].Width     = 80;

            string strQtyFormat = "#,###,###.00;(#,###,###.00);-";

            this.gridView1.Columns["nQty"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            this.gridView1.Columns["nQty"].DisplayFormat.FormatString = strQtyFormat;

            this.gridView1.Columns["nRefQty"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            this.gridView1.Columns["nRefQty"].DisplayFormat.FormatString = strQtyFormat;

            this.gridView1.Columns["nPrice"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            this.gridView1.Columns["nPrice"].DisplayFormat.FormatString = strQtyFormat;

            this.gridView1.Columns["nStkQty"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            this.gridView1.Columns["nStkQty"].DisplayFormat.FormatString = strQtyFormat;

            this.gridView1.Columns["nIssueQty"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            this.gridView1.Columns["nIssueQty"].DisplayFormat.FormatString = strQtyFormat;

            this.gridView1.Columns["nBakQty_MO"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            this.gridView1.Columns["nBakQty_MO"].DisplayFormat.FormatString = strQtyFormat;

            this.gridView1.Columns["nBakQty_PR"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            this.gridView1.Columns["nBakQty_PR"].DisplayFormat.FormatString = strQtyFormat;

            this.gridView1.Columns["nBakQty_PO"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            this.gridView1.Columns["nBakQty_PO"].DisplayFormat.FormatString = strQtyFormat;

            this.gridView1.Columns["nQty"].AppearanceCell.BackColor       = Color.LemonChiffon;
            this.gridView1.Columns["nPrice"].AppearanceCell.BackColor     = Color.LemonChiffon;
            this.gridView1.Columns["nStkQty"].AppearanceCell.BackColor    = Color.LemonChiffon;
            this.gridView1.Columns["nBakQty_PR"].AppearanceCell.BackColor = Color.LemonChiffon;
            this.gridView1.Columns["nBakQty_PO"].AppearanceCell.BackColor = Color.LemonChiffon;
            this.gridView1.Columns["nRefQty"].AppearanceCell.BackColor    = Color.LemonChiffon;
            this.gridView1.Columns["nIssueQty"].AppearanceCell.BackColor  = Color.LemonChiffon;

            //this.gridView1.Columns["dDate"].DisplayFormat.FormatType = DevExpress.Utils.FormatType.Custom;
            //this.gridView1.Columns["dDate"].DisplayFormat.FormatString = "dd/MM/yy";

            //this.gridView1.SortKeys.Add(new Janus.Windows.GridEX.GridEXSortKey(this.gridView1.Columns["dDate"], Janus.Windows.GridEX.SortOrder.Ascending));
            //this.gridView1.SortKeys.Add(new Janus.Windows.GridEX.GridEXSortKey(this.gridView1.Columns["cRefNo"], Janus.Windows.GridEX.SortOrder.Ascending));
            ////this.gridView1.Columns[this.mstrSortKey].CellStyle.BackColor = Color.WhiteSmoke;

            //this.gridView1.GroupSummary.Add(DevExpress.Data.SummaryItemType.Sum, "nAmt", this.gridView1.Columns["nAmt"], "{0:n2}");

            this.grdBrowView.Focus();

            this.gridView1.ExpandAllGroups();
        }
Esempio n. 24
0
 public static void SwithShowMe()
 {
     UIBase.SwitchShowPanelByName(UIASSETS_ID.UIASSETS_employeeFrieUI);
 }
Esempio n. 25
0
 public static void SwithShowMe()
 {
     UIBase.SwitchShowPanelByName(UIASSETS_ID.UIASSETS_FamilinfoPanel);
 }
Esempio n. 26
0
 public static void ShowMe()
 {
     UIBase.AsyncLoad(UIASSETS_ID.UIASSETS_employeeFrieUI);
 }
Esempio n. 27
0
 private void Awake()
 {
     TitleUIView.Instance = this;
     base.AwakeBase(BindingContext.BindingContextMode.MonoBinding, false);
 }
Esempio n. 28
0
 public static void HideMe()
 {
     UIBase.HidePanelByName(UIASSETS_ID.UIASSETS_employeeFrieUI);
 }
Esempio n. 29
0
    private void Push(int uiid)
    {
        UIBase ub = _ins.m_uicache[uiid];

        kernel.StartCoroutine(ub.DoTween(false, uiid, DoTweenOnPush));
    }
Esempio n. 30
0
 private void pmInitForm()
 {
     UIBase.WaitWind("Loading Form...");
     this.pmInitializeComponent();
     UIBase.WaitClear();
 }
Esempio n. 31
0
        private void pmInitGridProp()
        {
            //this.grdBrowView.SetDataBinding(this.dtsDataEnv.Tables[this.mstrAlias], "");
            //this.grdBrowView.RetrieveStructure();

            System.Data.DataView dvBrow = this.dtsDataEnv.Tables[this.mstrAlias].DefaultView;

            this.grdBrowView.DataSource = this.dtsDataEnv.Tables[this.mstrAlias];

            for (int intCnt = 0; intCnt < this.gridView1.Columns.Count; intCnt++)
            {
                this.gridView1.Columns[intCnt].Visible = false;
            }

            int i = 0;

            this.gridView1.Columns["nRecNo"].VisibleIndex  = i++;
            this.gridView1.Columns["cOPSeq"].VisibleIndex  = i++;
            this.gridView1.Columns["cPdType"].VisibleIndex = i++;
            this.gridView1.Columns["cQcProd"].VisibleIndex = i++;
            this.gridView1.Columns["cQnProd"].VisibleIndex = i++;
            //this.gridView1.Columns["cRemark1"].VisibleIndex = i++;
            if (this.mbllShowStock)
            {
                this.gridView1.Columns["nBalQty"].VisibleIndex = i++;
            }
            this.gridView1.Columns["nQty"].VisibleIndex     = i++;
            this.gridView1.Columns["nCost"].VisibleIndex    = i++;
            this.gridView1.Columns["nAmt"].VisibleIndex     = i++;
            this.gridView1.Columns["cQnUOM"].VisibleIndex   = i++;
            this.gridView1.Columns["cProcure"].VisibleIndex = i++;
            this.gridView1.Columns["cScrap"].VisibleIndex   = i++;

            this.gridView1.Columns["nRecNo"].Caption   = "No.";
            this.gridView1.Columns["cOPSeq"].Caption   = "OP. Seq.";
            this.gridView1.Columns["cPdType"].Caption  = "T";
            this.gridView1.Columns["cQcProd"].Caption  = UIBase.GetAppText(App.mLocale_UI, new string[] { "รหัสสินค้า", "RM / Product Code" });
            this.gridView1.Columns["cQnProd"].Caption  = UIBase.GetAppText(App.mLocale_UI, new string[] { "ชื่อสินค้า", "RM / Product Description" });
            this.gridView1.Columns["cRemark1"].Caption = UIBase.GetAppText(App.mLocale_UI, new string[] { "หมายเหตุ", "Remark" });
            this.gridView1.Columns["nBalQty"].Caption  = UIBase.GetAppText(App.mLocale_UI, new string[] { "คงเหลือ", "Stock" });
            this.gridView1.Columns["nQty"].Caption     = UIBase.GetAppText(App.mLocale_UI, new string[] { "จำนวน", "Qty." });
            this.gridView1.Columns["cQnUOM"].Caption   = UIBase.GetAppText(App.mLocale_UI, new string[] { "หน่วย", "Unit" });
            this.gridView1.Columns["nCost"].Caption    = UIBase.GetAppText(App.mLocale_UI, new string[] { "ต้นทุน", "Cost" });
            this.gridView1.Columns["nAmt"].Caption     = UIBase.GetAppText(App.mLocale_UI, new string[] { "มูลค่า", "Amt." });
            this.gridView1.Columns["cScrap"].Caption   = "Scrap";
            //this.gridView1.Columns["IsMRP"].Caption = "MRP";
            //this.gridView1.Columns["IsCost"].Caption = "Cost";
            //this.gridView1.Columns["IsOverHead"].Caption = "Over Hd.";
            //this.gridView1.Columns["IsIssue"].Caption = "Issue";
            this.gridView1.Columns["cProcure"].Caption = "Procure";
            //this.gridView1.Columns["cRoundCtrl"].Caption = "Round";
            //this.gridView1.Columns["cSubSti"].Caption = "S";
            //this.gridView1.Columns["cQcBOM"].Caption = UIBase.GetAppText(App.mLocale_UI, new string[] { "BOM", "BOM" });

            this.gridView1.Columns["nRecNo"].Width     = 50;
            this.gridView1.Columns["cOPSeq"].Width     = 80;
            this.gridView1.Columns["cPdType"].Width    = 50;
            this.gridView1.Columns["cQcProd"].Width    = 130;
            this.gridView1.Columns["cRemark1"].Width   = 80;
            this.gridView1.Columns["nBalQty"].Width    = 80;
            this.gridView1.Columns["nQty"].Width       = 80;
            this.gridView1.Columns["nCost"].Width      = 80;
            this.gridView1.Columns["cQnUOM"].Width     = 80;
            this.gridView1.Columns["cScrap"].Width     = 80;
            this.gridView1.Columns["cProcure"].Width   = 60;
            this.gridView1.Columns["cRoundCtrl"].Width = 60;
            //this.gridView1.Columns["cQcBOM"].Width = 130;
            //this.gridView1.Columns["cSubSti"].Width = 5;

            WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ERPConnectionString, App.DatabaseReside);

            this.gridView1.Columns["nRecNo"].AppearanceCell.BackColor = System.Drawing.Color.WhiteSmoke;
            this.gridView1.Columns["nRecNo"].OptionsColumn.AllowFocus = false;
            this.gridView1.Columns["nRecNo"].OptionsColumn.ReadOnly   = true;

            this.gridView1.Columns["cQnProd"].AppearanceCell.BackColor = System.Drawing.Color.WhiteSmoke;
            this.gridView1.Columns["cQnProd"].OptionsColumn.AllowFocus = false;
            this.gridView1.Columns["cQnProd"].OptionsColumn.ReadOnly   = true;

            this.gridView1.Columns["cQnUOM"].AppearanceCell.BackColor = System.Drawing.Color.WhiteSmoke;
            this.gridView1.Columns["cQnUOM"].OptionsColumn.AllowFocus = false;
            this.gridView1.Columns["cQnUOM"].OptionsColumn.ReadOnly   = true;

            this.gridView1.Columns["nBalQty"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            this.gridView1.Columns["nBalQty"].DisplayFormat.FormatString = "#,###,###,##0.0000";

            this.gridView1.Columns["nQty"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            this.gridView1.Columns["nQty"].DisplayFormat.FormatString = "#,###,###,##0.0000";

            this.gridView1.Columns["nQty"].SummaryItem.DisplayFormat = "{0:#,###,##0.0000;-#,###,##0.0000; }";
            this.gridView1.Columns["nQty"].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;

            this.gridView1.Columns["nCost"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            this.gridView1.Columns["nCost"].DisplayFormat.FormatString = "#,###,###,##0.0000";

            this.gridView1.Columns["nCost"].SummaryItem.DisplayFormat = "{0:#,###,##0.0000;-#,###,##0.0000; }";
            this.gridView1.Columns["nCost"].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;


            this.gridView1.Columns["nAmt"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            this.gridView1.Columns["nAmt"].DisplayFormat.FormatString = "#,###,###,##0.0000";

            this.gridView1.Columns["nAmt"].SummaryItem.DisplayFormat = "{0:#,###,##0.0000;-#,###,##0.0000; }";
            this.gridView1.Columns["nAmt"].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
        }
Esempio n. 32
0
    void Awake()
    {
        UIBase tmpBase = transform.GetComponentInParent <UIBase>();

        UIManager.Instance.RegistGameObject(tmpBase.name, transform.name, gameObject);
    }
Esempio n. 33
0
 public static void ShowMe()
 {
     UIBase.AsyncLoad(UIASSETS_ID.UIASSETS_BabyTuJianPanel);
 }
Esempio n. 34
0
 public static void SwithShowMe()
 {
     UIBase.SwitchShowPanelByName(UIASSETS_ID.UIASSETS_BabyTuJianPanel);
 }
		public override void OnLevelLoaded(LoadMode mode) {
            Log._Debug("OnLevelLoaded calling base method");
            base.OnLevelLoaded(mode);

            Log._Debug("OnLevelLoaded Returned from base, calling custom code.");
			Instance = this;

			gameLoaded = false;
            switch (mode) {
                case LoadMode.NewGame:
                case LoadMode.LoadGame:
					gameLoaded = true;
					break;
				default:
					return;
            }

			TrafficPriority.OnLevelLoading();
#if !TAM
			determinePathManagerCompatible();
			
			//SpeedLimitManager.GetDefaultSpeedLimits();

			if (IsPathManagerCompatible && ! IsPathManagerReplaced) {
				try {
					Log._Debug("Pathfinder Compatible. Setting up CustomPathManager and SimManager.");
					var pathManagerInstance = typeof(Singleton<PathManager>).GetField("sInstance", BindingFlags.Static | BindingFlags.NonPublic);

					var stockPathManager = PathManager.instance;
					Log._Debug($"Got stock PathManager instance {stockPathManager.GetName()}");

					CustomPathManager = stockPathManager.gameObject.AddComponent<CustomPathManager>();
					Log._Debug("Added CustomPathManager to gameObject List");

					if (CustomPathManager == null) {
						Log.Error("CustomPathManager null. Error creating it.");
						return;
					}

					CustomPathManager.UpdateWithPathManagerValues(stockPathManager);
					Log._Debug("UpdateWithPathManagerValues success");

					pathManagerInstance?.SetValue(null, CustomPathManager);

					Log._Debug("Getting Current SimulationManager");
					var simManager =
						typeof(SimulationManager).GetField("m_managers", BindingFlags.Static | BindingFlags.NonPublic)?
							.GetValue(null) as FastList<ISimulationManager>;

					Log._Debug("Removing Stock PathManager");
					simManager?.Remove(stockPathManager);

					Log._Debug("Adding Custom PathManager");
					simManager?.Add(CustomPathManager);

					Object.Destroy(stockPathManager, 10f);

					IsPathManagerReplaced = true;
				} catch (Exception) {
					UIView.library.ShowModal<ExceptionPanel>("ExceptionPanel").SetMessage("Incompatibility Issue", "Traffic Manager: President Edition detected an incompatibility with another mod! You can continue playing but it's NOT recommended. Traffic Manager will not work as expected.", true);
					IsPathManagerCompatible = false;
				}
			}

			Log._Debug("Adding Controls to UI.");
			UI = ToolsModifierControl.toolController.gameObject.AddComponent<UIBase>();

			initDetours();
#endif
		}
Esempio n. 36
0
        /// <summary>
        /// Load UI form the resources folder based on the scene UI type.
        /// </summary>
        /// <param name="ui">The type of the scene UI</param>
        /// <returns>Return NULL if load resources process failed.</returns>
        public UIBase LoadUI(SceneUIs ui, Transform parent = null)
        {
            // If the target UI is already in list, ignore the call.
            if (m_NormalUIs.ContainsKey(ui) || m_UIWontDestoryThroughSceneChange.ContainsKey(ui))
            {
                return(null);
            }

            // Load the UI prefab form the resources folder.
            UIBase uiPrefab = Resources.Load <UIBase>(GetUIPrefabPath(ui));

            // If sucessfully loaded the UI prefab form the resource folder.
            if (uiPrefab != null)
            {
                // Instantiate a new object base on this prefab.
                UIBase uiGameObject = Instantiate(uiPrefab);
                // Init the UI.
                uiGameObject.InitUI();

                // Set UI gameObject's parent transform.
                switch (uiGameObject.Properties.GetUIType)
                {
                case UITypes.AboveBlurEffect:
                    if (!parent)
                    {
                        GameUtility.AddChildToParent(m_AboveBlurEffectRoot, uiGameObject.transform);
                    }
                    else
                    {
                        GameUtility.AddChildToParent(parent, uiGameObject.transform);
                    }
                    break;

                case UITypes.UnderBlurEffect:
                    if (!parent)
                    {
                        GameUtility.AddChildToParent(m_UnderBlurEffectRoot, uiGameObject.transform);
                    }
                    else
                    {
                        GameUtility.AddChildToParent(parent, uiGameObject.transform);
                    }
                    break;

                default:
#if UNITY_EDITOR
                    Debug.LogError("Unexpected switch case in UImanager's LoadUI method.");
#endif
                    return(null);
                }

                // Reset the UI rect transform.
                uiGameObject.GetComponent <RectTransform>().ExpandToMaxFormCenter();

                // Only the root UI will be store to the list.
                if (uiGameObject.Properties.IsRootUI)
                {
                    // Add the ui into appropriate list.
                    if (uiGameObject.Properties.WontDestoryWhenSceneChange)
                    {
                        m_UIWontDestoryThroughSceneChange.Add(ui, uiGameObject);
                    }
                    else
                    {
                        m_NormalUIs.Add(ui, uiGameObject);
                    }
                }

                // Reture result.
                return(uiGameObject);
            }
#if UNITY_EDITOR
            Debug.Log("Failed to load the UI prefab, the path to target prefab object: " + GetUIPrefabPath(ui));
#endif
            return(null);
        }
        public override void OnLevelLoaded(LoadMode mode)
        {
            Debug.Log("OnLevelLoaded calling base method");
            base.OnLevelLoaded(mode);
            Debug.Log("OnLevelLoaded Returned from base, calling custom code.");

            switch (mode)
            {
                case LoadMode.NewGame:
                    OnNewGame();
                    break;
                case LoadMode.LoadGame:
                    OnLoaded();
                    break;
            }

            if (mode == LoadMode.NewGame || mode == LoadMode.LoadGame)
            {
                if (Instance == null)
                {
                    Debug.Log("Instance is NULL. Set Instance to this.");
                    if (Singleton<PathManager>.instance.GetType() != typeof (PathManager))
                    {
                        PathfinderIncompatibility = true;
                    }

                    Instance = this;
                }

                if (!PathfinderIncompatibility)
                {
                    Debug.Log("Pathfinder Compatible. Setting up CustomPathManager and SimManager.");
                    var pathManagerInstance = typeof (Singleton<PathManager>).GetField("sInstance",
                        BindingFlags.Static | BindingFlags.NonPublic);
                    var stockPathManager = PathManager.instance;
                    CustomPathManager = stockPathManager.gameObject.AddComponent<CustomPathManager>();
                    CustomPathManager.UpdateWithPathManagerValues(stockPathManager);
                    pathManagerInstance?.SetValue(null, CustomPathManager);
                    var simManager =
                        typeof (SimulationManager).GetField("m_managers", BindingFlags.Static | BindingFlags.NonPublic)?
                            .GetValue(null) as FastList<ISimulationManager>;
                    simManager?.Remove(stockPathManager);
                    simManager?.Add(CustomPathManager);
                    Object.Destroy(stockPathManager, 10f);
                }

                Debug.Log("Adding Controls to UI.");
                UI = ToolsModifierControl.toolController.gameObject.AddComponent<UIBase>();
                TrafficPriority.LeftHandDrive = Singleton<SimulationManager>.instance.m_metaData.m_invertTraffic ==
                                                SimulationMetaData.MetaBool.True;
            }
        }
Esempio n. 38
0
 public void DestroyItem(UIBase item)
 {
     if(m_ChildList.Contains(item))
     {
         m_ChildList.Remove(item);
         item.OnDestroy();
         GameObjectManager.DestroyGameobjectByPool(item.gameObject);
     }
 }