コード例 #1
0
ファイル: BagItem.cs プロジェクト: moto2002/DinaGameClient
        public void DoDrop(UnityEngine.GameObject go)
        {
            if (go == null)
            {
                return;
            }

            IDragable dragObj = go.GetComponent <DragItem>();
            string    type    = dragObj.DragType;

            if (type.Equals(DRAG_TYPE))
            {
                if (DragItem.mDraggedItem != null)
                {
                    BagLogic.GetInstance().ExChangeItem((DragItem.mDraggedItem as ItemInfo).Position, slot);
                }
            }
            else if (type.Equals(EquipItem.DRAG_TYPE))
            {
                if (DragItem.mDraggedItem != null)
                {
                    //int target = BagManager.GetInstance().GetNullPosition();
                    int target = BagLogic.GetInstance().GetNullPosition();
                    if (target != -1)
                    {
                        BagLogic.GetInstance().UnLoadEquip((DragItem.mDraggedItem as EquipInfo).PutWhere, slot);
                    }
                    else
                    {
                        Debug.Log("背包已满");
                    }
                }
            }
        }
コード例 #2
0
        private void OnSure(GameObject go)
        {
            int stackNum = Int32.Parse(Input.label.text);

            BagLogic.GetInstance().SendUseItemByNum(KPackageType.ePlayerPackage, KPlayerPackageIndex.eppiPlayerItemBox, pos, stackNum);
            Hide();
        }
コード例 #3
0
ファイル: EquipItem.cs プロジェクト: moto2002/DinaGameClient
        public void DoDrop(UnityEngine.GameObject go)
        {
            if (go == null)
            {
                return;
            }

            IDragable dragObj = go.GetComponent <DragItem>();

            if (dragObj == null)
            {
                return;
            }
            string type = dragObj.DragType;

            if (type.Equals(DRAG_TYPE))
            {
            }
            else if (type.Equals(BagItem.DRAG_TYPE))
            {
                if (DragItem.mDraggedItem != null)
                {
                    EquipInfo equipVo = DragItem.mDraggedItem as EquipInfo;
                    if (equipVo.PutWhere == PutWhere)
                    {
                        BagLogic.GetInstance().LoadEquip(equipVo.Position, equipVo.PutWhere);
                    }
                }
            }
            else
            {
                return;
            }
        }
コード例 #4
0
        private object OnUpdateEquipHandler(params object[] objs)
        {
            int      putWhere = Convert.ToInt32(objs[0]);
            ItemInfo itemVO   = BagLogic.GetInstance().GetEquipByPos(putWhere);

            equipItems[putWhere].UpdateContent(itemVO);
            return(null);
        }
コード例 #5
0
        private void ChangeEquip()
        {
            //先检测背包位置是不是原来的道具...
            ItemInfo itemInfo = BagLogic.GetInstance().GetItemByPos(equipBagPos);

            if (itemInfo != null && itemInfo.typeId == equipIndex)
            {
                BagLogic.GetInstance().LoadEquip(equipBagPos, equipLoadPos);
            }
        }
コード例 #6
0
    private void InitCoreManager()
    {
        RegisterLog();
        DontDestroyOnLoad(this.gameObject);
        log.Debug("Start game application...");
        GameWorld.GetInstance();
        LoggerView.GetInstance();
        CameraLayerManager.GetInstance();
        AssetLoader.GetInstance();
        ViewCameraManager.GetInstance().Init();
        LayerManager.GetInstance().Init();
        RemoteCallLogic.GetInstance();
        NGUIManager.GetInstance();

        LoginController.GetInstance();
        SceneLogic.GetInstance();
        PlayerController.GetInstance();
        BagLogic.GetInstance();
        NpcLogic.GetInstance();
        TimeManager.GetInstance();
        ViewManager.GetInstance();
        gameObject.AddComponent("CronJob");
        LoadResource();

        //ActiveRush.InitFx();



        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_skill_badao03_xuanfengzhan_g2"));
        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_skill_badao01_lipihuashantexiao"));
        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_skill_badao03_xuanfengzhan"));
        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_skill_badao03_xuanfengzhan_mingzhong2"));

        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_skill_badao04_yuanyuewandao_mingzhong"));
        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_skill_badao04_yuanyuewandao_mingzhong_g"));
        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_skill_badao04_yuanyuewandao_wuqifeixing"));
        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_skill_badao04_yuanyuewandao"));

        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_skill_badao02_nuzhanbahuang_gongji"));
        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_skill_daobin_06_nuhou_shifa"));

        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_skill_daobin_05_zhenfei"));
        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_skill_daobin_04_chongfeng"));
        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_skill_daobin_04_chongfeng_mingzhong"));

        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_guaiwusiwang2"));

        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_levelup"));

        AssetLoader.GetInstance().Load(URLUtil.GetEffectPath("effect_guangquan_yellow"), PLAYER_SEL_LoadComplete, AssetType.BUNDLER);
        AssetLoader.GetInstance().Load(URLUtil.GetEffectPath("effect_guangquan2_red"), NPC_SEL_LoadComplete, AssetType.BUNDLER);

        PreLoad.GetInstance().OnEnterScene();
        SelecterManager.GetInstance();
    }
