示例#1
0
        private void MoveModuleDown(ItemModule module)
        {
            int index = -1, count = 0;
            SerializedObject serializedObject = null;

            switch (funcTab.SelectedIndex)
            {
            case 1:
                index            = selectedItem.Modules.IndexOf(module);
                serializedObject = serializedItem;
                count            = selectedItem.Modules.Count;
                break;

            case 2:
                index            = selectedTemplate.Modules.IndexOf(module);
                serializedObject = serializedTemplate;
                count            = selectedTemplate.Modules.Count;
                break;
            }
            if (serializedObject != null && index >= 0 && index < count - 1)
            {
                SerializedProperty modulesProp = serializedObject.FindProperty("modules");
                modulesProp.MoveArrayElement(index, index + 1);
                serializedObject.ApplyModifiedProperties();
                RefreshModules();
            }
        }
示例#2
0
    //private void ItemMessage(Message message)
    //{
    //    SetItemData((ItemModule.ItemData)message["Item"]);
    //}

    protected override void OnLoadData()
    {
        base.OnLoadData();
        _itemModule = ModuleManager.Instance.Get <ItemModule>();
        //SetItemData();
        Debug.Log("OnLoadData");
    }
示例#3
0
        public Config()
        {
            accessToken = GiteeDrive.AccessToken.NewAccessToken(SleepBetter.Personal.GiteeRepo.GiteeAccessToken);
            repo        = new Repo(SleepBetter.Personal.GiteeRepo.GiteeRepoOwner, SleepBetter.Personal.GiteeRepo.GiteeRepoName, "master");
            var root =
                from i in GiteeDrive.RepoModule.getRoot(accessToken, false, repo)
                where i.IsFile
                where (i as Item.File).Item1.path == path
                select i;

            item = root.First();


            var text        = ItemModule.downloadString(accessToken, item);
            var configsText = text.Split('\n');
            var config      = new Dictionary <string, string>();

            foreach (var i in configsText)
            {
                if (String.IsNullOrWhiteSpace(i))
                {
                    continue;
                }
                var kv = i.Split('=');
                config.Add(kv[0].Trim().Trim('\r').Trim(), kv[1].Trim().Trim('\r').Trim());
            }
            Days = uint.Parse(config["Days"]);
        }
示例#4
0
    public ServerGameWorld(GameWorld world, NetworkServer networkServer, Dictionary <int, ServerGameLoop.ClientInfo> clients, ChatSystemServer m_ChatSystem, BundledResourceManager resourceSystem)
    {
        m_NetworkServer   = networkServer;
        m_Clients         = clients;
        this.m_ChatSystem = m_ChatSystem;

        m_GameWorld = world;

        m_CharacterModule        = new CharacterModuleServer(m_GameWorld, resourceSystem);
        m_ProjectileModule       = new ProjectileModuleServer(m_GameWorld, resourceSystem);
        m_HitCollisionModule     = new HitCollisionModule(m_GameWorld, 128, 1);
        m_PlayerModule           = new PlayerModuleServer(m_GameWorld, resourceSystem);
        m_SpectatorCamModule     = new SpectatorCamModuleServer(m_GameWorld, resourceSystem);
        m_ReplicatedEntityModule = new ReplicatedEntityModuleServer(m_GameWorld, resourceSystem, m_NetworkServer);
        m_ReplicatedEntityModule.ReserveSceneEntities(networkServer);
        m_ItemModule = new ItemModule(m_GameWorld);

        m_GameModeSystem = m_GameWorld.GetECSWorld().CreateManager <GameModeSystemServer>(m_GameWorld, m_ChatSystem, resourceSystem);

        m_DestructablePropSystem = m_GameWorld.GetECSWorld().CreateManager <UpdateDestructableProps>(m_GameWorld);

        m_DamageAreaSystem = m_GameWorld.GetECSWorld().CreateManager <DamageAreaSystemServer>(m_GameWorld);

        m_TeleporterSystem = m_GameWorld.GetECSWorld().CreateManager <TeleporterSystemServer>(m_GameWorld);

        m_HandleGrenadeRequests   = m_GameWorld.GetECSWorld().CreateManager <HandleGrenadeRequest>(m_GameWorld, resourceSystem);
        m_StartGrenadeMovement    = m_GameWorld.GetECSWorld().CreateManager <StartGrenadeMovement>(m_GameWorld);
        m_FinalizeGrenadeMovement = m_GameWorld.GetECSWorld().CreateManager <FinalizeGrenadeMovement>(m_GameWorld);

        m_platformSystem = m_GameWorld.GetECSWorld().CreateManager <MoverUpdate>(m_GameWorld);

        m_MoveableSystem = new MovableSystemServer(m_GameWorld, resourceSystem);
        m_CameraSystem   = new ServerCameraSystem(m_GameWorld);
    }
