Ejemplo n.º 1
0
    /// <summary>
    /// 根据数据库获取的数据,实例化标签列表
    /// </summary>
    public void ShowCatsItem(GameObject sender)
    {
        if (!moveButton.activeInHierarchy)
        {
            moveButton.SetActive(true);
        }

        if (sender.GetComponent <UIToggle>().value)
        {
            //对比一下当前列表的第一个子对象,如果groupId等于sender的groupId,
            //如果不同就全清除掉,并且清除掉已经选择的数据

            if (catGrid.transform.childCount != 0 && catGrid.transform.GetChild(0).GetComponent <CatInfo>().GroupId != sender.GetComponent <GroupInfo>().GroupId)
            {
                for (int i = 0; i < catGrid.transform.childCount; i++)
                {
                    Destroy(catGrid.transform.GetChild(i).gameObject);
                }
            }
            int id = sender.GetComponent <GroupInfo>().GroupId;

            // 请求分组数据
            JsonData data = new JsonData();
            data["id"] = id;
            AppFacade.GetInstance().SendNotification(NotiConst.GET_CAT_GROUP_INFO, data);
        }
        ShowCatInfo(null);
        selectedItems.Clear();                        //避免存放选择失效
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 点击标题的回调函数,显示喵分组
    /// </summary>
    /// <param name="sender">Sender.</param>
    private void showItem(GameObject sender)
    {
        // 如果不显示按钮,则显示按钮
        if (!MoveBtn.activeInHierarchy)
        {
            MoveBtn.SetActive(true);
        }
        //当点击toggle的时候,无论是选中还是取消选中都会调用这里,所以需要判断
        if (sender.GetComponent <UIToggle>().value)
        {
            buildingType = (BuildingBlueprintType)sender.GetComponent <GroupInfo>().GroupId;
            if (buildingType == BuildingBlueprintType.Blueprint)
            {
                SellBtn.SetActive(false);
                MoveBtn.GetComponentInChildren <UILabel>().text = "购入";
                SelectedItem.Clear();
                showBuildingBlueprint();
            }
            else if (buildingType == BuildingBlueprintType.Building)
            {
                MoveBtn.GetComponentInChildren <UILabel>().text = "建造";
                SellBtn.SetActive(true);

                SellBtn.GetComponentInChildren <UILabel>().text = "出售";
                AppFacade.GetInstance().SendNotification(NotiConst.GET_BUILDING_DATA);
            }
            else if (buildingType == BuildingBlueprintType.status)
            {
                SellBtn.SetActive(false);
                MoveBtn.GetComponentInChildren <UILabel>().text = "拆除";
                removeAllGridChildren();
            }
        }
    }
Ejemplo n.º 3
0
 /// <summary>
 /// 蓝图界面点击购买
 /// </summary>
 /// <param name="go">Go.</param>
 void onClickPurchase()
 {
     if (SelectedItem.Count > 0)
     {
         AppFacade.GetInstance().SendNotification(NotiConst.PURCHASE_BLUEPRINT, SelectedItem);
     }
 }
Ejemplo n.º 4
0
 public AppInfoDialog(BenchConfiguration config, AppFacade app)
 {
     InitializeComponent();
     gridResolved.DoubleBuffered(true);
     lblAppId.Text = app.Label;
     LoadProperties(config, app);
 }
Ejemplo n.º 5
0
    /// <summary>
    /// 确定 解雇猫
    /// </summary>
    private void DeleteOkButton()
    {
        for (int i = 0; i < catGrid.transform.childCount; i++)
        {
            Destroy(catGrid.transform.GetChild(i).gameObject);
        }
        JsonData deleteCat = new JsonData();

        deleteCat["count"] = selectedItems.Count;

        for (int i = 0; i < selectedItems.Count; i++)
        {
            var obj = selectedItems[i] as GameObject;
            if (obj != null)
            {
                var cat = obj.GetComponent <CatInfo>();
                if (cat == null)
                {
                    Debug.LogError("错误 组件错误");
                    return;
                }
                if (i == 0)
                {
                    deleteCat["group"] = cat.GroupId;
                }

                deleteCat[i.ToString()] = cat.Id;
            }
        }
        selectedItems.Clear();
        AppFacade.GetInstance().SendNotification(NotiConst.CAT_DELETE, deleteCat);
        moveButton.gameObject.SetActive(true);
    }
Ejemplo n.º 6
0
 void OnBtnClick(GameObject go)
 {
     if (go == CancelBtn && menutype == EnumGlobal.MenuType.CatGroupMenu)
     {
         Debug.Log("+++++++++++++");
         AppFacade.GetInstance().SendNotification(NotiConst.CAT_GROUP_CLOSE);
         Debug.Log("-------------");
         catGroupMenuGameObject.SetActive(false);
         menutype = EnumGlobal.MenuType.Null;
     }
     else if (go == DeleteCloseBtn && menutype == EnumGlobal.MenuType.CatGroupMenu)
     {
         DeleteCancelButton();
         ConfirmPanel.SetActive(false);
     }
     else if (go == DeleteOkBtn && menutype == EnumGlobal.MenuType.CatGroupMenu)
     {
         DeleteOkButton();
         ConfirmPanel.SetActive(false);
     }
     else if (go == moveButton && menutype == EnumGlobal.MenuType.CatGroupMenu)
     {
         Debug.Log("测试1");
         OnMoveButtonChicked(go);
     }
 }
Ejemplo n.º 7
0
    void OnBtnClick(GameObject go)
    {
        if (go == CatGroupBtn)
        {
            Debug.Log(" CatGroupBtn");
            AppFacade.getInstance.SendNotification(NotiConst.GET_CAT_GROUP_DATA);
            CatGroupMenuMediator catGroupMediator = AppFacade.getInstance.RetrieveMediator(CatGroupMenuMediator.NAME) as CatGroupMenuMediator;
            //            catGroupMediator.catGroupMenuView.catGroupMenuGameObject.SetActive(true);
            //0107 lgx 修改 显示猫分组不能这就草草的显示界面就行需要准备
            catGroupMediator.catGroupMenuView.menutype = EnumGlobal.MenuType.CatGroupMenu;
            catGroupMediator.catGroupMenuView.showCatGroup();
        }
        else if (go == PromoteBtn)
        {
            CustomerMediator customerMediator = AppFacade.GetInstance().RetrieveMediator(CustomerMediator.NAME) as CustomerMediator;
            (customerMediator.ViewComponent as CustomerView).RemoveCustomer();

            //AppFacade.getInstance.SendNotification(NotiConst.CAT_LEAVE_ADD_GOLD);
            //StartCoroutine(SpawnCats());
        }
        else if (go == PromoteBtn_Exp)
        {
            SetExp(Exp + 1000);
        }
        else if (go == BattleBtn)
        {
            (AppFacade.getInstance.RetrieveMediator(SceneMediator.NAME) as SceneMediator).LoadScene(SceneConst.BattleScene);
        }
    }
Ejemplo n.º 8
0
    public override void Execute(INotification notification)
    {
        var buildingProxy = Facade.RetrieveProxy(BuildingProxy.Name) as BuildingProxy;
        var userProxy     = Facade.RetrieveProxy(UserProxy.Name) as UserProxy;
        var buildingId    = (int)notification.Body;

        var buildingData = buildingProxy.getBuildingInfo(buildingId);
        var goldCost     = buildingData.getNextLevelGoldCost();

        // 检测消耗
        if (!userProxy.hasEnoughGold(goldCost))
        {
            Facade.SendNotification(OptResultDefine.NotifyNotEnoughMoney);
            return;
        }

        // 消耗
        userProxy.costGold(goldCost);
        userProxy.addHonor(buildingData.getHonorAdded());

        // 建筑升级成功
        buildingProxy.buildingLevelUp(buildingData.Id);
        Facade.SendNotification(BuildingFacade.NotifyBuildingLevelUpSuccess, buildingId);

        // 数据更新
        AppFacade.getInstance().DataUpdated();
    }
Ejemplo n.º 9
0
    private void Start()
    {
        Debug.Log("<======游戏启动======>");
        AppFacade facade = (AppFacade)AppFacade.Instance;

        facade.Startup();
    }
Ejemplo n.º 10
0
    public override void Execute(INotification notification)
    {
        object[] param    = notification.Body as object[];
        var      pupilId  = (int)param[0];
        var      itemData = param[1] as ItemData;

        var goodsProxy = Facade.RetrieveProxy(GoodsProxy.Name) as GoodsProxy;
        var pupilProxy = Facade.RetrieveProxy(PupilProxy.Name) as PupilProxy;

        var pupilInfo    = pupilProxy.getPupilInfo(pupilId);
        var equipingItem = pupilInfo.GetEquipingWuXue();

        // 卸下原有的武学
        if (equipingItem != null)
        {
            pupilInfo.EquipItems.Remove(equipingItem);
            goodsProxy.AddItem(equipingItem.Id, equipingItem.Type, 1);
        }

        // 装备上新的武学
        pupilInfo.EquipItems.Add(itemData);
        goodsProxy.RemoveItem(itemData.Id, itemData.Type, 1);

        // 数据更新
        AppFacade.getInstance().DataUpdated();

        WinCenter.inst.ShowTips("装备" + itemData.Name + "成功!");
    }
Ejemplo n.º 11
0
        public void TestCorrectness()
        {
            var          facade = new AppFacade();
            TrianglePath path   = facade.RunMinimumPathFinding(new StringDataProvider("7\r\n6 3\r\n3 8 5\r\n11 2 10 9"));

            Assert.AreEqual(path.Sum, 18);
        }
Ejemplo n.º 12
0
 public void Login()
 {
     tempData          = new TempLogRegDataVO();
     tempData.UserName = UserName.value;
     tempData.Password = PassWord.value;
     AppFacade.GetInstance().SendNotification(NotiConst.LOGIN_REQUEST, tempData);
 }
Ejemplo n.º 13
0
        public void TestCorrectness3()
        {
            var          facade = new AppFacade();
            TrianglePath path   = facade.RunMinimumPathFinding(new StringDataProvider("5\r\n4 1\r\n6 3 8\r\n8 4 3 9\r\n6 3 1 2 4\r\n7 7 8 5 3 8"));

            Assert.AreEqual(path.Sum, 17);
        }
Ejemplo n.º 14
0
    public override void OnRefresh()
    {
        var buildingProxy = AppFacade.getInstance().RetrieveProxy(BuildingProxy.Name) as BuildingProxy;
        var buildingInfo  = buildingProxy.getBuildingInfo(m_BuildingId);

        m_UI.m_LabelCost.text = buildingInfo.getNextLevelGoldCost().ToString();
    }
Ejemplo n.º 15
0
    /// <summary>
    /// 得到猫分组信息
    /// </summary>
    void GetCatCurrentGroupData()
    {
        JsonData data = new JsonData();

        data["id"] = ++CurrentGroupInfo;                           //对应索引相差1;
        Debug.Log("当前选择组" + CurrentGroupInfo);
        AppFacade.GetInstance().SendNotification(NotiConst.GET_BATTLE_CAT_GROUP_INFO, data);
    }
Ejemplo n.º 16
0
 void RegisNotification()
 {
     mCommandFacade = AppFacade.instance;
     mCommandFacade.addCommand(CommandInteracType.STARTAPP_COMMAND, typeof(StartAppMacroCommand));
     //mCommandFacade.addCommand(CommandInteracType.STARTAPP_ASYNC_COMMAND, StartAppAnsyCommand);
     this.notify(CommandInteracType.STARTAPP_COMMAND);
     state = EState.eInitGameSetting;
 }
Ejemplo n.º 17
0
    /// <summary>
    /// 猫删除完成 重新请求 猫分组数据
    /// </summary>
    /// <param name="data"></param>
    public void CatDeleteFinsh(object data)
    {
        JsonData group     = (JsonData)data;
        JsonData groupData = new JsonData();

        groupData["id"] = group["group"];
        AppFacade.GetInstance().SendNotification(NotiConst.GET_CAT_GROUP_INFO, groupData);
    }
Ejemplo n.º 18
0
 public static AppFacade GetInstance()
 {
     if (instance == null)
     {
         instance = new AppFacade();
     }
     return(instance);
 }
Ejemplo n.º 19
0
 private ListViewItem AppItem(AppFacade app)
 {
     return new ListViewItem(app.Launcher)
     {
         Tag = app.ID,
         ImageKey = app.ID,
     };
 }
Ejemplo n.º 20
0
 public static AppFacade getInstance()
 {
     if (Inst == null)
     {
         Inst = new AppFacade();
     }
     return(Inst);
 }
Ejemplo n.º 21
0
    public override void Execute(INotification notification)
    {
        UserInfoProxy user = AppFacade.GetInstance().RetrieveProxy(UserInfoProxy.NAME) as UserInfoProxy;
        BuildModelVo  vo   = notification.Body as BuildModelVo;

        user.setfacility(vo);

        //设置模型与位置信息;
    }
Ejemplo n.º 22
0
    public override void Execute(INotification notification)
    {
        var adventureProxy = Facade.RetrieveProxy(AdventureProxy.Name) as AdventureProxy;

        adventureProxy.StartAdventure((int)notification.Body);

        // 数据更新
        AppFacade.getInstance().DataUpdated();
    }
Ejemplo n.º 23
0
    public override void Execute(INotification notification)
    {
        LoginVO loginVo = new LoginVO();

        loginVo = notification.Body as LoginVO;
        UserLoginProxy userLoginProxy = (UserLoginProxy)AppFacade.GetInstance().RetrieveProxy(UserLoginProxy.NAME);

        userLoginProxy.LoginToData(loginVo.Id, loginVo.Pwd);
    }
Ejemplo n.º 24
0
 void Start()
 {
     DontDestroyOnLoad(this);
     gameObject.AddComponent <TimeTickService>();
     gameObject.AddComponent <AudioManager>();
     UIPackage.AddPackage("UI/Common");
     UIConfig.defaultFont = "siyuan";
     UIConfig.buttonSound = UIPackage.GetItemAsset("Common", "ButtonClick") as NAudioClip;
     AppFacade.getInstance().StartUp(this);
 }
Ejemplo n.º 25
0
        /// <summary>
        /// 初始化接口
        /// </summary>
        /// <param name="url">图纸的url</param>
        public void Init(string url)
        {
            WWWLoadManager loader = AppFacade.Instance().WWWLoadManager;

            loader.StartLoadRes(url, this, bytes =>
            {
                DrawingImage.sprite = Util.GetSprite(bytes);
            });
            Reset();
        }
Ejemplo n.º 26
0
    public override void Execute(INotification notification)
    {
        // 放弃奇遇
        var skillCreateProxy = Facade.RetrieveProxy(SkillCreateProxy.Name) as SkillCreateProxy;

        skillCreateProxy.giveUpEvent();
        Facade.SendNotification(SkillCreateFacade.NotifyGiveUpEventSuccess);

        // 数据更新
        AppFacade.getInstance().DataUpdated();
    }
Ejemplo n.º 27
0
    public override void OnRefresh()
    {
        var userProxy = AppFacade.getInstance().RetrieveProxy(UserProxy.Name) as UserProxy;
        var userData  = userProxy.getData();

        m_UI.m_TextGold.text  = userData.Gold.ToString();
        m_UI.m_TestHonor.text = userData.Honor.ToString();

        m_UI.m_ViewState.selectedIndex = 0;
        m_UI.m_BuildingList.scrollPane.ScrollBottom(false);
    }
Ejemplo n.º 28
0
 // Update is called once per frame
 void Update()
 {
     if (NextSaveTime > 0)
     {
         var curTime = TimeUtil.ConvertDateTimeToLong(System.DateTime.Now);
         if (curTime - NextSaveTime >= 1)
         {
             NextSaveTime = 0;
             AppFacade.getInstance().DataSave();
         }
     }
 }
Ejemplo n.º 29
0
    public override void Execute(INotification notification)
    {
        var placeId = (int)notification.Body;

        // 放弃奇遇
        var skillCreateProxy = Facade.RetrieveProxy(SkillCreateProxy.Name) as SkillCreateProxy;

        skillCreateProxy.tryEvent(placeId);

        // 数据更新
        AppFacade.getInstance().DataUpdated();
    }
Ejemplo n.º 30
0
        public static void Main()
        {
            var culture = (CultureInfo)CultureInfo.CurrentCulture.Clone();

            culture.DateTimeFormat.ShortDatePattern = "dd/MM/yyyy";
            culture.DateTimeFormat.LongTimePattern  = "";
            Thread.CurrentThread.CurrentCulture     = culture;
            AppFacade.Initialize(false);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(AppFacade.Container.Resolve <AppMediator>());
        }
Ejemplo n.º 31
0
        static int _g_get_GoContainer(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);

                AppFacade gen_to_be_invoked = (AppFacade)translator.FastGetCSObj(L, 1);
                translator.Push(L, gen_to_be_invoked.GoContainer);
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
            return(1);
        }
