コード例 #1
0
 /// <summary>
 /// Sets the cursor item to the specified item. This will result in the items icon replacing the cursor
 /// and allow it to be placed.
 /// </summary>
 /// <param name="item"></param>
 public void SetCursorAbility(AtavismAbility ability)
 {
     _cursorItem    = null;
     _cursorAbility = ability;
     _UpdateCursor();
     AtavismLogger.LogDebugMessage("Set cursor ability: " + ability + "," + ability.icon);
 }
コード例 #2
0
        /// <summary>
        /// Try to pickup an item that is equipped, or place an item that can be equipped if the cursor is currently
        /// holding an item.
        /// </summary>
        /// <param name="slotNum"></param>
        /// <param name="item"></param>
        public void PickupOrPlaceEquippedItem(string slotName, AtavismInventoryItem item)
        {
            if (item.slot != slotName)
            {
                return;
            }

            if (CursorHasItem())
            {
                // Place the item in the slot (possibly taking the item that was in the slot)
                AtavismLogger.LogDebugMessage("Drop item to equipped slot Old item: " + item);
                //TODO: this needs changed as an ability item could be activated if a person was to try equip it
                _cursorItem.Activate();
                ResetCursor();
                _UpdateCursor();
            }
            else if (CursorHasAbility())
            {
                AtavismLogger.LogDebugMessage("Cannot currently use abilities on items");
            }
            else
            {
                // Cursor is empty so set the item as the cursor item
                SetCursorItem(item);
            }
        }
コード例 #3
0
ファイル: StandardCommands.cs プロジェクト: clock2255/awagas
        public void HandleBuildingGridProbe(string args_str)
        {
            GameObject probe = (GameObject)Resources.Load("Content/BuildingGridProbe");

            Instantiate(probe, ClientAPI.GetPlayerObject().Position, ClientAPI.GetPlayerObject().Orientation);
            AtavismLogger.LogDebugMessage("Created probe");
        }
コード例 #4
0
ファイル: ClaimScript.cs プロジェクト: clock2255/awagas
        public void ScaleHandler(object sender, PropertyChangeEventArgs args)
        {
            AtavismLogger.LogDebugMessage("Got scale");
            Vector3 scaleObj = (Vector3)GetComponent <AtavismNode>().GetProperty("scale");

            gameObject.transform.localScale = scaleObj;
        }
コード例 #5
0
        public void AbilitiesPropertyHandler(object sender, ObjectPropertyChangeEventArgs args)
        {
            if (args.Oid != ClientAPI.GetPlayerOid())
            {
                return;
            }
            List <object> abilities_prop = (List <object>)ClientAPI.GetPlayerObject().GetProperty("abilities");

            AtavismLogger.LogDebugMessage("Got player abilities property change: " + abilities_prop);
            playerAbilities.Clear();
            //int pos = 0;
            foreach (int abilityNum in abilities_prop)
            {
                if (!abilities.ContainsKey(abilityNum))
                {
                    AtavismLogger.LogWarning("Ability " + abilityNum + " does not exist");
                    continue;
                }
                AtavismAbility ability = abilities[abilityNum].Clone(tempCombatDataStorage);
                playerAbilities.Add(ability);
            }
            // dispatch a ui event to tell the rest of the system
            string[] event_args = new string[1];
            AtavismEventSystem.DispatchEvent("ABILITY_UPDATE", event_args);
        }