示例#5
0
    public void SetItemData(ItemModule item, uint setNum = 1)
    {
        //Debug.Log("SetItemData");
        _itemModule = item;

        if (_itemModule == null || _itemModule._ItemData.Num == 0)
        {
            if (!_image.enabled && TextItemNum.enabled)
            {
                return;
            }
            else
            {
                _itemModule         = null;
                _image.enabled      = false;
                TextItemNum.enabled = false;
                EventTriggerListener.Get(ImgItem.gameObject).RemoveAllHandle();
            }
            //EventTriggerListener.Get(_imgItem.gameObject).RemoveAllHandle();
        }
        else
        {
            _image.overrideSprite = Resources.Load("Sprite/" + _itemModule._ItemData.Icon, typeof(Sprite)) as Sprite;
            _image.enabled        = true;
            TextItemNum.text      = _itemModule._ItemData.Num.ToString();
            TextItemNum.enabled   = true;
            EventTriggerListener.Get(_imgItem.gameObject).SetEventHandle(EnumTouchEventType.OnClick, UseItem);
            EventTriggerListener.Get(_imgItem.gameObject).SetEventHandle(EnumTouchEventType.OnDrag, DragItem);
        }
    }
示例#6
0
 public ModuleBlock(SerializedProperty property, ItemModule module)
 {
     serializedObject = property.serializedObject;
     shouldCheckError = property.serializedObject.targetObject is ItemNew;
     this.property    = property;
     userData         = module;
     value            = property.isExpanded;
     this.Q <Toggle>().RegisterValueChangedCallback(new EventCallback <ChangeEvent <bool> >(evt => property.isExpanded = evt.newValue));
     if (property.hasVisibleChildren)
     {
         IMGUIContainer inspector = new IMGUIContainer(() =>
         {
             if (serializedObject.targetObject)
             {
                 EditorGUI.BeginChangeCheck();
                 serializedObject.UpdateIfRequiredOrScript();
                 OnInspectorGUI();
                 if (EditorGUI.EndChangeCheck())
                 {
                     serializedObject.ApplyModifiedProperties();
                     CheckError();
                 }
             }
         });
         inspector.style.flexGrow = 1;
         Add(inspector);
     }
     else
     {
         Add(new Label("(无可用参数)"));
     }
     CheckError();
 }
示例#7
0
            public static ItemModule AddModule(ItemTemplate template, Type type, KeyedByTypeCollection <ItemModule> keyedModules = null)
            {
                if (template == null || type == null)
                {
                    return(null);
                }
                if (keyedModules == null)
                {
                    keyedModules = new KeyedByTypeCollection <ItemModule>(template.modules.Where(x => x is not CommonModule));
                }
                if (!CommonModule.IsCommon(type) && keyedModules.Contains(type))
                {
                    return(null);
                }
                var attr = type.GetCustomAttribute <ItemModule.RequireAttribute>();

                if (attr != null)
                {
                    foreach (var m in attr.modules)
                    {
                        if (m != type)
                        {
                            AddModule(template, m, keyedModules);
                        }
                    }
                }
                ItemModule module = Activator.CreateInstance(type) as ItemModule;

                template.modules.Add(module);
                if (!CommonModule.IsCommon(type))
                {
                    keyedModules.Add(module);
                }
                return(module);
            }
示例#8
0
        private void MakeItem <T>(ItemModule module)
            where T : ItemModule
        {
            var controller = MakeController <ItemController, ItemModule>(module);

            CampaignController.GetItem <T>().Returns(controller);
        }