Ejemplo n.º 32
0
        public void TestPerformance()
        {
            AppFacade facade = new AppFacade();

            Stopwatch watch = Stopwatch.StartNew();

            facade.RunMinimumPathFinding(new RandomDataProvider());

            watch.Stop();

            Assert.IsTrue(watch.Elapsed < TimeSpan.FromMilliseconds(500));
        }
Ejemplo n.º 33
0
 private Task<Tuple<Icon, Icon>> LoadIcons(AppFacade app)
 {
     return Task.Run(() =>
     {
         var path = app.LauncherIcon;
         Icon icon;
         try
         {
             icon = Icon.ExtractAssociatedIcon(path);
         }
         catch (Exception)
         {
             icon = Resources.MissingApp;
         }
         return Tuple.Create(
             new Icon(icon, icons16.ImageSize),
             new Icon(icon, icons32.ImageSize));
     });
 }
Ejemplo n.º 34
0
 private async void DeleteAppResourceHandler(object sender, EventArgs e)
 {
     AnnounceTask("Delete App Resource for " + contextApp.ID);
     await core.DeleteAppResourcesAsync(TaskInfoHandler, contextApp.ID);
     contextApp = null;
 }
Ejemplo n.º 35
0
 private Task<Image> ExtractLauncherIcon(AppFacade app)
 {
     return Task.Run<Image>(() =>
     {
         var path = app.LauncherIcon;
         if (string.IsNullOrEmpty(app.Launcher) || string.IsNullOrEmpty(path)) return null;
         Icon icon;
         try
         {
             icon = Icon.ExtractAssociatedIcon(path);
         }
         catch (Exception)
         {
             return null;
         }
         return new Icon(icon, new Size(16, 16)).ToBitmap();
     });
 }