コード例 #7
0
        //使用按钮
        private void OnAddCount(GameObject go)
        {
            ItemInfo itemInfo = BagLogic.GetInstance().bagItems[pos];
            int      inputNum = Int32.Parse(Input.label.text);

            if (inputNum >= itemInfo.CurNum)
            {
                return;
            }
            Input.label.text = (inputNum + 1).ToString();
        }
コード例 #8
0
        private void CreateBagStorage()
        {
            allStorage = NGUITools.AddChild <BagStorage>(Panel.gameObject);
            allStorage.gameObject.transform.localPosition = new Vector3(-176, 220, -2);
            allStorage.CreateItems();
            ObjectUtil.SetLayerWithAllChildren(allStorage.gameObject, "2D");

            allStorage.SetGoods(BagLogic.GetInstance().bagItems);

            ReplacementLayer();
        }
コード例 #9
0
        public void GetEquipFromRole()
        {
            blogic = BagLogic.GetInstance();
            EquipInfo info;

            for (int i = 0; i < EQUIPCOUNT; i++)
            {
                if (blogic.GetEquipByPos(i) != null)
                {
                    info = blogic.GetEquipByPos(i) as EquipInfo;
                    roleEquip.Add(info);
                }
            }
        }
コード例 #10
0
        //使用按钮
        private void OnUseItem(GameObject go)
        {
            ItemInfo itemInfo = BagLogic.GetInstance().bagItems[itemPos];

            if (itemInfo.Genre == (int)KItemGenre.igEquip)
            {
                EquipInfo equipInfo = itemInfo as EquipInfo;
                BagLogic.GetInstance().LoadEquip(itemPos, equipInfo.PutWhere);
            }
            else
            {
                BagLogic.GetInstance().SendUseItem(KPackageType.ePlayerPackage, KPlayerPackageIndex.eppiPlayerItemBox, itemPos);
            }
            Hide();
        }
コード例 #11
0
        protected override void PreInit()
        {
            base.PreInit();

            pointBtn1 = FindGameObject("pointBtn1").AddComponent <PointBtn>();
            pointBtn2 = FindGameObject("pointBtn2").AddComponent <PointBtn>();
            pointBtn3 = FindGameObject("pointBtn3").AddComponent <PointBtn>();
            pointBtn4 = FindGameObject("pointBtn4").AddComponent <PointBtn>();

            UpdateAvatar(null);
            UpdateAttribute(null);

            CreateEquipItems();
            SetAllEquips(BagLogic.GetInstance().equipItems);
        }
コード例 #12
0
        public ItemInfo GetGoodFormBag(string name)
        {
            blogic = BagLogic.GetInstance();
            ItemInfo info;

            for (i = 0; i < blogic.bagItems.Length; i++)
            {
                info = blogic.GetItemByPos(i);
                if (info != null && info.Name == name)
                {
                    return(info);
                }
            }
            return(null);
        }
コード例 #13
0
        //装备强化
        private void EquipStrengResult(bool isSuccess, int itemPos, int newLevel)
        {
            log.Debug("!!!!!!!!!!!!EquipStrengResult," + isSuccess + ",pos:" + itemPos + ",lev:" + newLevel);
            ItemInfo info;

            if (isSuccess)
            {
                info = BagLogic.GetInstance().GetEquipByPos(itemPos);
                (info as EquipInfo).CurStrengthenLv = newLevel;
                if (IntensifyLogic.GetInstance().GetIntensifyUI() != null && IntensifyLogic.GetInstance().GetIntensifyUI().isOpen())
                {
                    IntensifyLogic.GetInstance().UpdataIntensify(itemPos, true);
                }
            }
        }
コード例 #14
0
        private void OnDoubleClickItem(GameObject go)
        {
            DragItem  item    = go.GetComponent <DragItem>();
            EquipInfo equipVO = item.DragItemVO as EquipInfo;

            if (equipVO != null)
            {
                int target = BagLogic.GetInstance().GetNullPosition();
                if (target == -1)
                {
                    Debug.Log("背包已满");
                }
                else
                {
                    BagLogic.GetInstance().UnLoadEquip(equipVO.Position, target);
                }
            }
        }