示例#9
0
 public MakableBlock(SerializedProperty property, ItemModule module) : base(property, module)
 {
     makingMethod = property.FindPropertyRelative("makingMethod");
     canMakeByTry = property.FindPropertyRelative("canMakeByTry");
     formulation  = property.FindAutoPropertyRelative("Formulation");
     yields       = property.FindAutoPropertyRelative("Yields");
     list         = new ReorderableList(property.serializedObject, yields)
     {
         drawElementCallback = (rect, index, isActive, isFocused) =>
         {
             SerializedProperty element = yields.GetArrayElementAtIndex(index);
             SerializedProperty yield   = element.FindAutoPropertyRelative("Yield");
             SerializedProperty rate    = element.FindAutoPropertyRelative("Rate");
             EditorGUI.LabelField(new Rect(rect.x, rect.y, 50, EditorGUIUtility.singleLineHeight), "产量");
             yield.intValue = EditorGUI.IntField(new Rect(rect.x + 52, rect.y, 100, EditorGUIUtility.singleLineHeight), yield.intValue);
             if (yield.intValue < 1)
             {
                 yield.intValue = 1;
             }
             EditorGUI.LabelField(new Rect(rect.x + 154, rect.y, 50, EditorGUIUtility.singleLineHeight), "概率");
             rate.floatValue = EditorGUI.Slider(new Rect(rect.x + 206, rect.y, rect.width - 206, EditorGUIUtility.singleLineHeight), rate.floatValue, 0, 1);
         },
         elementHeightCallback = (index) =>
         {
             return(EditorGUIUtility.singleLineHeight);
         },
         onCanRemoveCallback = (list) =>
         {
             return(yields.arraySize > 1 && list.IsSelected(list.index));
         },
         headerHeight = 0,
     };
 }
示例#10
0
 public static bool RemoveModule(ItemTemplate template, ItemModule module)
 {
     if (!template || module == null)
     {
         return(false);
     }
     template.modules.Remove(module);
     return(true);
 }
示例#11
0
        public ProductBlock(SerializedProperty property, ItemModule module) : base(property, module)
        {
            productInfo = property.FindAutoPropertyRelative("ProductInfo");
            product     = property.FindPropertyRelative("product");
            float lineHeight      = EditorGUIUtility.singleLineHeight;
            float lineHeightSpace = lineHeight + EditorGUIUtility.standardVerticalSpacing;

            list = new DropItemListDrawer(serializedObject, product, lineHeight, lineHeightSpace);
        }
示例#12
0
 public CommonBlock(SerializedProperty property, ItemModule module) : base(property, module)
 {
     text      = module.GetName();
     Name      = property.FindAutoPropertyRelative("Name");
     Parameter = property.FindAutoPropertyRelative("Parameter");
     item      = property.serializedObject.targetObject as ItemNew;
     template  = property.serializedObject.targetObject as ItemTemplate;
     errorBef  = !(!module.IsValid || Duplicate());
 }
示例#13
0
 private void EditScript(ItemModule module)
 {
     if (module != null)
     {
         var script = ZetanUtility.Editor.LoadAssets <MonoScript>().Find(x => x.GetClass() == module.GetType());
         if (script)
         {
             AssetDatabase.OpenAsset(script);
         }
     }
 }
示例#14
0
        private void OnSelectType(Type type)
        {
            if (!typeof(ItemModule).IsAssignableFrom(type) || !selectedItem && !selectedTemplate)
            {
                return;
            }
            SerializedObject   serializedObject = null;
            IList <ItemModule> modules          = null;
            string             undoName         = null;
            Func <ItemModule>  addModule        = null;
            ScriptableObject   scriptableObject = null;

            switch (funcTab.SelectedIndex)
            {
            case 1:
                serializedObject = serializedItem;
                modules          = selectedItem.Modules;
                undoName         = $"添加模块至道具{selectedItem.Name}";
                addModule        = () => ItemNew.Editor.AddModule(selectedItem, type);
                scriptableObject = selectedItem;
                break;

            case 2:
                serializedObject = serializedTemplate;
                modules          = selectedTemplate.Modules;
                undoName         = $"添加模块至模板{selectedTemplate.Name}";
                addModule        = () => ItemTemplate.Editor.AddModule(selectedTemplate, type);
                scriptableObject = selectedTemplate;
                break;
            }
            if (!CommonModule.IsCommon(type) && modules.Any(x => ItemModule.Duplicate(x, type)))
            {
                EditorUtility.DisplayDialog("无法添加", $"已经存在 [{ItemModule.GetName(type)}] 模块,每种模块只能添加一个。", "确定");
            }
            else if (serializedObject != null)
            {
                Undo.RegisterCompleteObjectUndo(scriptableObject, undoName);
                if (addModule() != null)
                {
                    RefreshModules();
                    this.StartCoroutine(scollToEnd());

                    IEnumerator scollToEnd()
                    {
                        yield return(new WaitForEndOfFrame());

                        rightPanel.verticalScroller.value = rightPanel.verticalScroller.highValue;
                    }
                }
            }
        }