Ejemplo n.º 36
0
 private async void UpgradePackageHandler(object sender, EventArgs e)
 {
     AnnounceTask("Upgrade App " + contextApp.ID);
     await core.UpgradeAppsAsync(TaskInfoHandler, contextApp.ID);
     contextApp = null;
 }
Ejemplo n.º 37
0
 private async void DownloadAppResourceHandler(object sender, EventArgs e)
 {
     AnnounceTask("Download App Resource for " + contextApp.ID);
     await core.DownloadAppResourcesAsync(contextApp.ID, TaskInfoHandler);
     contextApp = null;
 }
Ejemplo n.º 38
0
        private void gridApps_RowContextMenuStripNeeded(object sender, DataGridViewRowContextMenuStripNeededEventArgs e)
        {
            if (e.RowIndex < 0) return;
            var row = gridApps.Rows[e.RowIndex];
            row.Selected = true;
            var appWrapper = row.DataBoundItem as AppWrapper;
            if (appWrapper == null) return;
            contextApp = appWrapper.App;

            miWebsite.Visible = !string.IsNullOrEmpty(contextApp.Website);

            miInstall.Visible = contextApp.CanInstall;
            miReinstall.Visible = contextApp.CanReinstall;
            miUpgrade.Visible = contextApp.CanUpgrade;
            miPackageUpgrade.Visible = contextApp.IsInstalled && contextApp.IsManagedPackage;
            miUninstall.Visible = contextApp.CanUninstall;

            miDownloadResource.Visible = contextApp.CanDownloadResource;
            miDeleteResource.Visible = contextApp.CanDeleteResource;

            var g1 = contextApp.CanInstall
                  || contextApp.CanReinstall
                  || contextApp.CanUpgrade
                  || contextApp.IsInstalled && contextApp.IsManagedPackage
                  || contextApp.CanUninstall;
            var g2 = contextApp.CanDownloadResource
                  || contextApp.CanDeleteResource;

            tsSeparatorWebsite.Visible = g1;
            tsSeparatorDownloads.Visible = g1 && g2;

            e.ContextMenuStrip = ctxmAppActions;
        }