コード例 #6
0
 /// <summary>
 /// Pick up (or drop) an item from a given container and slot.
 /// This will set the cursor to the item.
 /// </summary>
 /// <param name="bagNum"></param>
 /// <param name="slotNum"></param>
 /// <param name="item"></param>
 public void PickupOrPlaceBagItem(int bagNum, int slotNum, AtavismInventoryItem item)
 {
     if (CursorHasItem())
     {
         // Place the item in the slot (possibly taking the item that was in the slot)
         AtavismLogger.LogDebugMessage("Drop item to: " + bagNum + "," + slotNum);
         AtavismLogger.LogDebugMessage("Old item: " + item);
         //_SetContainerItem(containerId, slotId, MarsCursor._cursorItem)
         PlaceCursorItemInInventory(bagNum, slotNum);
         _cursorItem = item;
         _UpdateCursor();
     }
     else if (CursorHasBag())
     {
         // Place the item in the slot (possibly taking the item that was in the slot)
         AtavismLogger.LogDebugMessage("Drop item to: " + bagNum + "," + slotNum);
         AtavismLogger.LogDebugMessage("Old item: " + item);
         //_SetContainerItem(containerId, slotId, MarsCursor._cursorItem)
         PlaceCursorBagAsItem(bagNum, slotNum);
         _cursorItem = item;
         _UpdateCursor();
     }
     else if (CursorHasAbility())
     {
         AtavismLogger.LogDebugMessage("Cannot currently use abilities on items");
     }
     else
     {
         SetCursorItem(item);
     }
 }
コード例 #7
0
ファイル: WorldBuilder.cs プロジェクト: clock2255/awagas
        /// <summary>
        /// Handles the Claim Action Message from the server. Passes the data onto the voxel editor.
        /// </summary>
        /// <param name="props">Properties.</param>
        public void ClaimObjectMessage(Dictionary <string, object> props)
        {
            //  Debug.LogError("ClaimObjectMessage ");
            try
            {
                int        objectID   = (int)props["id"];
                int        templateID = (int)props["templateID"];
                string     prefabName = (string)props["gameObject"];
                Vector3    loc        = (Vector3)props["loc"];
                Quaternion orient     = (Quaternion)props["orient"];
                int        claimID    = (int)props["claimID"];
                //string state = (string)props["state"];

                AtavismLogger.LogDebugMessage("Got claim object: " + gameObject);
                //SpawnClaimObject(objectID, claimID, prefabName, loc, orient);
                ClaimObjectData objectData = new ClaimObjectData();
                objectData.objectID   = objectID;
                objectData.claimID    = claimID;
                objectData.templateID = templateID;
                objectData.prefabName = prefabName;
                objectData.loc        = loc;
                objectData.orient     = orient;
                objectData.state      = "";
                objectData.health     = (int)props["health"];
                objectData.maxHealth  = (int)props["maxHealth"];
                objectData.complete   = (bool)props["complete"];
                objectsToLoad.Add(objectData);
            }
            catch (System.Exception e)
            {
                Debug.LogError("ClaimObjectMessage Exception=" + e);
            }
            //  Debug.LogError("ClaimObjectMessage objectsToLoad=" + objectsToLoad.Count);
        }
コード例 #8
0
ファイル: AtavismAuction.cs プロジェクト: clock2255/awagas
        public void GetAuctionList()
        {
            AtavismLogger.LogDebugMessage("GetAuctionList Start");
            Dictionary <string, object> props = new Dictionary <string, object>();

            NetworkAPI.SendExtensionMessage(0, false, "auction.list", props);
            AtavismLogger.LogDebugMessage("GetAuctionList End");
        }
コード例 #9
0
        public static void SendCommandToServer(string command, long targetOid)
        {
            CommandMessage commandMessage = new CommandMessage();

            commandMessage.ObjectId = targetOid;
            commandMessage.Command  = command;
            AtavismNetworkHelper.Instance.SendMessage(commandMessage);
            AtavismLogger.LogDebugMessage("Sending command to server");
        }