コード例 #15
0
 private void ShowView()
 {
     if (loadSign)
     {
         ItemInfo itemInfo = BagLogic.GetInstance().bagItems[pos];
         if (saleType == (int)ItemSaleType.eSaleToSys)
         {
             showLabel.text  = "您确定要将该物品<e642f9>[" + itemInfo.Name + "]<->出售给商店?";
             titleLabel.text = "出售物品";
         }
         else
         {
             showLabel.text  = "您确定要将该物品<e642f9>[" + itemInfo.Name + "]<->丢弃给商店?";
             titleLabel.text = "丢弃物品";
         }
         Show();
     }
 }
コード例 #16
0
ファイル: BagStorage.cs プロジェクト: moto2002/DinaGameClient
        private void OnDoubleClickItem(GameObject go)
        {
            IDragable item   = go.GetComponent <DragItem>();
            ItemInfo  itemVO = item.DragItemVO as ItemInfo;

            if (itemVO != null)
            {
                if (itemVO.Genre == (int)KItemGenre.igEquip)
                {
                    EquipInfo equipVo = itemVO as EquipInfo;
                    BagLogic.GetInstance().LoadEquip(equipVo.Position, equipVo.PutWhere);
                }
                else if (itemVO.Genre == (int)KItemGenre.igCommon)
                {
                    //BagLogic.GetInstance().SendUseItem(KPackageType.ePlayerPackage, KPlayerPackageIndex.eppiPlayerItemBox, itemVO.Position);
                }
                item.DragIcon.enabled = false;
            }
        }
コード例 #17
0
 private void OnSure(GameObject go)
 {
     BagLogic.GetInstance().SendSaleItem(KPackageType.ePlayerPackage, KPlayerPackageIndex.eppiPlayerItemBox, pos);
     Hide();
 }
コード例 #18
0
 private void OnSortBagItemBox(GameObject go)
 {
     BagLogic.GetInstance().BagItemSort();
 }
コード例 #19
0
        private void UpdateGoods(int pos)
        {
            ItemInfo item = BagLogic.GetInstance().GetItemByPos(pos);

            allStorage.UpdateGoods(pos, item);
        }
コード例 #20
0
        private void ShowLableView()
        {
            if (!loadSign)
            {
                return;
            }
            int      showClickCount = 0;
            ItemInfo itemInfo       = BagLogic.GetInstance().bagItems[itemPos];

            ////判断是否可以显示
            if (itemInfo.CanUse != 0)
            {
                ++showClickCount;
                useLabel.gameObject.SetActive(true);
            }
            else
            {
                useLabel.gameObject.SetActive(false);
            }

            //判断拆分是否显示
            if (itemInfo.CurNum > 1)
            {
                ++showClickCount;
                useallLabel.transform.localPosition
                    = new Vector3(useLabel.transform.localPosition.x,
                                  useLabel.transform.localPosition.y - (showClickCount - 1) * space,
                                  useallLabel.transform.localPosition.z);
                useallLabel.gameObject.SetActive(true);

                ++showClickCount;
                partLabel.transform.localPosition
                    = new Vector3(partLabel.transform.localPosition.x,
                                  useLabel.transform.localPosition.y - (showClickCount - 1) * (space),
                                  partLabel.transform.localPosition.z);
                partLabel.gameObject.SetActive(true);
            }
            else
            {
                useallLabel.gameObject.SetActive(false);
                partLabel.gameObject.SetActive(false);
            }


            //判断是否可以出售,丢弃
            //if (itemInfo.CanDrop != 0)
            //{
            ++showClickCount;
            saleLabel.transform.localPosition
                = new Vector3(saleLabel.transform.localPosition.x,
                              useLabel.transform.localPosition.y - (showClickCount - 1) * (space),
                              saleLabel.transform.localPosition.z);
            //}
            //else
            //{
            //    saleLabel.gameObject.SetActive(false);
            //}

            //展示
            ++showClickCount;
            showLabel.transform.localPosition = new Vector3(saleLabel.transform.localPosition.x,
                                                            useLabel.transform.localPosition.y - (showClickCount - 1) * (space),
                                                            saleLabel.transform.localPosition.z);

            //if (itemInfo.CanDrop != 0)
            //{
            ++showClickCount;
            dropLabel.transform.localPosition
                = new Vector3(dropLabel.transform.localPosition.x,
                              useLabel.transform.localPosition.y - (showClickCount - 1) * (space),
                              dropLabel.transform.localPosition.z);
            //}
            //else
            //{
            //    dropLabel.gameObject.SetActive(false);
            //}

            //设置背景大小
            background.width  = useLabel.width;
            background.height = (showClickCount - 1) * useLabel.height + 5;
            background.transform.localPosition = new Vector3(useLabel.transform.localPosition.x
                                                             , useLabel.transform.localPosition.y + space, 0);

            uiPanel.transform.position      = transform.position;
            uiPanel.transform.localPosition = new Vector3(uiPanel.transform.localPosition.x, uiPanel.transform.localPosition.y - 45, transform.transform.localPosition.z);

            Show();
        }