Ejemplo n.º 39
0
        private void LoadProperties(BenchConfiguration config, AppFacade app)
        {
            gridResolved.Rows.Clear();
            AddRow(gridResolved, "ID", app.ID);
            AddRow(gridResolved, PropertyKeys.AppTyp, app.Typ);
            AddRow(gridResolved, PropertyKeys.AppWebsite, app.Website);
            AddRow(gridResolved, PropertyKeys.AppDocs, app.Docs);
            AddRow(gridResolved, PropertyKeys.AppVersion, app.Version);
            AddRow(gridResolved, "Installed Version", app.InstalledVersion);
            AddRow(gridResolved, PropertyKeys.AppDependencies, app.Dependencies);
            AddRow(gridResolved, PropertyKeys.AppForce, app.Force);
            AddRow(gridResolved, PropertyKeys.AppSetupTestFile, app.SetupTestFile);
            AddRow(gridResolved, PropertyKeys.AppPackageName, app.PackageName);
            AddRow(gridResolved, PropertyKeys.AppUrl, app.Url);
            AddRow(gridResolved, PropertyKeys.AppDownloadCookies, app.DownloadCookies);
            AddRow(gridResolved, PropertyKeys.AppDownloadHeaders, app.DownloadHeaders);
            AddRow(gridResolved, PropertyKeys.AppResourceName, app.ResourceFileName);
            AddRow(gridResolved, PropertyKeys.AppArchiveName, app.ResourceArchiveName);
            AddRow(gridResolved, PropertyKeys.AppArchivePath, app.ResourceArchivePath);
            AddRow(gridResolved, PropertyKeys.AppDir, app.Dir);
            AddRow(gridResolved, PropertyKeys.AppExe, app.Exe);
            AddRow(gridResolved, PropertyKeys.AppRegister, app.Register);
            AddRow(gridResolved, PropertyKeys.AppPath, app.Path);
            AddRow(gridResolved, PropertyKeys.AppEnvironment, app.Environment);
            AddRow(gridResolved, PropertyKeys.AppAdornedExecutables, app.AdornedExecutables);
            AddRow(gridResolved, PropertyKeys.AppRegistryKeys, app.RegistryKeys);
            AddRow(gridResolved, PropertyKeys.AppLauncher, app.Launcher);
            AddRow(gridResolved, PropertyKeys.AppLauncherExecutable, app.LauncherExecutable);
            AddRow(gridResolved, PropertyKeys.AppLauncherArguments, app.LauncherArguments);
            AddRow(gridResolved, PropertyKeys.AppLauncherIcon, app.LauncherIcon);
            foreach(var key in config.PropertyNames(app.ID))
            {
                if (!KnownProperties.Contains(key))
                {
                    AddRow(gridResolved, key, config.GetGroupValue(app.ID, key));
                }
            }

            gridRaw.Rows.Clear();
            AddRow(gridRaw, "ID", app.ID);
            foreach(var key in config.PropertyNames(app.ID))
            {
                AddRow(gridRaw, key, config.GetRawGroupValue(app.ID, key));
            }
        }
Ejemplo n.º 40
0
 private async void UninstallAppHandler(object sender, EventArgs e)
 {
     AnnounceTask("Uninstall App " + contextApp.ID);
     await core.UninstallAppsAsync(TaskInfoHandler, contextApp.ID);
     contextApp = null;
 }
Ejemplo n.º 41
0
 public AppWrapper(AppFacade app, int no)
 {
     this.app = app;
     this.no = no;
 }