コード例 #10
0
ファイル: WorldBuilder.cs プロジェクト: clock2255/awagas
        public void ClaimIDMessage(Dictionary <string, object> props)
        {
            int claimID = (int)props["claimID"];
            //   Debug.LogWarning("WorldBuilder Got Cliam id="+claimID);
            Claim claim = new Claim();

            if (GetClaim(claimID) != null)
            {
                claim = GetClaim(claimID);
            }
            else
            {
                claim.id = claimID;
            }

            claim.name  = (string)props["claimName"];
            claim.sizeX = (int)props["claimSizeX"];
            claim.sizeZ = (int)props["claimSizeZ"];
            claim.loc   = (Vector3)props["claimLoc"];
            claim.GenerateBounds();
            claim.claimType       = (ClaimType)props["claimType"];
            claim.ownerName       = (string)props["ownerName"];
            claim.forSale         = (bool)props["forSale"];
            claim.permissionlevel = (int)props["permissionLevel"];
            if (claim.forSale)
            {
                claim.cost     = (int)props["cost"];
                claim.currency = (int)props["currency"];
            }
            claim.purchaseItemReq = (int)props["purchaseItemReq"];
            claim.playerOwned     = (bool)props["myClaim"];
            // Player permissions
            claim.permissions.Clear();
            int permissionCount = (int)props["permissionCount"];

            for (int i = 0; i < permissionCount; i++)
            {
                ClaimPermission per = new ClaimPermission();
                per.playerName      = (string)props["permission_" + i];
                per.permissionLevel = (int)props["permissionLevel_" + i];
                claim.permissions.Add(per);
            }

            if (GetClaim(claimID) == null)
            {
                // Debug.LogWarning("WorldBuilder add to Cliam list id=" + claim.id);
                claims.Add(claim);
            }

            if (claim == activeClaim)
            {
                string[] args = new string[1];
                AtavismEventSystem.DispatchEvent("CLAIM_CHANGED", args);
            }
            AtavismLogger.LogDebugMessage("Got new claim data: " + claim.id);
        }
コード例 #11
0
        public static void HandleCommand(string message)
        {
            //This is the standard implementation of HandleCommand for handling commands entered on the client.
            AtavismLogger.LogDebugMessage("HandleCommand: " + message);
            if (message.Length == 0)
            {
                return;
            }
            if (!message.StartsWith("/"))
            {
                message = "/say " + message;
            }
            // Handle some client side commands
            string[] tokens = message.Split(' ');

            if (tokens.Length <= 0)
            {
                return;
            }
            string args = "";

            //for (int i = 0; i < tokens.Length-1; i++) {
            //	args[i] = tokens[i+1];
            //}
            if (message.Length > tokens[0].Length)
            {
                args = message.Substring(tokens[0].Length + 1);
            }
            string command = tokens[0].Substring(1);

            AtavismLogger.LogDebugMessage("num args: " + tokens.Length + " with command: " + command);
            if (_commandHandlers.ContainsKey(command))
            {
                // We have a local handler for this command on the client.
                CommandHandler function = _commandHandlers[command];
                try
                {
                    function(args);
                }
                catch (Exception e)
                {
                    UnityEngine.Debug.LogWarning("Failed to run command handler " + command + " for command line: " + message);
                    UnityEngine.Debug.LogWarning("Exception: " + e);
                }
            }
            else
            {
                // This command is not handled on the client.  Send it to the server.
                long target = ClientAPI.GetTargetOid();
                if (target == -1)
                {
                    target = ClientAPI.GetPlayerOid();
                }
                SendCommandToServer(message, target);
            }
        }
コード例 #12
0
 /// <summary>
 /// Sets the cursor item to the specified item. This will result in the items icon replacing the cursor
 /// and allow it to be placed.
 /// </summary>
 /// <param name="item"></param>
 public void SetCursorItem(AtavismInventoryItem item)
 {
     if (item != null)
     {
         _cursorItem    = item;
         _cursorAbility = null;
         _UpdateCursor();
         AtavismLogger.LogDebugMessage("Set cursor item: " + item + "," + item.icon);
     }
 }
コード例 #13
0
ファイル: WorldBuilder.cs プロジェクト: clock2255/awagas
        public void ClaimRemoveDataMessage(Dictionary <string, object> props)
        {
            int claimID = (int)props["claimID"];

            if (GetClaim(claimID) != null)
            {
                claims.Remove(GetClaim(claimID));
            }
            AtavismLogger.LogDebugMessage("Removed claim data: " + claimID);
        }
コード例 #14
0
ファイル: ClaimScript.cs プロジェクト: clock2255/awagas
 void ObjectNodeReady()
 {
     GetComponent <AtavismNode>().RegisterObjectPropertyChangeHandler("scale", ScaleHandler);
     if (GetComponent <AtavismNode>().PropertyExists("scale"))
     {
         AtavismLogger.LogDebugMessage("Got scale");
         Vector3 scaleObj = (Vector3)GetComponent <AtavismNode>().GetProperty("scale");
         gameObject.transform.localScale = scaleObj;
     }
 }