コード例 #21
0
    void Activate()
    {
        _moduleId     = _moduleIdCounter++;
        this.bagLogic = new BagLogic();
        this.bagLogic.Reinitialize();
        this.bagLogic.GenerateSolutions();

        this.bags = this.bagLogic.GetBags();
        var solutions = this.bagLogic.GetSolutions();

        for (var x = 0; x < bags.Count; x++)
        {
            var index = x;
            BagTxts[index].text          = bags[index].Label;
            BagRenderers[index].material = ColorToMaterial(bags[index].Color);
            BagRenderers[index].sprite   = ColorToSprite(bags[index].Color);
            Bags[index].OnInteract      += delegate
            {
                Bags[index].AddInteractionPunch();
                Audio.PlaySoundAtTransform(bags[index].Type == BagType.Diamond ? "DiamondSound" : "MoneySound",
                                           Bags[index].transform);

                if (this.isSolved)
                {
                    return(false);
                }

                if (!bags[index].IsReadOnly)
                {
                    bags[index].Color            = TransitionColor(bags[index].Color);
                    BagRenderers[index].material = ColorToMaterial(bags[index].Color);
                    BagRenderers[index].sprite   = ColorToSprite(bags[index].Color);
                }

                return(false);
            };
        }

        SubmitBtn.OnInteract += delegate
        {
            SubmitBtn.AddInteractionPunch();
            Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, SubmitBtn.transform);
            if (this.isSolved)
            {
                return(false);
            }
            var foundSolution = false;
            var redBags       = this.bags.Where(x => x.Color == BagColor.Red).OrderBy(x => x.Index).ToList();
            var blueBags      = this.bags.Where(x => x.Color == BagColor.Blue).OrderBy(x => x.Index).ToList();

            foreach (var solution in solutions)
            {
                var redBagsSolution  = solution.Where(x => x.Color == BagColor.Red).OrderBy(x => x.Index).ToList();
                var blueBagsSolution = solution.Where(x => x.Color == BagColor.Blue).OrderBy(x => x.Index).ToList();

                if (redBags.Count == redBagsSolution.Count && blueBags.Count == blueBagsSolution.Count)
                {
                    if (ValidateAnswer(redBags, redBagsSolution) && ValidateAnswer(blueBags, blueBagsSolution))
                    {
                        foundSolution = true;
                        break;
                    }
                }
            }
            Debug.LogFormat("[Splitting The Loot #{0}] Submitted:", this._moduleId);
            Debug.LogFormat("[Splitting The Loot #{0}] -------------------------------------------", _moduleId);
            DebugLog(this.bags, _moduleId);
            Debug.LogFormat("[Splitting The Loot #{0}] -------------------------------------------", _moduleId);

            if (!foundSolution)
            {
                Debug.LogFormat("[Splitting The Loot #{0}] That is incorrect. Strike!", this._moduleId);
                Debug.LogFormat("[Splitting The Loot #{0}] -------------------------------------------", _moduleId);
                Module.HandleStrike();
            }
            else
            {
                this.isSolved = true;
                Debug.LogFormat("[Splitting The Loot #{0}] That is correct. Module solved!", this._moduleId);
                Debug.LogFormat("[Splitting The Loot #{0}] -------------------------------------------", _moduleId);
                Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, SubmitBtn.transform);
                Module.HandlePass();
            }

            return(false);
        };

        Debug.LogFormat("[Splitting The Loot #{0}] Found solutions to:\n", _moduleId);
        Debug.LogFormat("[Splitting The Loot #{0}] -------------------------------------------", _moduleId);
        DebugLog(bags, _moduleId);
        Debug.LogFormat("[Splitting The Loot #{0}] -------------------------------------------", _moduleId);
        Debug.LogFormat("[Splitting The Loot #{0}] Solutions:\n", _moduleId);
        Debug.LogFormat("[Splitting The Loot #{0}] -------------------------------------------", _moduleId);
        foreach (var solution in solutions)
        {
            DebugLog(solution, _moduleId);
            Debug.LogFormat("[Splitting The Loot #{0}] -------------------------------------------", _moduleId);
        }
    }