示例#15
0
        public void Upload()
        {
            var cfg = new StringBuilder();

            cfg
            .Append("Days = ")
            .Append(Days);

            var blob =
                Encoding.UTF8.GetBytes(cfg.ToString());

            ItemModule.updateString(
                accessToken, "更新了睡眠记录", cfg.ToString(), item);
        }
示例#16
0
 public void DecreaseImageNum(ItemModule itemModule, ItemModule.EnumMainType mainType, uint count = 1)
 {
     if (itemModule._ItemData.Num > 0)
     {
         if (itemModule._ItemData.Num >= count)
         {
             itemModule._ItemData.Num -= count;
         }
         else if (itemModule._ItemData.Num - count == 0)
         {
             itemModule._ItemData.Num = 0;
             itemModule = null;
         }
     }
 }
示例#17
0
 public static ModuleBlock Create(SerializedProperty property, ItemModule module)
 {
     foreach (var type in TypeCache.GetTypesWithAttribute <CustomMuduleDrawerAttribute>())
     {
         if (typeof(ModuleBlock).IsAssignableFrom(type))
         {
             var attr = type.GetCustomAttribute <CustomMuduleDrawerAttribute>();
             if (attr.useForChildren ? attr.type.IsAssignableFrom(module.GetType()) : (attr.type == module.GetType()))
             {
                 return(Activator.CreateInstance(type, property, module) as ModuleBlock);
             }
         }
     }
     return(new ModuleBlock(property, module));
 }
示例#18
0
 public void Destory()
 {
     this.m_BuilderModule             = null;
     this.m_BuildingModule            = null;
     this.m_PlayerModule              = null;
     this.m_ArmyModule                = null;
     this.m_ItemModule                = null;
     this.m_ShopModule                = null;
     this.m_RemovableModule           = null;
     this.m_TaskModule                = null;
     this.m_PropsModule               = null;
     this.m_DefenseModule             = null;
     this.m_AchievementBuildingModule = null;
     this.m_CurrentFriend             = null;
 }
示例#19
0
    private void RegisterAllModules()
    {
        BagUIModule bagUIModule = new BagUIModule();

        bagUIModule.Load();

        ItemModule itemModule = new ItemModule();

        itemModule.Load();

        CharacterModule charaModule = new CharacterModule();

        charaModule.Load();

        CharacterModule characterModule = new CharacterModule();
        //.....add
    }