コード例 #15
0
ファイル: AtavismAuction.cs プロジェクト: clock2255/awagas
        public void CancelAuction(Auction auction, bool selling, bool buying)
        {
            AtavismLogger.LogDebugMessage("CancelAuction Start");
            Dictionary <string, object> props = new Dictionary <string, object>();

            props.Add("auctionId", auction.id);
            props.Add("selling", selling);
            props.Add("buying", buying);
            NetworkAPI.SendExtensionMessage(0, false, "auction.cancel", props);
            AtavismLogger.LogDebugMessage("CancelAuction End");
        }
コード例 #16
0
 public override void PlayAnimation(string animationName, float length)
 {
     //   Debug.LogWarning("PlayAnimation: >" + animationName + "< length:" + length);
     if (_animator != null && overrideAnimationName != null && overrideAnimationName != "")
     {
         AtavismLogger.LogDebugMessage("clearing old animation");
         _animator.SetBool(overrideAnimationName, false);
     }
     overrideAnimationName    = animationName;
     overrideAnimationExpires = Time.time + length;
 }
コード例 #17
0
ファイル: AtavismAuction.cs プロジェクト: clock2255/awagas
        public void GetAuctionsForGroup(string groupId = "", long itemOid = 0L)
        {
            AtavismLogger.LogDebugMessage("GetAuctionsForGroup Start");
            Dictionary <string, object> props = new Dictionary <string, object>();

            props.Add("groupId", groupId);
            props.Add("itemOid", itemOid);

            NetworkAPI.SendExtensionMessage(0, false, "auction.getAuctionForGroup", props);
            AtavismLogger.LogDebugMessage("GetAuctionsForGroup End");
        }
コード例 #18
0
ファイル: StandardCommands.cs プロジェクト: clock2255/awagas
        public void HandleOrient(string args_str)
        {
            AtavismLogger.LogDebugMessage("Got orient command");
            AtavismPlayer player = ClientAPI.GetPlayerObject();

#if AT_I2LOC_PRESET
            ClientAPI.Write(I2.Loc.LocalizationManager.GetTranslation("Player Position") + ": " + player.Orientation);
#else
            ClientAPI.Write("Player Position: " + player.Orientation);
#endif
        }
コード例 #19
0
ファイル: StandardCommands.cs プロジェクト: clock2255/awagas
        public void HandleSay(string args_str)
        {
            AtavismLogger.LogDebugMessage("Got say command with message: " + args_str);
            //ClientAPI.Network.SendCommMessage(args_str);
            CommMessage commMessage = new CommMessage();

            commMessage.ChannelId  = 1; // CommChannel.Say
            commMessage.Message    = args_str;
            commMessage.SenderName = ClientAPI.GetPlayerObject().Name;
            AtavismNetworkHelper.Instance.SendMessage(commMessage);
            AtavismLogger.LogDebugMessage("Sent chat message: " + commMessage);
        }
コード例 #20
0
        public void ActionStateHandler(object sender, PropertyChangeEventArgs args)
        {
            AtavismLogger.LogDebugMessage("Got actionstate");
            //	AtavismObjectNode node = (AtavismObjectNode)sender;
            string newState = (string)GetComponent <AtavismNode>().GetProperty(args.PropertyName);

            if (_animator != null && newState != actionState)
            {
                AtavismLogger.LogDebugMessage("clearing old actionstate");
                _animator.SetBool(actionState, false);
            }
            actionState = newState;
        }
コード例 #21
0
ファイル: AtavismAuction.cs プロジェクト: clock2255/awagas
        public void TakeReward(bool buying, bool selling, bool bought, bool sold, bool expired)
        {
            AtavismLogger.LogDebugMessage("TakeReward Start");
            Dictionary <string, object> props = new Dictionary <string, object>();

            props.Add("buying", buying);
            props.Add("selling", selling);
            props.Add("bought", bought);
            props.Add("sold", sold);
            props.Add("expired", expired);
            NetworkAPI.SendExtensionMessage(0, false, "auction.takeAll", props);
            AtavismLogger.LogDebugMessage("TakeReward End");
        }
