private void buttonCreate_Click(object sender, EventArgs e) { var itemId = short.Parse(this.labelItemId.Text); if (this.dataHandler.MmoItems.ContainsKey(itemId)) { MessageBox.Show("Item id already exists in the database", "Item Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (int.Parse(textBoxMaxStack.Text) <= 0) { MessageBox.Show("Max Stack should be greater than 0", "Item Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } var item = new GameItemData { Id = GameItemData.GenerateId(itemId), ItemId = itemId }; if (this.StoreItem(item)) { var node = this.treeViewItems.Nodes[item.ItemType].Nodes.Add(item.ItemId.ToString(CultureInfo.InvariantCulture), item.Name); node.BackColor = this.GetItemColor((Rarity)item.Rarity); this.logger.LogFormat("New Item Created. Id = {0} Name = {1} ", item.ItemId, item.Name); this.ResetFields(); } }
void ShowFullViewItem(int catIndex) { GameItemData item = loadedData.allRoundData[catIndex]; // Set CatPanel parent Transform categoryPanelTrans = _fullViewCategoryPanels[0]; categoryPanelTrans.SetParent(_verticalScrollPanelContent); RectTransform scrollContent = categoryPanelTrans.gameObject.transform.Find("Content") as RectTransform; RectTransform headerTransform = categoryPanelTrans.Find("Header") as RectTransform; RectTransform textTransform = headerTransform.Find("CategoryLabel") as RectTransform; Text title = textTransform.GetComponent <Text>(); title.text = item.title.ToUpper(); Transform itemButtonTrans; Image itemImage; GameDataItems gameDataItem; for (int i = 0; i < item.items.Length; i++) { gameDataItem = item.items[i]; _itemPanels[gameDataItem.resource].SetParent(scrollContent); itemButtonTrans = _itemPanels[gameDataItem.resource]; itemImage = itemButtonTrans.GetComponent <Image> (); itemImage.preserveAspect = true; } StartCoroutine(ScrollToTop()); }
public static string GetTranslatedItemName(GameItemData item) { if (_itemNameTranslations.TryGetValue(item.Name, out var translation)) { return(translation); } return(item.Name); }
private void loadItemsToFields(GameItemData item) { this.lblName.Text = item.Name; this.lblId.Text = item.ItemId.ToString(); this.lblType.Text = item.ItemType.ToString(); this.lblRarity.Text = item.Rarity.ToString(); this.lblSell.Text = item.SellPrice.ToString(); this.lblBuy.Text = item.BuyoutPrice.ToString(); }
static void GameToolsDataLoadConfig() { GameItemData itemData = UnityEngine.Object.FindObjectOfType <GameItemData>(); itemData.load(Application.dataPath + "/Objects/DAT/Misc/Item_dat.dat"); GameSkillData skillData = UnityEngine.Object.FindObjectOfType <GameSkillData>(); skillData.load(Application.dataPath + "/Objects/DAT/Misc/Mag_dat.dat"); GameAttributeDefenceData attributeDefenceData = UnityEngine.Object.FindObjectOfType <GameAttributeDefenceData>(); attributeDefenceData.load(Application.dataPath + "/Objects/DAT/Misc/MAG_OPP.dat"); GameUnitData unitData = UnityEngine.Object.FindObjectOfType <GameUnitData>(); unitData.load(Application.dataPath + "/Objects/DAT/Misc/man_base.dat"); GameUnitLevelUpData unitLevelUpData = UnityEngine.Object.FindObjectOfType <GameUnitLevelUpData>(); unitLevelUpData.load(Application.dataPath + "/Objects/DAT/Misc/KMAN_LEV.dat"); GameUnitInitData unitInitData = UnityEngine.Object.FindObjectOfType <GameUnitInitData>(); unitInitData.load(Application.dataPath + "/Objects/DAT/Misc/KMAN_STA.dat"); GameMessageData messageData = UnityEngine.Object.FindObjectOfType <GameMessageData>(); messageData.clear(); messageData.load(Application.dataPath + "/Objects/DAT/Misc/CSSCON.MSG"); messageData.load(Application.dataPath + "/Objects/DAT/Misc/GITEPRO.MSG"); messageData.load(Application.dataPath + "/Objects/DAT/Misc/MLEVPRO.MSG"); messageData.load(Application.dataPath + "/Objects/DAT/Misc/Respro.MSG"); messageData.load(Application.dataPath + "/Objects/DAT/Misc/TREPRO.MSG"); GameBattleData battleData = UnityEngine.Object.FindObjectOfType <GameBattleData>(); battleData.loadStartData(Application.dataPath + "/Objects/DAT/Misc/STA_SCR.DAT"); GameStringData stringData = UnityEngine.Object.FindObjectOfType <GameStringData>(); stringData.load(); GameUnitMoveTypeData unitMoveTypeData = UnityEngine.Object.FindObjectOfType <GameUnitMoveTypeData>(); unitMoveTypeData.load(); GameCampData campData = UnityEngine.Object.FindObjectOfType <GameCampData>(); for (int i = 0; i < GameDefine.MAX_STAGE; i++) { campData.loadScript(i); } }
public void SetGameTex(GameItemData data, UnityEngine.Sprite sp = null) { this.data = data; gameText.text = data.name; if (sp != null) { gameImage.sprite = sp; } }
public static string GetTranslatedItemName(GameItemData item) { Logger.Log(LogLevel.Debug, $"Looking for translation for item: {item.Name}"); if (_itemNameTranslations.TryGetValue(item.Name, out var translation)) { Logger.Log(LogLevel.Debug, $"Found translation: {translation}"); return(translation); } return(item.Name); }
/// <summary> /// Loads item info for display /// </summary> private void LoadItem(GameItemData item) { this.labelItemId.Text = item.ItemId.ToString(CultureInfo.InvariantCulture); this.comboBoxItemType.SelectedIndex = item.ItemType; this.comboBoxItemType.Enabled = false; this.textBoxItemName.Text = item.Name; this.textBoxBuyout.Text = item.BuyoutPrice.ToString(CultureInfo.InvariantCulture); this.textBoxSell.Text = item.SellPrice.ToString(CultureInfo.InvariantCulture); this.comboBoxRarity.SelectedIndex = item.Rarity; this.textBoxMaxStack.Text = item.MaxStack.ToString(CultureInfo.InvariantCulture); this.checkBoxTradable.Checked = item.IsTradable; this.textBoxSpellId.Text = item.UseSpellId.ToString(CultureInfo.InvariantCulture); }
void ShowChallengeSubScreen() { GameItemData dataCategoryItems = loadedData.allRoundData[_selectedCatIndex]; GameDataItems gameDataItem = dataCategoryItems.items[_selectedItemIndex]; GameObject subScreen = (GameObject)Instantiate(Resources.Load("HomeScreen/screens/ChallengePlaySubScreen")); _challengeSubPanel = subScreen.GetComponent <ChallengePlaySubPanel> (); _challengeSubPanel.gameObject.transform.SetParent(_stage.transform, false); _challengeSubPanel.Show(gameDataItem, homeScreenIconPath + dataCategoryItems.imagePath); _challengeSubPanel.OnSelectedEvent += OnChallengeSelected; _challengeSubPanel.OnCloseEvent += OnChallengePanelClose; }
/// <summary> /// Saves info to the item /// </summary> private bool StoreItem(GameItemData item) { item.ItemType = (byte)this.comboBoxItemType.SelectedIndex; item.Name = this.textBoxItemName.Text; item.BuyoutPrice = int.Parse(this.textBoxBuyout.Text); item.SellPrice = int.Parse(this.textBoxSell.Text); item.Rarity = (byte)this.comboBoxRarity.SelectedIndex; item.MaxStack = int.Parse(this.textBoxMaxStack.Text); item.IsTradable = this.checkBoxTradable.Checked; item.UseSpellId = short.Parse(this.textBoxSpellId.Text); return(this.dataHandler.StoreMmoItem(item)); }
public bool StoreMmoItem(GameItemData mmoItem) { if (mmoItems.ContainsKey(mmoItem.ItemId)) { this.mmoItems[mmoItem.ItemId] = mmoItem; } else { this.mmoItems.Add(mmoItem.ItemId, mmoItem); } this.itemDb.Store(mmoItem); return(true); }
public void Initialize(InventoryDefinition lootInventory, UnitLogic[] startingUnits, GameItemData itemData) { LootInventory = lootInventory; CurrentUnits = startingUnits.ToList(); ItemData = itemData; CurrentUnitCount = 0; foreach (UnitLogic unit in CurrentUnits) { unit.OnPathFinished.AddListener(OnAdventureFinish); unit.SetDisable(); } AddNewUnit(); }
public void OnRandomPlaySelected() { GameItemData dataCategoryItems = loadedData.allRoundData[_selectedCatIndex]; GameDataItems gameDataItem = dataCategoryItems.items[_selectedItemIndex]; GameControl.instance.isChallengeMode = true; GameControl.instance.selectedResource = gameDataItem.resource; GameControl.instance.selectedResourceIconPath = dataCategoryItems.imagePath + gameDataItem.icons[0].normal; Transform subPanelContent = _challengeSubPanel.GetComponent <ScrollRect>().content.GetComponent <Transform>(); subPanelContent.GetComponent <FadeMe>().startFadeOut(0.5f); LeanTween.delayedCall(0.25f, ShowRandomChallengeSubScreen); }
public void OnSinglePlaySelected() { //print ("Home.OnSinglePlaySelected"); GameControl.instance.isChallengeMode = false; GameItemData dataCategoryItems = loadedData.allRoundData[_selectedCatIndex]; string resource = dataCategoryItems.items[_selectedItemIndex].resource; _challengeManager.LoadChallengeSelectByResource(resource); // _challengeManager.LoadChallengeSelectByResource("141_SB_C12_Potenza_RE97AS_FINAL.csv"); _loadScene.LoadQuiz(); DisposeCategoryPanels(); }
IEnumerator createHorizontalItem(GameItemData item, Transform scrollPanelTrans) { // Debug.Log("Canvas.createHorizontalItem()"); Transform copyItem = Instantiate(itemHorizPanel, itemHorizPanel.position, itemHorizPanel.transform.rotation) as Transform; copyItem.position = new Vector3(0, 0, 0); copyItem.transform.localPosition = new Vector3(0, 0, 0); copyItem.SetParent(scrollPanelTrans, false); print("copyItem: " + copyItem.position); //Wait for the download yield return(copyItem); Transform scrollPanelTr = copyItem.GetComponent <Transform>(); Transform scrollContent = scrollPanelTr.Find("ScrollPanel").GetComponent <ScrollerExtend>().content.GetComponent <Transform>(); // Transform scrollPanel = copyItem.GetComponent<ScrollRect>().content.GetComponent<Transform>(); //Transform scrollPanel = copyItem.GetComponent<ScrollRect>().content.GetComponent<Transform>(); print("scrollPanel: " + scrollContent.transform.position); RectTransform headerTransform = copyItem.gameObject.transform.Find("Header") as RectTransform; RectTransform textTransform = headerTransform.Find("CategoryLabel") as RectTransform; Text title = textTransform.GetComponent <Text>(); title.text = item.title; foreach (GameDataItems gameDataItem in item.items) { print("resource: " + gameDataItem.resource); Transform itemButtonTrans = Instantiate(itemButton, itemButton.position, itemButton.transform.rotation) as Transform; itemButtonTrans.position = new Vector3(0, 0, 0); itemButtonTrans.transform.localPosition = new Vector3(0, 0, 0); print("itemButton: " + itemButtonTrans.position); itemButtonTrans.SetParent(scrollContent, false); Button itemBtn = itemButtonTrans.GetComponent <Button> (); // Update Main Image StartCoroutine(setButtonImage(itemBtn, item.imagePath + gameDataItem.icons[0].normal)); // Update Button States StartCoroutine(setButtonStates(itemBtn, item.imagePath + gameDataItem.icons[0].over, item.imagePath + gameDataItem.icons[0].down)); } yield return(null); }
/// <summary> /// Creates a new instance of the <see cref="MmoItem"/> class from <see cref="GameItemData"/>. /// </summary> public MmoItem(GameItemData itemData) { this.id = itemData.ItemId; this.type = (MmoItemType)itemData.ItemType; this.level = itemData.Level; this.rareness = (Rarity)itemData.Rarity; this.sellPrice = itemData.SellPrice; this.buyoutPrice = itemData.BuyoutPrice; this.maxStack = itemData.MaxStack; this.useLimit = (UseLimit)itemData.UseLimit; this.spellId = itemData.UseSpellId; this.count = 1; }
public static List <GameItemData> DecodeItemData(string t) { List <GameItemData> l = new List <GameItemData>(); var args = t.Split('\n').Select(x => x.Split(':')); foreach (var arg in args) { GameItemData g = new GameItemData(); g.ID = int.Parse(arg[0]); g.name = arg[1].Trim(); l.Add(g); } return(l); }
void InitializeFullViewItem(int catIndex) { GameItemData item = loadedData.allRoundData [catIndex]; Transform copyItem = Instantiate(fullViewItemPanel, fullViewItemPanel.position, fullViewItemPanel.transform.rotation) as Transform; copyItem.position = new Vector3(0, 0, 0); copyItem.transform.localPosition = new Vector3(0, 0, 0); copyItem.SetParent(_verticalScrollPanelContent, false); RectTransform scrollContent = copyItem.gameObject.transform.Find("Content") as RectTransform; Transform scrollPanelTr = copyItem.GetComponent <Transform>(); _fullViewCategoryPanels.Add(scrollPanelTr); RectTransform headerTransform = copyItem.gameObject.transform.Find("Header") as RectTransform; RectTransform textTransform = headerTransform.Find("CategoryLabel") as RectTransform; Text title = textTransform.GetComponent <Text>(); title.text = item.title.ToUpper(); // Get Close Button Button closeBtn = headerTransform.Find("Button").GetComponent <Button>(); closeBtn.onClick.AddListener(() => OnCloseClick(catIndex)); Transform itemButtonTrans; Image itemImage; GameDataItems gameDataItem; for (int i = 0; i < item.items.Length; i++) { gameDataItem = item.items[i]; _itemPanels[gameDataItem.resource].SetParent(scrollContent); itemButtonTrans = _itemPanels[gameDataItem.resource]; itemImage = itemButtonTrans.GetComponent <Image> (); itemImage.preserveAspect = true; } StartCoroutine(FadeInCategoryContentPanel()); }
IEnumerator LoadSendingChallengeSubScreen() { GameItemData dataCategoryItems = loadedData.allRoundData[_selectedCatIndex]; GameDataItems gameDataItem = dataCategoryItems.items[_selectedItemIndex]; GameObject subScreen = (GameObject)Instantiate(Resources.Load("HomeScreen/screens/SendingChallengeSubScreen")); _sendingChallengeSubPanel = subScreen.GetComponent <SendingChallengeSubPanel> (); _sendingChallengeSubPanel.gameObject.transform.SetParent(_stage.transform, false); _sendingChallengeSubPanel.Show(gameDataItem, homeScreenIconPath + dataCategoryItems.imagePath); _sendingChallengeSubPanel.OnCloseEvent += OnSendingChallengePanelClose; yield return(subScreen); Transform sendingSubPanelContent = _sendingChallengeSubPanel.GetComponent <ScrollRect>().content.GetComponent <Transform>(); sendingSubPanelContent.GetComponent <FadeMe> ().startFadeIn(0.5f); yield return(_waitLoadAnimation); _stage.ShowLoader(); }
public virtual void load(string code) { // Load by character code //float speed = 1f; //float attack = 1f; //float scale = 1f; //speed = UnityEngine.Random.Range(.8f, 1.6f); //attack = UnityEngine.Random.Range(.3f, .4f); //scale = UnityEngine.Random.Range(.8f, 1.6f); GameItemData itemData = new GameItemData(); itemData.code = code; //itemData.type = GameActorType.enemy; //itemData.speed = speed; //itemData.attack = attack; //itemData.scale = scale; GameItemController.LoadItem(itemData); }
/// <summary> /// Tries to retrieve a <see cref="GameItemData"/>. /// </summary> public bool TryGetGameItemData(short gameItemId, out GameItemData mmoItem) { return(this.gameItemCache.TryGetValue(gameItemId, out mmoItem)); }
/// <summary> /// Adds a <see cref="GameItemData"/>. /// </summary> public void AddGameItemData(short gameItemId, GameItemData gameItemData) { this.gameItemCache.Add(gameItemId, gameItemData); }
public GameItemAsset() { _iteamData = null; _reactionList = new List <Reaction>(); }
void InitializeHorizontalItem(int catIndex) { GameItemData dataCategoryItems = loadedData.allRoundData [catIndex]; Transform copyItem = Instantiate(categoryItemPanel, categoryItemPanel.position, categoryItemPanel.transform.rotation) as Transform; copyItem.position = new Vector3(0, 0, 0); copyItem.transform.localPosition = new Vector3(0, 0, 0); copyItem.SetParent(_verticalScrollPanelContent, false); Transform scrollPanelTr = copyItem.GetComponent <Transform>(); Transform scrollContent = scrollPanelTr.Find("ScrollPanel").GetComponent <ScrollerExtend>().content.GetComponent <Transform>(); _categoryPanels.Add(scrollPanelTr); RectTransform headerTransform = copyItem.gameObject.transform.Find("Header") as RectTransform; RectTransform textTransform = headerTransform.Find("CategoryLabel") as RectTransform; Text title = textTransform.GetComponent <Text>(); title.text = dataCategoryItems.title.ToUpper(); // Get See All Button Button seeAllBtn = headerTransform.Find("Button").GetComponent <Button>(); seeAllBtn.onClick.AddListener(() => OnSeeAllClick(catIndex)); Transform itemButtonTrans; Button itemBtn; GameDataItems gameDataItem; ItemIcon itemIcon; int catItemLen = dataCategoryItems.items.Length; // if we have less than 4 items, disable see all if (catItemLen < 4) { seeAllBtn.gameObject.SetActive(false); } for (int i = 0; i < catItemLen; i++) { gameDataItem = dataCategoryItems.items[i]; itemButtonTrans = Instantiate(itemPanel, itemPanel.position, itemPanel.transform.rotation) as Transform; itemButtonTrans.position = new Vector3(0, 0, 0); itemButtonTrans.transform.localPosition = new Vector3(0, 0, 0); itemButtonTrans.SetParent(scrollContent, false); itemIcon = itemButtonTrans.GetComponent <ItemIcon> (); itemIcon.catIndex = catIndex; itemIcon.index = i; _itemPanels.Add(gameDataItem.resource, itemButtonTrans); int itemIndex = i; itemBtn = _itemPanels [gameDataItem.resource].GetComponent <Button> (); itemBtn.onClick.AddListener(() => OnItemClick(catIndex, itemIndex)); // Update Main Image SetIconButtonImage(itemBtn, dataCategoryItems.imagePath + gameDataItem.icons[0].normal); } }
/* * public virtual void loadItem(GameItemDirectorData itemData) { * StartCoroutine(LoadItemCo(itemData)); * } * * public IEnumerator LoadItemCo(GameItemDirectorData itemData) { * string modelPath = ContentPaths.appCacheVersionSharedPrefabLevelItems; * string characterType = "coin"; * * if(type == GamePlayerItemType.Coin) { * modelPath = Path.Combine(modelPath, "GamePlayerItemCoin"); * characterType = "coin"; * } * else if(type == GamePlayerItemType.Health) { * modelPath = Path.Combine(modelPath, "GamePlayerItemHealth"); * characterType = "health"; * } * * // TODO data and pooling and network * * UnityEngine.Object prefabObject = Resources.Load(modelPath); * Vector3 spawnLocation = Vector3.zero; * Vector3 currentPlayerPosition = Vector3.zero; * * if(GameController.CurrentGamePlayerController != null) { * if(GameController.CurrentGamePlayerController.gameObject != null) { * currentPlayerPosition = GameController.CurrentGamePlayerController.gameObject.transform.position; * } * } * spawnLocation.z = UnityEngine.Random.Range(currentPlayerPosition.z - 5f, currentPlayerPosition.z + 5f); * spawnLocation.x = UnityEngine.Random.Range(currentPlayerPosition.x - 20f, currentPlayerPosition.x + 20f); * spawnLocation.y = currentPlayerPosition.y + 100f; * * spawnLocation = GameController.FilterBounds(spawnLocation); * * LogUtil.Log("characterType:" + characterType); * * if(prefabObject == null) { * yield break; * } * * GameObject itemObject = Instantiate(prefabObject, spawnLocation, Quaternion.identity) as GameObject; * itemObject.transform.parent = GameController.Instance.itemContainerObject.transform; * * //GamePlayerController characterGamePlayerController = itemObject.GetComponentInChildren<GamePlayerController>(); * //characterGamePlayerController.transform.localScale = characterGamePlayerController.transform.localScale * character.scale; * * // Wire up ai controller to setup player health, speed, attack etc. * * // * //characterGamePlayerController.runtimeData. * * * * //if(characterGamePlayerController != null) { * // characterObject.Hide(); * // yield return new WaitForEndOfFrame(); * // wire up properties * * * // TODO network and player target * //characterGamePlayerController.currentTarget = GameController.CurrentGamePlayerController.gameObject.transform; * //characterGamePlayerController.ChangeContextState(GamePlayerContextState.ContextFollowAgent); * //characterGamePlayerController.ChangePlayerState(GamePlayerControllerState.ControllerAgent); * // characterObject.Show(); * * // Add indicator to HUD * * // GameHUD.Instance.AddIndicator(characterObject, characterType); * * //characterGamePlayerController.Init(GamePlayerControllerState.ControllerAgent); * //} * * //GameEnemyGoblin * //GameEnemyRobotDinosaur * //GameEnemyZombie * } */ //public virtual void spawnItem(GamePlayerItemType type) { // Position // Get boundaries //Vector3 // //} // MESSAGING public virtual void broadcastItemMessage(GameItemData item) { Messenger <GameItemData> .Broadcast(GameItemDirectorMessages.gameItemDirectorSpawnItem, item); }
public RegularFood(GameItemData data) : base(data);
public GameItemAsset(GameItemData data) { _reactionList = new List <Reaction>(); _iteamData = data; }
public virtual void loadItem(GameItemData item) { GameItemController.BroadcastItemMessage(item); }