示例#20
0
    public ClientGameWorld(GameWorld world, NetworkClient networkClient, NetworkStatisticsClient networkStatistics, BundledResourceManager resourceSystem)
    {
        m_NetworkClient     = networkClient;
        m_NetworkStatistics = networkStatistics;

        m_GameWorld = world;

        m_CharacterModule        = new CharacterModuleClient(m_GameWorld, resourceSystem);
        m_ProjectileModule       = new ProjectileModuleClient(m_GameWorld, resourceSystem);
        m_HitCollisionModule     = new HitCollisionModule(m_GameWorld, 1, 1);
        m_PlayerModule           = new PlayerModuleClient(m_GameWorld);
        m_SpectatorCamModule     = new SpectatorCamModuleClient(m_GameWorld);
        m_EffectModule           = new EffectModuleClient(m_GameWorld, resourceSystem);
        m_ReplicatedEntityModule = new ReplicatedEntityModuleClient(m_GameWorld, resourceSystem);
        m_ItemModule             = new ItemModule(m_GameWorld);
        m_ragdollSystem          = new RagdollModule(m_GameWorld);

        m_GameModeSystem = m_GameWorld.GetECSWorld().CreateManager <GameModeSystemClient>(m_GameWorld);

        m_ClientFrontendUpdate = m_GameWorld.GetECSWorld().CreateManager <ClientFrontendUpdate>(m_GameWorld);

        m_DestructiblePropSystemClient = m_GameWorld.GetECSWorld().CreateManager <DestructiblePropSystemClient>(m_GameWorld);

        m_ApplyGrenadePresentation = m_GameWorld.GetECSWorld().CreateManager <ApplyGrenadePresentation>(m_GameWorld);

        m_UpdatePresentationOwners = m_GameWorld.GetECSWorld().CreateManager <UpdatePresentationOwners>(
            m_GameWorld, resourceSystem);
        m_HandlePresentationOwnerDespawn = m_GameWorld.GetECSWorld().CreateManager <HandlePresentationOwnerDesawn>(m_GameWorld);

        m_moverUpdate = m_GameWorld.GetECSWorld().CreateManager <MoverUpdate>(m_GameWorld);

        m_TeleporterSystemClient = m_GameWorld.GetECSWorld().CreateManager <TeleporterSystemClient>(m_GameWorld);

        m_SpinSystem = m_GameWorld.GetECSWorld().CreateManager <SpinSystem>(m_GameWorld);

        m_HandleNamePlateOwnerSpawn   = m_GameWorld.GetECSWorld().CreateManager <HandleNamePlateSpawn>(m_GameWorld);
        m_HandleNamePlateOwnerDespawn = m_GameWorld.GetECSWorld().CreateManager <HandleNamePlateDespawn>(m_GameWorld);
        m_UpdateNamePlates            = m_GameWorld.GetECSWorld().CreateManager <UpdateNamePlates>(m_GameWorld);

        m_GameModeSystem.SetLocalPlayerId(m_NetworkClient.clientId);

        m_TwistSystem          = new TwistSystem(m_GameWorld);
        m_FanSystem            = new FanSystem(m_GameWorld);
        m_TranslateScaleSystem = new TranslateScaleSystem(m_GameWorld);
    }
示例#21
0
        private void DeleteModule(ItemModule module)
        {
            IList <ItemModule> modules = null;

            switch (funcTab.SelectedIndex)
            {
            case 1:
                modules = selectedItem.Modules;
                break;

            case 2:
                modules = selectedTemplate.Modules;
                break;
            }
            foreach (var exist in modules)
            {
                Type type = exist.GetType();
                var  attr = type.GetCustomAttribute <ItemModule.RequireAttribute>();
                if (attr != null && attr.modules.Contains(module.GetType()))
                {
                    EditorUtility.DisplayDialog("无法移除", $"因为 [{ItemModule.GetName(type)}] 模块依赖于此模块,暂时无法移除。", "确定");
                    return;
                }
            }
            switch (funcTab.SelectedIndex)
            {
            case 1:
                Undo.RegisterCompleteObjectUndo(selectedItem, $"从道具{selectedItem.Name}删除模块");
                if (ItemNew.Editor.RemoveModule(selectedItem, module))
                {
                    RefreshModules();
                }
                break;

            case 2:
                Undo.RegisterCompleteObjectUndo(selectedTemplate, $"从模板{selectedTemplate.Name}删除模块");
                if (ItemTemplate.Editor.RemoveModule(selectedTemplate, module))
                {
                    RefreshModules();
                }
                break;
            }
        }