コード例 #22
0
ファイル: AtavismAuction.cs プロジェクト: clock2255/awagas
        public void GetOwnAuctionList(bool buying, bool selling, bool bought, bool sold, bool expired)
        {
            AtavismLogger.LogDebugMessage("GetOwnAuctionList Start");
            Dictionary <string, object> props = new Dictionary <string, object>();

            props.Add("buying", buying);
            props.Add("selling", selling);
            props.Add("bought", bought);
            props.Add("sold", sold);
            props.Add("expired", expired);
            NetworkAPI.SendExtensionMessage(0, false, "auction.ownerList", props);
            AtavismLogger.LogDebugMessage("GetOwnAuctionList End");
        }
コード例 #23
0
ファイル: AtavismAuction.cs プロジェクト: clock2255/awagas
        public void BuyAuction(string itemGroupId, Dictionary <string, object> currencies, int count)
        {
            AtavismLogger.LogDebugMessage("BuyAuction Start");
            Dictionary <string, object> props = new Dictionary <string, object>();

            props.Add("startbid", 0);
            props.Add("buyout", currencies);
            props.Add("groupId", itemGroupId);
            props.Add("item_count", count);
            props.Add("auctioneer_oid", OID.fromLong(0));

            NetworkAPI.SendExtensionMessage(0, false, "auction.buy", props);
            AtavismLogger.LogDebugMessage("BuyAuction End");
        }
コード例 #24
0
        private void _HandleArenaStatUpdate(Dictionary <string, object> props)
        {
            AtavismLogger.LogDebugMessage("_HandleArenaStatUpdate START");
            try
            {
                string stat   = (string)props["stat"];
                OID    plyOid = (OID)props["player"];
                int    team   = (int)props["team"];
                int    score  = (int)props["score"];
                if (activeArenaTeams[team] != null)
                {
                    foreach (ArenaTeamPlayerEntry ply in activeArenaTeams[team].players)
                    {
                        if (ply.playerOid.Equals(plyOid))
                        {
                            switch (stat)
                            {
                            case "score":
                                ply.score = score;
                                break;

                            case "kill":
                                ply.kills = score;
                                break;

                            case "death":
                                ply.deaths = score;
                                break;

                            case "damageTaken":
                                ply.damageTaken = score;
                                break;

                            case "damageDealt":
                                ply.damageDealt = score;
                                break;
                            }
                        }
                    }
                }
                string[] args = new string[1];
                AtavismEventSystem.DispatchEvent("ARENA_SCORE_UPDATE", args);
            }
            catch (Exception e)
            {
                AtavismLogger.LogError("Arena._HandleArenaStatUpdate Exeption " + e.Message);
            }
            AtavismLogger.LogDebugMessage("_HandleArenaStatUpdate END");
        }
