Esempio 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();                        //避免存放选择失效
    }
Esempio 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();
            }
        }
    }
Esempio n. 3
0
 /// <summary>
 /// 蓝图界面点击购买
 /// </summary>
 /// <param name="go">Go.</param>
 void onClickPurchase()
 {
     if (SelectedItem.Count > 0)
     {
         AppFacade.GetInstance().SendNotification(NotiConst.PURCHASE_BLUEPRINT, SelectedItem);
     }
 }
Esempio n. 4
0
 public AppInfoDialog(BenchConfiguration config, AppFacade app)
 {
     InitializeComponent();
     gridResolved.DoubleBuffered(true);
     lblAppId.Text = app.Label;
     LoadProperties(config, app);
 }
Esempio 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);
    }
Esempio 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);
     }
 }
Esempio 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);
        }
    }
Esempio 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();
    }
    private void Start()
    {
        Debug.Log("<======游戏启动======>");
        AppFacade facade = (AppFacade)AppFacade.Instance;

        facade.Startup();
    }
Esempio 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 + "成功!");
    }
        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);
        }
Esempio n. 12
0
 public void Login()
 {
     tempData          = new TempLogRegDataVO();
     tempData.UserName = UserName.value;
     tempData.Password = PassWord.value;
     AppFacade.GetInstance().SendNotification(NotiConst.LOGIN_REQUEST, tempData);
 }
        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);
        }
Esempio 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();
    }
Esempio 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);
    }
Esempio 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;
 }
Esempio 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);
    }
Esempio n. 18
0
 public static AppFacade GetInstance()
 {
     if (instance == null)
     {
         instance = new AppFacade();
     }
     return(instance);
 }
Esempio n. 19
0
 private ListViewItem AppItem(AppFacade app)
 {
     return new ListViewItem(app.Launcher)
     {
         Tag = app.ID,
         ImageKey = app.ID,
     };
 }
Esempio n. 20
0
 public static AppFacade getInstance()
 {
     if (Inst == null)
     {
         Inst = new AppFacade();
     }
     return(Inst);
 }
Esempio 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);

        //设置模型与位置信息;
    }
Esempio 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();
    }
Esempio 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);
    }
Esempio 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);
 }
Esempio 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();
        }
Esempio 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();
    }
Esempio 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);
    }
Esempio 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();
         }
     }
 }
Esempio 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();
    }
Esempio 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>());
        }
Esempio 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);
        }
Esempio 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));
        }
Esempio 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));
     });
 }
Esempio 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;
 }
Esempio 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();
     });
 }
Esempio n. 36
0
 private async void UpgradePackageHandler(object sender, EventArgs e)
 {
     AnnounceTask("Upgrade App " + contextApp.ID);
     await core.UpgradeAppsAsync(TaskInfoHandler, contextApp.ID);
     contextApp = null;
 }
Esempio 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;
 }
Esempio 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;
        }
Esempio 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));
            }
        }
Esempio n. 40
0
 private async void UninstallAppHandler(object sender, EventArgs e)
 {
     AnnounceTask("Uninstall App " + contextApp.ID);
     await core.UninstallAppsAsync(TaskInfoHandler, contextApp.ID);
     contextApp = null;
 }
Esempio n. 41
0
 public AppWrapper(AppFacade app, int no)
 {
     this.app = app;
     this.no = no;
 }