示例#22
0
    public void Initialize(UserData userData, List <BuildingData> buildingData, List <ArmyData> armyData, List <ItemData> itemData,
                           List <ObjectUpgrade <ArmyType> > armyUpgrade, List <ObjectUpgrade <ItemType> > itemUpgrade, List <RemovableObjectData> removableObjects,
                           List <TaskInformation> tasks, Dictionary <MercenaryIdentity, MercenaryData> mercenaries, Dictionary <int, PropsData> props, List <DefenseObjectData> defenseObjects,
                           int removableObjectStartNo, int propsStartNo, List <AchievementBuildingData> achievementBuildings, int achievementBuildingStartNo)
    {
        this.m_BuilderModule = new BuilderManager();

        this.m_PlayerModule    = new PlayerLogicObject();
        this.m_BuildingModule  = new BuildingModule(this.m_BuilderModule);
        this.m_ArmyModule      = new ArmyModule();
        this.m_ItemModule      = new ItemModule();
        this.m_MercenaryModule = new MercenaryModule();
        this.m_ShopModule      = new ShopModule();
        this.m_RemovableModule = new RemovableObjectModule(this.m_BuilderModule);

        this.m_MercenaryModule.InitializeMercenaries(mercenaries);
        this.m_ItemModule.InitializeItem(itemData, itemUpgrade);
        this.m_ArmyModule.InitializeArmy(armyData, armyUpgrade);
        this.m_PlayerModule.IntializePlayer(userData);
        this.m_BuildingModule.IntializeBuilding(buildingData);
        this.m_RemovableModule.InitialWithData(removableObjects, removableObjectStartNo);

        this.m_BuildingModule.ItemUpgradeFinished += ItemUpgradeFinished;
        this.m_BuildingModule.ArmyUpgradeFinished += ArmyUpgradeFinished;

        this.m_IsNewPlayer = (removableObjects.Count == ClientSystemConstants.INITIAL_REMOVABLE_OBJECT_NUMBER) &&
                             (removableObjects[0].Position == null);


        this.m_TaskModule = new TaskManager();
        foreach (TaskInformation info in tasks)
        {
            TaskProgressFactory.PopulateTaskInformation(info);
        }
        this.m_TaskModule.InitialTask(tasks);

        this.m_PropsModule = new PropsModule();
        this.m_PropsModule.InitializeProps(props, propsStartNo);
        this.m_DefenseModule = new DefenseObjectModule();
        this.m_DefenseModule.InitialDefenseObject(defenseObjects);
        this.m_AchievementBuildingModule = new AchievementBuildingModule();
        this.m_AchievementBuildingModule.InitialAchievementBuilding(achievementBuildings, achievementBuildingStartNo);
    }
示例#23
0
        private ModuleBlock MakeModuleBlock(SerializedProperty property, ItemModule module)
        {
            ModuleBlock block = ModuleBlock.Create(property, module);

            block.AddManipulator(new ContextualMenuManipulator(evt =>
            {
                IList <ItemModule> Modules = null;
                switch (funcTab.SelectedIndex)
                {
                case 1: if (selectedItem)
                    {
                        Modules = selectedItem.Modules;
                    }
                    break;

                case 2: if (selectedTemplate)
                    {
                        Modules = selectedTemplate.Modules;
                    }
                    break;
                }
                if (Modules != null)
                {
                    int index = Modules.IndexOf(module);
                    evt.menu.AppendAction("移除", a => DeleteModule(module));
                    if (index > 0)
                    {
                        evt.menu.AppendAction("上移", a => MoveModuleUp(module));
                    }
                    if (index < Modules.Count - 1)
                    {
                        evt.menu.AppendAction("下移", a => MoveModuleDown(module));
                    }
                    evt.menu.AppendSeparator();
                    evt.menu.AppendAction("编辑脚本", a => EditScript(module));
                    evt.menu.AppendAction("编辑Editor脚本", a => EditScript(block));
                }
            }));
            return(block);
        }
示例#24
0
    protected override void OnLoad()
    {
        base.OnLoad();
        //load data from setting data
        BaseData_ItemTable.Instance.LoadDataFromSettingTable();

        //create some item data(from network server)
        CreateSomeItemData();


        foreach (int item in Enum.GetValues(typeof(ItemModule.EnumMainType)))
        {
            if (item == 0)
            {
                continue;
            }
            string typeName = Enum.GetName(typeof(ItemModule.EnumMainType), item);
            ItemModule.EnumMainType temp = (ItemModule.EnumMainType)Enum.Parse(typeof(ItemModule.EnumMainType), typeName);
            int num = UnityEngine.Random.Range(3, 5);
            //Debug.Log(num);
            for (int i = 0; i < num; i++)
            {
                ItemModule.ItemData itemModile = _itemData[UnityEngine.Random.Range(0, _itemData.Count)]._ItemData;
                //tableDic[temp][i] = itemModile;
                //tableDic[temp][i]._ItemData = MethodExtension.DeepClone(itemModile);
                tableDic[temp][i] = new ItemModule()
                {
                    _ItemData = MethodExtension.DeepClone(itemModile)
                };

                //Debug.Log(_listItem.Count);
            }
            //for (int i = num; i < tableDic[temp].Length - num; i++)
            //{
            //    tableDic[temp][i] = new ItemModule() { _ItemData = new ItemModule.ItemData() };
            //    Debug.Log(tableDic[temp][i]._ItemData == null);
            //}
        }
    }