コード例 #25
0
ファイル: AtavismAuction.cs プロジェクト: clock2255/awagas
        public void HandleAuctionListForGroupUpdate(Dictionary <string, object> props)
        {
            AtavismLogger.LogDebugMessage("HandleAuctionListForGroupUpdate");

            /*  string keys = " [ ";
             * foreach (var it in props.Keys)
             * {
             *    keys += " ; " + it + " => " + props[it];
             * }
             * Debug.LogWarning("HandleAuctionOwnerListUpdate: keys:" + keys);
             */
            try
            {
                auctionsForGroupSell.Clear();
                auctionsForGroupOrder.Clear();
                costStartValue = (long)props["sPriceVal"];
                costStartPer   = (float)props["SPricePerc"];
                costEndValue   = (long)props["cPriceVal"];
                costEndPer     = (float)props["cPricePerc"];
                currecnyType   = (int)props["currency"];
                int numItemsSell  = (int)props["numItemsSell"];
                int numItemsOrder = (int)props["numItemsOrder"];
                for (int i = 0; i < numItemsSell; i++)
                {
                    AuctionCountPrice auctionInfo = new AuctionCountPrice();

                    auctionInfo.count    = (int)props["auctionSell_" + i + "Count"];
                    auctionInfo.price    = (long)props["auctionSell_" + i + "Price"];
                    auctionInfo.currency = (int)props["auctionSell_" + i + "Currency"];
                    auctionsForGroupSell.Add(auctionInfo.price, auctionInfo);
                }
                for (int i = 0; i < numItemsOrder; i++)
                {
                    AuctionCountPrice auctionInfo = new AuctionCountPrice();

                    auctionInfo.count    = (int)props["auctionOrder_" + i + "Count"];
                    auctionInfo.price    = (long)props["auctionOrder_" + i + "Price"];
                    auctionInfo.currency = (int)props["auctionOrder_" + i + "Currency"];
                    auctionsForGroupOrder.Add(auctionInfo.price, auctionInfo);
                }
                string[] args = new string[1];
                AtavismEventSystem.DispatchEvent("AUCTION_LIST_FOR_GROUP_UPDATE", args);
            }
            catch (Exception e)
            {
                AtavismLogger.LogError("AtavismAuction.HandleAuctionOwnerListUpdate Exeption " + e.Message);
            }
            AtavismLogger.LogDebugMessage("HandleAuctionOwnerListUpdate End");
        }
コード例 #26
0
ファイル: AtavismAuction.cs プロジェクト: clock2255/awagas
        public void CreateAuction(AtavismInventoryItem item, Dictionary <string, object> currencies, int count, string itemGroupId)
        {
            AtavismLogger.LogDebugMessage("CreateAuction Start");
            Dictionary <string, object> props = new Dictionary <string, object>();

            props.Add("startbid", 0);
            props.Add("buyout", currencies);

            props.Add("item_oid", item.ItemId);
            props.Add("item_count", count);
            props.Add("itemgroup", itemGroupId);
            props.Add("auctioneer_oid", OID.fromLong(0));
            NetworkAPI.SendExtensionMessage(0, false, "auction.createSell", props);
            AtavismLogger.LogDebugMessage("CreateAuction End");
        }
コード例 #27
0
ファイル: StandardCommands.cs プロジェクト: clock2255/awagas
        public void HandleLoc(string args_str)
        {
            AtavismLogger.LogDebugMessage("Got loc command");
            AtavismObjectNode target = ClientAPI.GetTargetObject();

            if (target == null)
            {
                target = ClientAPI.GetPlayerObject();
            }
#if AT_I2LOC_PRESET
            ClientAPI.Write(I2.Loc.LocalizationManager.GetTranslation("Target Position") + ": " + target.Position);
#else
            ClientAPI.Write("Target Position: " + target.Position);
#endif
        }
コード例 #28
0
        void UpdateActions()
        {
            if (ClientAPI.GetPlayerObject() == null || !ClientAPI.GetPlayerObject().PropertyExists("actions"))
            {
                return;
            }
            actions.Clear();

            List <object> actions_prop = (List <object>)ClientAPI.GetPlayerObject().GetProperty("actions");

            AtavismLogger.LogDebugMessage("Got player actions property change: " + actions_prop);
            int pos = 0;
            //	int bar = 0;

            //foreach (List<object> actionList in actions_prop) {
            List <AtavismAction> actionBar = new List <AtavismAction>();

            foreach (string actionString in actions_prop)
            {
                AtavismAction action = new AtavismAction();
                if (actionString.StartsWith("a"))
                {
                    action.actionType = ActionType.Ability;
                    int abilityID = int.Parse(actionString.Substring(1));
                    action.actionObject = GetComponent <Abilities>().GetAbility(abilityID);
                }
                else if (actionString.StartsWith("i"))
                {
                    action.actionType = ActionType.Item;
                    int itemID = int.Parse(actionString.Substring(1));
                    action.actionObject = Inventory.Instance.GetItemByTemplateID(itemID);
                }
                else
                {
                    action.actionType = ActionType.None;
                }
                action.slot = pos;
                //if (actionBars[bar] != null)
                //	actionBars[bar].SendMessage("ActionUpdate", action);
                pos++;
                actionBar.Add(action);
            }
            actions.Add(actionBar);
            //}
            // dispatch a ui event to tell the rest of the system
            string[] event_args = new string[1];
            AtavismEventSystem.DispatchEvent("ACTION_UPDATE", event_args);
        }
コード例 #29
0
ファイル: WorldBuilder.cs プロジェクト: clock2255/awagas
        /// <summary>
        /// Handles the Remove Claim Message which means a player is no longer in the radius for a claim
        /// so the client no longer needs to check if they are in its edit radius.
        /// </summary>
        /// <param name="props">Properties.</param>
        public void RemoveClaimMessage(Dictionary <string, object> props)
        {
            AtavismLogger.LogDebugMessage("Got remove claim data " + claims.Count);
            try
            {
                int claimID = (int)props["claimID"];
                //   Debug.LogWarning("WorldBuilder Got Cliam to remove id="+claimID);
                Claim claimToRemove = null;
                foreach (Claim claim in claims)
                {
                    if (claim.id == claimID)
                    {
                        //   Debug.LogWarning("WorldBuilder Cliam to remove id=" + claimID);

                        /*int itemID = (int)props["resource"];
                         *       int count = (int)props["resourceCount"];
                         *       claim.resources[itemID] = count;*/
                        foreach (ClaimObject cObject in claim.claimObjects.Values)
                        {
                            //  Debug.LogWarning("WorldBuilder Cliam to remove id=" + claimID+" COid"+cObject.ID+" name="+ cObject.name);
                            DestroyImmediate(cObject.gameObject);
                        }
                        claimToRemove = claim;
                        break;
                    }
                }
                if (claimToRemove != null)
                {
                    if (claimToRemove == activeClaim)
                    {
                        activeClaim = null;
                        string[] args = new string[1];
                        AtavismEventSystem.DispatchEvent("CLAIM_CHANGED", args);
                    }
                    claims.Remove(claimToRemove);
                    if (claimGameObjects.ContainsKey("Claim" + claimID))
                    {
                        DestroyImmediate(claimGameObjects["Claim" + claimID]);
                        claimGameObjects.Remove("Claim" + claimID);
                    }
                }
            }
            catch (System.Exception e)
            {
                AtavismLogger.LogError("Got remove claim data Exception " + e.Message + " " + e);
            }
            AtavismLogger.LogDebugMessage("Got remove claim data end " + claims.Count);
        }
コード例 #30
0
        public void HandleActionsUpdate(Dictionary <string, object> props)
        {
            AtavismLogger.LogInfoMessage("Got Actions Update");
            try
            {
                actions.Clear();
                mainActionBar = (int)props["currentBar"];
                int numBars = (int)props["numBars"];
                for (int i = 0; i < numBars; i++)
                {
                    List <AtavismAction> actionBar = new List <AtavismAction>();
                    int barActionCount             = (int)props["barActionCount" + i];
                    for (int j = 0; j < barActionCount; j++)
                    {
                        AtavismAction action       = new AtavismAction();
                        string        actionString = (string)props["bar" + i + "action" + j];
                        if (actionString.StartsWith("a"))
                        {
                            action.actionType = ActionType.Ability;
                            int abilityID = int.Parse(actionString.Substring(1));
                            action.actionObject = GetComponent <Abilities>().GetAbility(abilityID);
                        }
                        else if (actionString.StartsWith("i"))
                        {
                            action.actionType = ActionType.Item;
                            int itemID = int.Parse(actionString.Substring(1));
                            action.actionObject = Inventory.Instance.GetItemByTemplateID(itemID);
                        }
                        else
                        {
                            action.actionType = ActionType.None;
                        }
                        action.slot = j;
                        actionBar.Add(action);
                    }
                    actions.Add(actionBar);
                }

                // dispatch a ui event to tell the rest of the system
                string[] event_args = new string[1];
                AtavismEventSystem.DispatchEvent("ACTION_UPDATE", event_args);
            }
            catch (Exception e)
            {
                AtavismLogger.LogError("Auction.HandleActionsUpdate Exeption " + e.Message);
            }
            AtavismLogger.LogDebugMessage("HandleActionsUpdate End");
        }