示例#25
0
    public void AddImageNum(ItemModule.ItemData itemData, ItemModule.EnumMainType mainType, uint count = 1)
    {
        //Debug.Log(itemData);

        if (itemData.Num < 20)
        {
            itemData.Num += count;
        }
        else
        {
            for (int i = 0; i < tableDic[mainType].Length; i++)
            {
                //Debug.Log("==");
                if (tableDic[mainType][i] == null)
                {
                    continue;
                }
                else if (tableDic[mainType][i]._ItemData.Id == itemData.Id && tableDic[mainType][i]._ItemData.Num < 20)
                {
                    AddImageNum(tableDic[mainType][i]._ItemData, mainType);
                    return;
                }
            }
            for (int i = 0; i < tableDic[mainType].Length; i++)
            {
                //Debug.Log("addNull");
                if (tableDic[mainType][i] == null || tableDic[mainType][i]._ItemData.Num == 0)
                {
                    tableDic[mainType][i] = new ItemModule()
                    {
                        _ItemData = MethodExtension.DeepClone <ItemModule.ItemData>(itemData)
                    };
                    tableDic[mainType][i]._ItemData.Num = count;
                    return;
                }
            }
        }
    }
 public ItemInfoCommandHandler(ItemModule module)
 {
     this.module = module;
 }
示例#27
0
    void EnterActiveState()
    {
        m_GameWorld.RegisterSceneEntities();

        m_resourceSystem = new BundledResourceManager(m_GameWorld, "BundledResources/Client");

        // Create serializers so we get errors in preview build
        var dataComponentSerializers = new DataComponentSerializers();

        m_CharacterModule          = new CharacterModulePreview(m_GameWorld, m_resourceSystem);
        m_ProjectileModule         = new ProjectileModuleClient(m_GameWorld, m_resourceSystem);
        m_HitCollisionModule       = new HitCollisionModule(m_GameWorld, 1, 2);
        m_PlayerModuleClient       = new PlayerModuleClient(m_GameWorld);
        m_PlayerModuleServer       = new PlayerModuleServer(m_GameWorld, m_resourceSystem);
        m_SpectatorCamModuleServer = new SpectatorCamModuleServer(m_GameWorld, m_resourceSystem);
        m_SpectatorCamModuleClient = new SpectatorCamModuleClient(m_GameWorld);
        m_EffectModule             = new EffectModuleClient(m_GameWorld, m_resourceSystem);
        m_ItemModule = new ItemModule(m_GameWorld);

        m_ragdollModule = new RagdollModule(m_GameWorld);

        m_DespawnProjectiles     = m_GameWorld.GetECSWorld().CreateSystem <DespawnProjectiles>(m_GameWorld);
        m_DamageAreaSystemServer = m_GameWorld.GetECSWorld().CreateSystem <DamageAreaSystemServer>(m_GameWorld);

        m_TeleporterSystemServer = m_GameWorld.GetECSWorld().CreateSystem <TeleporterSystemServer>(m_GameWorld);
        m_TeleporterSystemClient = m_GameWorld.GetECSWorld().CreateSystem <TeleporterSystemClient>(m_GameWorld);

        m_UpdateDestructableProps      = m_GameWorld.GetECSWorld().CreateSystem <UpdateDestructableProps>(m_GameWorld);
        m_DestructiblePropSystemClient = m_GameWorld.GetECSWorld().CreateSystem <DestructiblePropSystemClient>(m_GameWorld);

        m_UpdatePresentationOwners = m_GameWorld.GetECSWorld().CreateSystem <UpdatePresentationOwners>(
            m_GameWorld, m_resourceSystem);
        m_HandlePresentationOwnerDespawn = m_GameWorld.GetECSWorld().CreateSystem <HandlePresentationOwnerDesawn>(m_GameWorld);

        m_HandleGrenadeRequests    = m_GameWorld.GetECSWorld().CreateSystem <HandleGrenadeRequest>(m_GameWorld, m_resourceSystem);
        m_StartGrenadeMovement     = m_GameWorld.GetECSWorld().CreateSystem <StartGrenadeMovement>(m_GameWorld);
        m_FinalizeGrenadeMovement  = m_GameWorld.GetECSWorld().CreateSystem <FinalizeGrenadeMovement>(m_GameWorld);
        m_ApplyGrenadePresentation = m_GameWorld.GetECSWorld().CreateSystem <ApplyGrenadePresentation>(m_GameWorld);

        m_moverUpdate = m_GameWorld.GetECSWorld().CreateSystem <MoverUpdate>(m_GameWorld);

        m_SpinSystem = m_GameWorld.GetECSWorld().CreateSystem <SpinSystem>(m_GameWorld);
        m_HandleNamePlateOwnerSpawn   = m_GameWorld.GetECSWorld().CreateSystem <HandleNamePlateSpawn>(m_GameWorld);
        m_HandleNamePlateOwnerDespawn = m_GameWorld.GetECSWorld().CreateSystem <HandleNamePlateDespawn>(m_GameWorld);
        m_UpdateNamePlates            = m_GameWorld.GetECSWorld().CreateSystem <UpdateNamePlates>(m_GameWorld);

        m_UpdateReplicatedOwnerFlag = m_GameWorld.GetECSWorld().CreateSystem <UpdateReplicatedOwnerFlag>(m_GameWorld);


        m_TwistSystem          = new TwistSystem(m_GameWorld);
        m_FanSystem            = new FanSystem(m_GameWorld);
        m_TranslateScaleSystem = new TranslateScaleSystem(m_GameWorld);

        m_PlayerModuleClient.RegisterLocalPlayer(0, null);


        // Spawn PlayerState, Character and link up LocalPlayer
        m_Player = m_PlayerModuleServer.CreatePlayer(m_GameWorld, 0, "LocalHero", true);

        var playerEntity = m_Player.gameObject.GetComponent <GameObjectEntity>().Entity;
        var charControl  = m_GameWorld.GetEntityManager().GetComponentObject <PlayerCharacterControl>(playerEntity);

        charControl.characterType = math.max(Game.characterType.IntValue, 0);
        m_Player.teamIndex        = 0;

        m_previewGameMode = m_GameWorld.GetECSWorld().CreateSystem <PreviewGameMode>(m_GameWorld, m_Player);

        Game.SetMousePointerLock(true);
    }
示例#28
0
    private void CreateSomeItemData()
    {
        //var item = new { id = 1, itemId = 10001, Num = (uint)Random.Range(300, 500), Lv = 0 };
        //1 HpBottle
        ItemModule item = new ItemModule()
        {
            _ItemData = new ItemModule.ItemData()
            {
                Id = 1, ItemId = 10001, Num = (uint)UnityEngine.Random.Range(3, 5), Lv = 0
            }
        };

        _itemData.Add(item);

        //2 MpBottle
        item = new ItemModule()
        {
            _ItemData = new ItemModule.ItemData()
            {
                Id = 2, ItemId = 10002, Num = (uint)UnityEngine.Random.Range(3, 5), Lv = 0
            }
        };
        _itemData.Add(item);

        //3 sword
        item = new ItemModule()
        {
            _ItemData = new ItemModule.ItemData()
            {
                Id = 3, ItemId = 10003, Num = (uint)UnityEngine.Random.Range(3, 5), Lv = 0
            }
        };
        _itemData.Add(item);

        //4 cloth
        item = new ItemModule()
        {
            _ItemData = new ItemModule.ItemData()
            {
                Id = 4, ItemId = 10004, Num = (uint)UnityEngine.Random.Range(1, 5), Lv = (uint)UnityEngine.Random.Range(1, 10)
            }
        };
        _itemData.Add(item);

        //5 gold
        item = new ItemModule()
        {
            _ItemData = new ItemModule.ItemData()
            {
                Id = 5, ItemId = 10005, Num = (uint)UnityEngine.Random.Range(1, 3), Lv = 0
            }
        };
        _itemData.Add(item);

        //5 book
        item = new ItemModule()
        {
            _ItemData = new ItemModule.ItemData()
            {
                Id = 6, ItemId = 10006, Num = (uint)UnityEngine.Random.Range(1, 5), Lv = 0
            }
        };
        _itemData.Add(item);
    }